Commit graph

379 commits

Author SHA1 Message Date
Olivier Teulière
350666b568 - The last commit in cross.cpp fixed a bug but introduced another one, now both are fixed
- Added unit tests for both bugs
 - Fixed another bug preventing to enter some letters in the training rack
2008-10-15 19:43:23 +00:00
Olivier Teulière
fa5d97f942 - Be slightly more tolerant in release mode
- Prepare for release 1.7
2008-09-25 20:39:37 +00:00
Olivier Teulière
9498d044f8 - Install a desktop file to get an entry in the applications menu on Linux (works on both Gnome and KDE)
- New (optional) dependency on the libconfig library, to save/load configuration files.
 - On Unix, the location of the configuration file respects the XDG Base Directory Specification.
 - The contrib system automatically fetches and builds libconfig for Windows cross-compilation
 - Fixed make distcheck
2008-09-22 21:21:38 +00:00
Olivier Teulière
a9626975e0 - Support shuffling the rack of the current player
- More intuitive players management (in particular when there are several
   human players)
2008-09-14 17:56:18 +00:00
Olivier Teulière
12cc41fce7 Core:
- Fixed a crash on Windows
 - Do not authorize words if the cross-checks are invalid (it was possible when playing a joker)
 - Fixed detextion of invalid moves
 - Improved unit tests, and fixed a bug in one of them

Qt interface:
 - Do not allow playing a word if the coordinates are missing
 - Better focus
2008-09-13 21:32:45 +00:00
Olivier Teulière
0696a1b4a2 Qt interface:
- Be more explicit if the dictionary name is missing
 - Changed the colour of the joker on the board, instead of displaying it in lower case
 - Incorrect words are now refused by default
 - Changed the way words are input: the case is no longer relevant,
   and the coordinates are in a separate control
 - Explain the problem when a word is refused
 - Updated the French translation
2008-09-07 21:06:17 +00:00
Olivier Teulière
990f4c5212 Qt interface:
- Initialize the random numbers generator, and print the seed value
 - Handle properly Qt builds without STL support
 - Save the position of the main window
 - Got rid of the useless toolbar
 - Better size of the preferences dialog
 - Hopefully fixed translation issues on Windows
 - The Settings class throws an exception when asked for a non-existing setting
2008-09-05 21:31:30 +00:00
Olivier Teulière
75a67b28a5 Dic:
- Throw an exception if a regular expresison is invalid
 - Handle the exception in callers code

Game:
 - Fixed a bug in setRackRandom()

Qt interface:
 - Display the dictionary name in the status bar
 - Implemented printing
 - Translation of the interface into French. The menus have temporarily lost their accelerator keys in English.
2008-08-31 11:48:11 +00:00
Olivier Teulière
fa493d4135 Fixed a warning 2008-07-27 15:26:15 +00:00
Olivier Teulière
7ea51d2f23 Compilation fixes for some systems (missing headers) 2008-07-20 12:15:51 +00:00
Olivier Teulière
597673e8e5 Fixed an invalid read when sorting the search results and adapted regression scenarii 2008-07-04 19:03:12 +00:00
Olivier Teulière
cc70ccabef Fixed typos 2008-07-03 20:14:46 +00:00
Olivier Teulière
c7f85ce151 - Search results with the same score are now sorted alphabetically
- Adapted test scenarii for the new order of results
2008-03-03 22:13:58 +00:00
Olivier Teulière
0acc5cd48f Do not try to complete the rack when no letter was removed 2008-02-12 21:02:39 +00:00
Olivier Teulière
52b7363888 Players are not created by the Game object anymore but by the user of the class.
This allows more flexibility, in particular to choose the type of player or its name.
2008-01-28 19:17:33 +00:00
Olivier Teulière
d8780822c2 - Fixed a bug due to the reject sign '-' preventing to load a saved training game
- Qt interface: Loading and saving a game is now supported (it only works in
   training mode, due to limitations in the core)
2008-01-26 10:10:50 +00:00
Olivier Teulière
0a4b342f78 - Players can now have a name
- Use player names in the ncurses interface
 - In training mode, create the hidden player in the constructor, not in start()
 - When the AI has nothing to play, change the letters instead of simply passing
 - New Makefile to build the win32 dependencies automatically (INSTALL file updated)
2008-01-19 19:33:08 +00:00
Olivier Teulière
8c3708fa99 - Removed Game::setRackRandomOld() (replaced by Game::setRackRandom())
- Adapted regression scenarii
2008-01-15 14:56:38 +00:00
Olivier Teulière
572b31c64e - dic/encoding.cpp: simplification (this also removes a warning)
- game/rack.*: added a missing const
 - game/game_io.cpp: fixed a compilation warning
2008-01-11 10:09:26 +00:00
Olivier Teulière
7e7f7f2dfa - wxwin/mainframe.cc: Fixed a crash occurring when no config file is found
- Fixed a bug occurring in duplicate mode: sometimes the game ended too early,
   while it was still allowed to go on.
   Also updated the corresponding regression scenario
2008-01-10 10:23:36 +00:00
Olivier Teulière
81e980104f - Board::GetLetterMultiplier() and Board::GetWordMultiplier() are now static
- Added 2 convenient getters: Dictionary::getName() and Bag::getDic()
2008-01-09 10:48:19 +00:00
Olivier Teulière
ba230eda60 - Bumped version number to 1.6
- Used the -Wall option of automake, and fixed the reported warnings
 - Updated french translation
2008-01-08 16:09:08 +00:00
Olivier Teulière
e7a8d01a8d Merged the "cppdic" branch back into HEAD.
There are too many change to list properly, here is an overview of the main changes:
 - the dictionary is now in C++
 - the dictionary has a new format, where it is possible to specify the letters,
   their points, their frequency, ... It is backwards compatible.
 - Eliot now supports non-ASCII characters everywhere
 - i18n of the compdic, listdic, regexpmain binaries
 - i18n of the wxWidgets interface (now in english by default)
2008-01-08 13:52:32 +00:00
Antoine Fraboulet
d86bd2af4a - 32/64 bits types
- unused function parameters
2007-08-04 20:01:27 +00:00
Olivier Teulière
5199b6b7c1 Cosmetic changes 2006-12-23 16:48:15 +00:00
Olivier Teulière
421d0a29b1 Fixed a few char/wchar_t issues. The remaining ones need a wchar_t-aware dictionary 2006-12-23 13:50:43 +00:00
Olivier Teulière
9949225b8b Fixed a nasty bug, due to the way jokers are handled 2006-11-05 17:04:39 +00:00
Antoine Fraboulet
5b8cbbe680 - correct typo on alignment 2006-11-05 13:31:49 +00:00
Antoine Fraboulet
ec3a91e444 - _wtoi correction 2006-11-05 13:30:54 +00:00
Antoine Fraboulet
603a75a98c - extra debug output command for board cross info
- simplified cross class
- bug fix on cross information handling during backward moves
2006-11-05 13:30:06 +00:00
Antoine Fraboulet
69dada550b - add "load" in game_factory 2006-08-11 22:14:21 +00:00
Antoine Fraboulet
8d79f6ba78 - typo in declaration 2006-08-11 22:13:41 +00:00
Antoine Fraboulet
9f86b53021 - add debug strings 2006-08-11 22:13:02 +00:00
Antoine Fraboulet
f9af9493d2 - bug correction for game::play when playing on a joker tile 2006-08-11 22:12:10 +00:00
Olivier Teulière
bb5a17d0f1 Indentation 2006-01-22 20:48:17 +00:00
Olivier Teulière
77be2e9219 Backport of the 'multibyte' branch on HEAD. 2006-01-22 12:23:52 +00:00
Olivier Teulière
2799f5191e Use forward declarations to reduce dependencies 2006-01-02 19:05:37 +00:00
Antoine Fraboulet
4665fa176b - add comments and emacs mode 2006-01-01 19:49:35 +00:00
Antoine Fraboulet
55badf52e4 - correct helperSetRackRandom with RACK_ALL (replace tiles in bag)
- add game_io.cpp to load/save a game
2006-01-01 19:48:36 +00:00
Antoine Fraboulet
5bdca9e9fd - pldrack.h
add comments and emacs mode
    add modes for toString

- pldrack.cpp
    add modes for toString
    add bool "reject", should be used later to notify a reject during game
    add setRack(string)
2006-01-01 19:47:26 +00:00
Antoine Fraboulet
63005cdddb add comments and emacs mode 2006-01-01 19:47:03 +00:00
Antoine Fraboulet
fee2ddff8f - revert dic_chr patch. make dic_char instead. 2006-01-01 19:37:57 +00:00
Antoine Fraboulet
fea2ba6068 - correct off by one in score, once again. index+1 is right !
- revert previous dic_chr patch. make dic_char instead.
   The board should/will use codes instead of tiles for performance reasons
   in the next version
2006-01-01 19:37:26 +00:00
Antoine Fraboulet
2c262bcc34 Game load/save handling 2006-01-01 19:36:16 +00:00
Olivier Teulière
3ecf740432 - do not use std:: everywhere, it justs makes the code harder to read
- history.h: use forward declarations to reduce dependencies
 - history.cpp: fixed a compilation warning
2005-12-27 16:54:38 +00:00
Olivier Teulière
9aeeafa61b Removed the useless Game::getPlayerRack() method 2005-12-27 15:01:07 +00:00
Olivier Teulière
af720a02ee - Commented out some debug messages preventing the regression to work properly.
- Re-indented a few lines to remove tabulations and keep a consistent coding style
2005-12-27 13:11:17 +00:00
Antoine Fraboulet
fc157bc08f - correct bug in Game::back
- add regression test for this case
2005-12-27 01:06:54 +00:00
Antoine Fraboulet
d3e9d1e0ac - off by one in History. corrected. all regression tests ok.
Scenario: training_dict
Scenario: training_bag
Scenario: training_search
Scenario: training_play
Scenario: duplicate_2_ai
Scenario: freegame_passing
Scenario: freegame_change
Scenario: freegame_3_ai

Summary: Everything was OK.
2005-12-27 00:06:23 +00:00
Antoine Fraboulet
4c56636aef - use History class
- back is still buggy
2005-12-26 22:58:58 +00:00
Antoine Fraboulet
4881a63f75 - use History class 2005-12-26 22:58:19 +00:00
Antoine Fraboulet
1ea7bbaf9e - comment update 2005-12-26 22:57:44 +00:00
Antoine Fraboulet
e25d5825a6 - add toString 2005-12-26 22:56:40 +00:00
Antoine Fraboulet
061242ed15 - correct empty round to have valid coord 2005-12-26 22:55:26 +00:00
Antoine Fraboulet
712ddb5125 - use of History class 2005-12-26 22:54:02 +00:00
Antoine Fraboulet
3f4c290745 - modified to use History
- add setRack wrapper for both manual and random
2005-12-26 22:53:26 +00:00
Antoine Fraboulet
28fcd062bf - add toString method 2005-12-26 22:52:38 +00:00
Antoine Fraboulet
3bde5c3da5 - since we use History, the first round is numbered 1
- separate sort_by_points method, removed call from board_search
2005-12-26 21:22:21 +00:00
Antoine Fraboulet
1fb948cba9 - player now use History class for turn storage 2005-12-26 21:18:21 +00:00
Antoine Fraboulet
74900ca592 - add simple printout debug msg 2005-12-26 21:10:59 +00:00
Antoine Fraboulet
7bc239adfc - add toString() method 2005-12-26 21:08:08 +00:00
Antoine Fraboulet
159cb33b75 - add history.[h|cpp] 2005-12-26 20:13:02 +00:00
Antoine Fraboulet
91442662d0 - fixed typo 2005-12-26 19:43:21 +00:00
Antoine Fraboulet
9fa76dda0e Makefile.am 2005-12-26 19:19:42 +00:00
Antoine Fraboulet
983d413a3b - adding empty constructor for History 2005-12-26 19:17:49 +00:00
Antoine Fraboulet
504198b8ff - adding shortcut for getCurrentPlayer() 2005-12-26 18:09:52 +00:00
Antoine Fraboulet
f3ee945b91 - remove results members access methods from Training Class
- add m_testPlay for temporary placed words
2005-12-26 18:07:26 +00:00
Antoine Fraboulet
9b9fcfae4c - re-enabling toString() 2005-12-26 15:53:37 +00:00
Antoine Fraboulet
ce001c7aa2 - adding getWord and toString methods 2005-12-26 15:52:48 +00:00
Antoine Fraboulet
3c31b8a2e2 - backport modifications from branch 2005-12-26 15:33:15 +00:00
Olivier Teulière
96fe9f22b1 Dic_chr returns the actual char, not a code between 0 and 31.
Dic_lookup takes a string containing real chars, not codes.
The idea is to hide the internal representation of the characters from the
users of the dictionary, who don't care about it.
2005-12-24 18:42:44 +00:00
Olivier Teulière
5f74291e5c Fixed a typo in a comment 2005-12-23 22:19:22 +00:00
Olivier Teulière
777a6a5e8c The constuctors of the players now take as argument the ID of the player 2005-11-06 17:13:45 +00:00
Olivier Teulière
9e5b6e8ebf Use Turn objects for the players history too 2005-11-06 14:53:15 +00:00
Olivier Teulière
966418bf98 Typo 2005-11-06 01:09:41 +00:00
Olivier Teulière
4cef120cce Minor factorization, and avoided another copy of PlayedRack 2005-11-06 01:05:06 +00:00
Olivier Teulière
d64e22dc6b Fixed a typo and avoided a useless copy 2005-11-06 00:38:16 +00:00
Olivier Teulière
26b446f62b Simplification in the PlayedRack history at Player level 2005-11-05 23:57:41 +00:00
Olivier Teulière
03e8a80128 Use a vector of Turn objects instead of several history vectors 2005-11-05 23:22:41 +00:00
Olivier Teulière
5b682ef9b8 - Removed Game::format*
- Added Game::getPlayer
2005-11-05 15:48:59 +00:00
Olivier Teulière
12894e00e2 Take more advantage of the Coord class, and remove the useless accessors
from Round (to force using the Coord object)
2005-11-05 13:56:59 +00:00
Olivier Teulière
85a30f16a2 Use the Coord class for rounds 2005-11-05 11:01:58 +00:00
Olivier Teulière
50fc82f60c First backports from the branch (Game::getBoard and Game::getBag, mainly) 2005-11-04 23:26:03 +00:00
Olivier Teulière
fe13a5e627 Removed the $Id:$ lines on HEAD 2005-11-04 20:00:05 +00:00
Olivier Teulière
83bf9d8b37 Check the mandatory options in the command-line, to output a better error
message
2005-10-23 16:12:29 +00:00
Olivier Teulière
e3bc46b114 Updated licence text with FSF's new address. 2005-10-23 14:53:42 +00:00
Antoine Fraboulet
6626d0ee8c Game history class, will be used for games and players 2005-08-15 22:20:20 +00:00
Antoine Fraboulet
b4e52e47cc Eliot coordicate system 2005-08-15 18:14:52 +00:00
Antoine Fraboulet
3f438199a9 A turn is a tuple (Num,Player,PlayedRack,Round) 2005-08-15 18:13:57 +00:00
Olivier Teulière
eccb1ca5bb Pass argument by reference to avoid a copy 2005-04-20 20:58:51 +00:00
Olivier Teulière
1895268549 Simplification; this should fix the compilation problem with gcc 3.4 2005-04-20 18:52:39 +00:00
Antoine Fraboulet
1077565ace added toCode() function that should clarify the interface with the
dictionary. This function should be used wherever it applies to get
the internal dictionnary code that match the Tile.
2005-04-19 16:24:32 +00:00
Antoine Fraboulet
0d69751dfb "int getNCharInBag(char) const" changed to "int getNCharInBag(Tile) const;" 2005-04-19 16:23:04 +00:00
Olivier Teulière
25304bd978 test/*: Added non-regression tests, based on the text interface.
'regression.pl' is the script that runs the regression, and 'drivers' contains
the list of scenario files to be played.
By default, the complete regerssion is played, but you can play specific
scenarios by adding them to the command-line.
Example: ./regression.pl training_bag freegame_change
2005-04-16 15:47:59 +00:00
Olivier Teulière
b16b969406 When the letters to change are incorrect, do not end the turn for the player 2005-04-16 15:43:14 +00:00
Antoine Fraboulet
76178efe99 getPlayerRack display option added 2005-04-09 16:11:04 +00:00
Antoine Fraboulet
96e94a6be3 getPlayerRack display option added + Game::back() error return 2005-04-09 16:10:25 +00:00
Antoine Fraboulet
5e08e1cf6a manually entered racks can be lowercase or uppercase 2005-04-09 15:14:00 +00:00
Antoine Fraboulet
aa828e1f8e int -> unsigned int return values (count and points) 2005-04-09 14:58:24 +00:00
Antoine Fraboulet
8ed5045d75 minor modifications 2005-04-09 14:56:03 +00:00
Olivier Teulière
6b025b9541 - Several fixes in the build system
- Added a bootstrap script to reduce manual work
 - Added a --enable-debug configure switch to define the DEBUG variable
2005-04-03 21:12:03 +00:00
Olivier Teulière
b65c045cfe Removed Game::getCurrentRack(), since Game::getPlayerRack() does exactly the
same...
2005-04-02 21:21:30 +00:00
Olivier Teulière
016aa2e4fe Cross::m_tilesSet is now private 2005-04-02 21:03:45 +00:00
Olivier Teulière
daeb2cb228 Fixed a nasty bug when playing a joker game. 2005-04-02 20:46:42 +00:00
Olivier Teulière
f38e884d31 Simplification 2005-04-02 18:21:24 +00:00
Olivier Teulière
ce71e10aef Fixed a comment and made PlayedRack::toString() a const method 2005-04-02 18:05:21 +00:00
Olivier Teulière
383548a799 Fixed compilation of Board::checkDouble() in debug mode (the == operator was
missing for Cross objects)
2005-04-02 17:59:07 +00:00
Antoine Fraboulet
08f15f9fe7 checkDouble does not work un debug mode, don't know why (Matrix[][] does not resolve to template type ?) 2005-03-29 06:58:23 +00:00
Antoine Fraboulet
ebe08e3d6e add a getCurrentRack for display purpose 2005-03-29 06:56:06 +00:00
Antoine Fraboulet
ae729ca8ae add toString method for PlayedRack text display 2005-03-29 06:54:08 +00:00
Olivier Teulière
7406f2c3c5 Added support for "Joker games", available using --joker on the command-line.
This is a kind of hack currently, but it works well...
2005-03-28 22:07:22 +00:00
Olivier Teulière
4dcc22f27a Added comments on what we should do, according to the rules in he ODS 2005-03-28 15:23:55 +00:00
Olivier Teulière
178560bc63 Repaired handling of changing letters 2005-03-28 14:55:27 +00:00
Olivier Teulière
bd07fedf18 Fixed a stupid bug i just introduced 2005-03-27 22:08:31 +00:00
Olivier Teulière
57c1fcaf8e Added an ASSERT macro, which aborts execution if the condition given as a
parameter is not verified. This simplifies te code in several places.
The old PDEBUG macro has been removed.
2005-03-27 21:45:04 +00:00
Olivier Teulière
5784cec146 Added/updated comments in many headers 2005-03-27 17:30:48 +00:00
Olivier Teulière
f45fd22c16 The game mode and the players are nod hardcoded anymore in the ncurses
interface: they can be entered with the command-line (parsed using getopt).
The text interface does not benefit from this facility yet.
2005-03-03 22:14:41 +00:00
Olivier Teulière
7db671ad31 Isolated the print* methods in a dedicated class, outside of the Game library 2005-02-26 22:57:34 +00:00
Olivier Teulière
6ca09c9ac9 Added a GameFactory class to centralize the allocation and deallocation of
Game objects.
2005-02-24 08:06:24 +00:00
Olivier Teulière
82547c5f66 - Better handling of the players with inheritance and with a clean interface
for the AI players
 - Moved the search results accessors from Game to Training
2005-02-17 20:01:59 +00:00
Olivier Teulière
222d1989a2 Cosmetics 2005-02-13 17:14:31 +00:00
Olivier Teulière
cf94b4e015 Handling of which player has played is only done in the Duplicate class now
(since the other modes do not need this)
2005-02-12 18:54:57 +00:00
Olivier Teulière
d41530c496 Minor API enhancements 2005-02-09 22:33:56 +00:00
Olivier Teulière
b7032e2d78 - The Game library is now in C++.
This simplifies the code in many places, and allows inheritance of the
   game mode classes (Training, Duplicate and FreeGame).
 - A Tile is no more an unsigned char, but a class: it should help supporting
   i18n of the game. The Dic library still uses unsigned chars though.
 - Improved the configure script, to enable/disable the compilation of some
   interfaces.
 - Added a ncurses interface, much nicer than the text one. The game mode and
   the number of players are currently hardcoded, it is not possible to change
   them interactively (yet).
 - Repaired the save/load functions.

NOTE: The wxWindows interface compiles, but is completely broken. I'm afraid it
needs a full rewrite (to support the various game modes in particular).
2005-02-05 11:14:56 +00:00
Olivier Teulière
f8074f5e02 Forgot these files 2004-08-07 18:25:03 +00:00
Olivier Teulière
b102aafbcd Support for 3 different game modes:
- 'Training' mode: same behaviour as before
  - 'Duplicate' mode: all the players (who can be human players or AI
    players) have the same rack, and the best word is played on the
    board
  - 'Free game' mode: the players (human or AI) have different racks,
    and they play one after another

Status:
  - Core: the main functions are written, but the API could be more
    homogeneous between the different modes.
  - Interfaces: the text interface is almost up-to-date, but the
    wxwindows one only supports Training mode.
  - AI: Currently, AI players always play the best word, which is
    optimal in Duplicate mode but not in FreeGame mode. Other strategies
    will be written in the future.
  - Handling of saved games is broken: a game can be saved and loaded,
    but no information about the mode and the players is stored, so it
    crashes whatever you do after loading the game.
2004-08-07 18:10:42 +00:00
Olivier Teulière
acd1aa0f1b Added .cvsignore files 2004-07-08 18:17:31 +00:00
Olivier Teulière
ac04544f70 Increased PLAYEDRACK_MAX, to avoid a crash when too many words were
played in a game
2004-07-04 18:50:30 +00:00
Antoine Fraboulet
90b1affcef *** empty log message *** 2004-04-08 09:43:06 +00:00