Commit graph

379 commits

Author SHA1 Message Date
Olivier Teulière
06aad1b274 Create the configuration directory with all the intermediate directories (like mkdir -p) 2012-06-09 19:19:06 +02:00
Olivier Teulière
6dbfcc5f99 Arbitration: the Random button now takes the remaining letters into account 2012-05-30 20:37:47 +02:00
Olivier Teulière
2b6b85cce3 Arbitration: allow removing penalties 2012-05-20 22:12:42 +02:00
Olivier Teulière
3c29804148 Savegames: save/load properly the warnings, penalties and solos 2012-05-20 21:31:45 +02:00
Olivier Teulière
1ad1ef7425 Arbitration: use the same solo-related settings as in duplicate mode 2012-05-05 19:58:31 +02:00
Olivier Teulière
0095302b88 Use dedicated getters for the Move type: this is simpler to use and more readable 2012-05-05 19:45:44 +02:00
Olivier Teulière
6ba32f4835 New utility methods to retrieve the total number of penalty (or solo) points for a player 2012-05-05 19:45:44 +02:00
Olivier Teulière
572d172640 Arbitration: new option to specify the number of "authorized" warnings. Not used yet. 2012-05-05 19:45:44 +02:00
Olivier Teulière
e6c1a180c8 Arbitration: by convention, use negative values to indicate a penalty 2012-05-05 19:45:44 +02:00
Olivier Teulière
917c94fd5e Display the total number of warnings of a player in the corresponding history tab title 2012-04-28 15:34:38 +02:00
Olivier Teulière
c4fad05ffd Arbitration: new option to deactivate the automatic random rack 2012-04-28 15:34:37 +02:00
Olivier Teulière
de5783d51a Auto-save the current game regularly, to reduce the loss in case of crash 2012-04-28 15:34:37 +02:00
Olivier Teulière
36bfa92761 Arbitration: a few fixes to improve usage of the text interface 2012-04-28 15:34:37 +02:00
Olivier Teulière
afb45d62c4 Preferences: removed the option to link the rack with the 7+1 dictionary tool 2012-04-28 15:34:36 +02:00
Olivier Teulière
1086051e56 Fixed loading of duplicate games 2012-04-16 20:32:57 +02:00
Olivier Teulière
0b3120a792 Duplicate: assign a "no move" pseudo-move to all players when starting a turn 2012-04-11 20:02:18 +02:00
Olivier Teulière
196e02f9ad Duplicate: get rid of the MarkPlayedCmd class 2012-04-11 20:02:18 +02:00
Olivier Teulière
1db5ccea8b Arbitration: assign a "no move" pseudo-move to all players when starting a turn 2012-04-11 20:02:18 +02:00
Olivier Teulière
4e61dd85ce FreeGame: generate "no move" pseudo-moves
Now each player has a move at each turn, in all the game modes.
This should help to simplify the code in a few places...
2012-04-11 20:02:15 +02:00
Olivier Teulière
21ee07cc3b Move::ComputeRackForMove() now returns a PlayedRack instead of a simple Rack 2012-04-10 08:51:12 +02:00
Olivier Teulière
c423da2425 Saved games: increase the XML format version, to indicate incompatibilities 2012-04-08 20:57:46 +02:00
Olivier Teulière
76d761ad8d Saved games: do not write a playerid attribute for the MasterMove tag 2012-04-08 20:57:46 +02:00
Olivier Teulière
a5f13e3ba7 Saved games: write the dictionary letters as display strings 2012-04-08 20:57:46 +02:00
Olivier Teulière
53adb5d91b Saved games: do not support the (very) old format anymore 2012-04-08 20:57:46 +02:00
Olivier Teulière
1e57b56f9d Fixed compilation warnings 2012-04-07 13:29:07 +02:00
Olivier Teulière
5ee10b7c91 Fixed a bug introduced in d32f3fdf 2012-04-07 13:28:04 +02:00
Olivier Teulière
d6a2fc6e4e PublicGame: more direct access to the game current rack 2012-03-26 07:49:25 +02:00
Olivier Teulière
e017e73cd9 Handle penalties in the core 2012-03-26 07:49:25 +02:00
Olivier Teulière
84e46bef85 Handle warnings and solos in the core 2012-03-26 07:49:25 +02:00
Olivier Teulière
7de3374fae Code factorization 2012-03-26 07:49:25 +02:00
Olivier Teulière
3d724166b6 Allow inserting and dropping a single command in the history. 2012-03-26 07:49:24 +02:00
Olivier Teulière
c37107ed87 Write more information in a saved game: dictionary info and move points 2012-03-22 08:46:21 +01:00
Olivier Teulière
b1e7381b39 Players can now have a table number 2012-03-19 22:49:58 +01:00
Olivier Teulière
f3b2442cc0 Arbitration: improved the refresh of search results 2012-03-17 23:53:40 +01:00
Olivier Teulière
3a8ac20a0a Arbitration: allow ending the turn even if some players have no assigned move 2012-03-17 23:53:31 +01:00
Olivier Teulière
bfab57f6ac Changed the way to re-assign a player move.
Re-assigning a move is not limited anymore to the last turn (only to the
current turn, and even that limitation could be removed without too much
work).
2012-03-14 20:40:23 +01:00
Olivier Teulière
435d3a2f42 New methods to replace a command in the current turn (even if it is not the last one) 2012-03-14 20:40:23 +01:00
Olivier Teulière
c9f61d7ac8 Search on the game rack, not on the player one 2012-03-11 16:59:16 +01:00
Olivier Teulière
0fa7bc91c6 Arbitration mode: allow editing the rack manually 2012-03-11 00:24:29 +01:00
Olivier Teulière
25a36ec9cd Arbitration mode: allow setting the rack randomly 2012-03-11 00:24:21 +01:00
Olivier Teulière
9c82c8f7bc Reset the master move before setting the racks, for a better behaviour at the end of the game 2012-03-11 00:23:39 +01:00
Olivier Teulière
cf6cec0527 Improved the findMatchingCmd() method 2012-03-10 18:06:41 +01:00
Olivier Teulière
9160e6bc99 New preference to save the search results limit in arbitration mode 2012-03-10 18:06:41 +01:00
Olivier Teulière
05a51101db New arbitration mode, dedicate to arbitration of duplicate games.
It is mostly working, but many things are still missing.
In particular:
 - ability to enter (or change) moves for a past turn
 - ability to change the rack (manually, or randomly)
 - ability to add/remove players during the game
 - support for solos, warnings, penalties
 - support for table number
 - more ergonomic interface
 - non regression tests
 - ... and probably bugs to fix
2012-03-10 18:06:41 +01:00
Olivier Teulière
f44048f31a New utility method to find a matching command 2012-03-06 08:56:03 +01:00
Olivier Teulière
d5c53b92d0 New Round::countJokersFromRack() utility method 2012-03-04 22:58:53 +01:00
Olivier Teulière
22fd6484f3 Correctly retrieve the game rack 2012-02-25 23:51:30 +01:00
Olivier Teulière
4077a25fa0 Use the GameMoveCmd command 2012-02-25 23:25:40 +01:00
Olivier Teulière
df806594ae New GameRackCmd class, not used yet 2012-02-25 23:17:04 +01:00
Olivier Teulière
f1c8bd587b Really fixed detection of the first turn (commit 43954a9 was wrong) 2012-02-25 23:17:04 +01:00
Olivier Teulière
43954a9fe5 Fixed detection of the first turn 2012-02-25 21:56:41 +01:00
Olivier Teulière
182263ce74 New UndoCmd class, not used yet 2012-02-21 08:22:33 +01:00
Olivier Teulière
b1ed3215d9 Rewrote the navigation system, to make it more powerful and easier to understand.
Internally, commands are now stored a bit differently: some commands
which were at the end of a turn (like the players rack in duplicate
mode) are now at the beginning. But from a user point of view, there is
no visible difference, except some details in training mode (and the new
behaviour is arguably better :)).
Only (known) problem: after loading a game saved before this commit,
navigating in the game history may be less nice (in particular, racks
may not be fully restored).
2012-02-21 08:22:33 +01:00
Olivier Teulière
e915e5f2cf New "auto-executable" flag for commands, not yet used 2012-02-21 08:22:33 +01:00
Olivier Teulière
de2d2777e2 The TurnCmd class does not inherit from Command anymore 2012-02-21 08:22:33 +01:00
Olivier Teulière
59fac223f4 Renamed some methods 2012-02-21 08:22:32 +01:00
Olivier Teulière
038910e5df Removed a few useless assignations and Tile copies 2012-02-21 08:22:32 +01:00
Olivier Teulière
66eec913c9 Added several assertions 2012-02-21 08:22:32 +01:00
Olivier Teulière
32957abfcc When playing a word, forbid using a joker to specify a letter on the board (even a joker).
This is just a convention, but a reasonable one :)
2012-02-21 08:22:32 +01:00
Olivier Teulière
6e2c665bdf Simplify the handling of jokers in the Round class.
This also fixes a very old (but minor) bug: when a word containing a
joker was played "manually" (i.e. not via a round generated by the
Results class but via the Game::checkPlayedWord() method), subsequent
search results using this joker on the board would display it as a
joker, not as a normal tile.
2012-02-21 08:22:32 +01:00
Olivier Teulière
b855c5f64e Simplify slightly the Round API 2012-02-21 08:22:32 +01:00
Olivier Teulière
0be2769dfa New utility methods to get the lowercase (joker) or uppercase (no joker) variant of a tile 2012-02-21 08:22:32 +01:00
Olivier Teulière
0d45fc6227 When showing a preview on the board, do not hijack the normal internal data 2012-02-21 08:22:32 +01:00
Olivier Teulière
0ae77a659e Cosmetics 2012-02-21 08:22:32 +01:00
Olivier Teulière
1336e3b65d Board: use the isVacant() method a bit more 2012-02-19 13:07:29 +01:00
Olivier Teulière
16a9a9b1a9 Removed Game::setTestTound() and Game::removeTestRound().
They are still available via the PublicGame class for interfaces.
2012-02-19 13:07:29 +01:00
Olivier Teulière
24d601543a Removed a useless include 2012-02-19 13:07:29 +01:00
Olivier Teulière
bf42c49850 Added loggers to most classes 2012-02-19 13:07:29 +01:00
Olivier Teulière
684880acbe Moved debug.h to dic/ 2012-02-19 13:07:29 +01:00
Olivier Teulière
5d98402891 Changed the prototype of PlayedRack::getRack() (and similar methods) 2012-01-26 21:10:41 +01:00
Olivier Teulière
e09f7f675e When all the moves are invalid for a turn, play the master move anyway 2012-01-17 23:49:09 +01:00
Olivier Teulière
13f4a3c346 Use the master move.
When no master move is defined, define a valid one using the best played
move (or the best playable move if all the played moves were invalid).
2012-01-17 23:35:16 +01:00
Olivier Teulière
1bc9c2f0f1 Implement (de)serialization of the MasterMoveCmd class 2012-01-17 23:15:05 +01:00
Olivier Teulière
744e90e6ca New command to define a master move. 2012-01-17 23:15:05 +01:00
Olivier Teulière
e327d4605d Always consider that the played move was played by the first player.
Knowing the actual player is not always possible, since potentially none
of the players has found the played move (for example in arbitration
mode). This ID is now only used to retrieve the rack from which the move
was formed, so any player ID will do.
The non-regression tests have been adapted accordingly.
2012-01-17 21:57:03 +01:00
Olivier Teulière
c81df46b5e Added a new type of move: NO_MOVE 2012-01-17 00:56:02 +01:00
Olivier Teulière
d32f3fdf81 Use assertions where appropriate 2012-01-17 00:56:02 +01:00
Olivier Teulière
482b5d674f Previewing a Round is now possible in all the game types.
It was only possible in Training mode. This change will be useful for
the future arbitration mdoe.
2012-01-17 00:43:19 +01:00
Olivier Teulière
90ce7e1111 Removed some useless code 2012-01-12 15:26:27 +01:00
Olivier Teulière
413d93c7cb Remove debug not meant to be committed. 2012-01-12 15:14:23 +01:00
Olivier Teulière
f2d25bc0d6 Include config.h before checking macro definitions 2012-01-05 20:43:57 +01:00
Olivier Teulière
9aea22d968 Use an enum for the variants 2011-08-28 19:25:26 +02:00
Olivier Teulière
56b66fea28 Added setters to GameParams, to simplify the code a little 2011-08-28 19:25:26 +02:00
Olivier Teulière
befe577fe7 Got rid of Game::getModeAsString() 2011-08-28 19:25:26 +02:00
Olivier Teulière
17bdd27899 Moved the dictionary to the GameParams class 2011-08-28 19:25:26 +02:00
Olivier Teulière
408c92df42 Moved the game mode to the GameParams class 2011-08-28 19:25:26 +02:00
Olivier Teulière
3d48facb55 Cosmetics 2011-08-28 19:25:26 +02:00
Olivier Teulière
d6fbd6bef1 Allow combining several variants in a single game 2011-08-28 18:47:25 +02:00
Olivier Teulière
38f3a456bb Handle the "7 among 8" variant in a few more places 2011-08-28 15:52:12 +02:00
Olivier Teulière
fd0bf204cc Fixed the variable used in board* 2011-08-27 21:55:49 +02:00
Olivier Teulière
fdc29871e5 New GameParams class to wrap a few game characteristics.
These characteristics will not change during the game.
2011-08-27 21:55:49 +02:00
Olivier Teulière
3b4750d3bf Round: the m_bonus field should be of type bool, not int. 2011-08-27 21:55:49 +02:00
Olivier Teulière
cfa88072a3 Replace the use of convertToMb() and convertToWc() with macros 2011-07-30 19:48:05 +00:00
Olivier Teulière
9e71372c42 Simplified the readFromUTF8() prototype 2011-07-30 19:46:47 +00:00
Olivier Teulière
424fd3af32 Display the points of the word entered by the player before validating it. 2011-07-16 23:31:17 +00:00
Olivier Teulière
23771f3f71 Indicate the end of the game 2011-01-30 00:23:45 +00:00
Olivier Teulière
7bb432b954 Removed a useless include 2011-01-29 23:50:14 +00:00
Olivier Teulière
0c76b9d781 Simplified the looging macros, and added logs in various key places. 2011-01-29 23:47:20 +00:00
Olivier Teulière
e175a6d8bc Added a new (optional) dependency on log4cxx, to enable logging.
If disabled (the default), everything is compiled away.
2011-01-16 21:30:30 +00:00
Olivier Teulière
c3785555b9 Print to stderr the complete stack trace in case of exception or segmentation fault.
This feature will only be activated in debug mode, and if available on the platform.
The symbols will even be demangled if possible (i.e. if compiled with g++).
2010-10-17 21:23:39 +00:00
Olivier Teulière
b7fff8b4a1 - Removed various C-style casts
- Factorized code in the Bag class
2010-03-06 16:54:20 +00:00
Olivier Teulière
5642bfa191 Fixed loading of games, for languages with multichar letters like Catalan 2010-03-06 16:53:37 +00:00
Olivier Teulière
7dcd9898ed Fixed a bug in PercentResults: AI players with a level lower than 100 could still play as if they were (almost) at level 100! 2010-02-20 13:31:12 +00:00
Olivier Teulière
65ae7075fd Make the destructor of the parent class virtual, since the class has virtual methods 2010-01-28 22:24:11 +00:00
Olivier Teulière
1756185f08 Compilation fix, when libconfig++ is missing 2010-01-28 22:23:47 +00:00
Olivier Teulière
2eb28d61c5 Use expat instead of libxml2: it is much smaller, and is easier to use with Arabica when cross-compiling for Windows 2009-12-06 00:07:35 +00:00
Olivier Teulière
3c7a84d543 Support saving/loading games (any game type) in XML format.
Status:
It works well, but there are still a few details to improve/fix

More details about the changes:
 - New dependency on Arabica and Libxml2 to parse the XML
 - Loading the old format is still supported for this release, but won't be supported anymore in the next one
 - Games are now only saved in the new format
 - In training mode, the player is now created externally, like in the other modes
 - Avoid using GameIO (the one from game/) whenever possible
 - Do not use a FILE* argument anymore when loading a game
 - Throw and catch exceptions correctly when a game cannot be loaded or saved
 - The non-regression tests now use a new method to print the game history
2009-11-29 16:01:31 +00:00
Olivier Teulière
bb13f634b3 Sort the training results using the dictionary order as alphabetical order 2009-07-03 23:00:12 +00:00
Olivier Teulière
02e4cb2970 - Invalid moves should be in the display form
- Moved some code from Header to Dictionary
2009-07-03 21:40:14 +00:00
Olivier Teulière
4fda3fed5e Support display and input strings in the dictionary header 2009-06-28 10:55:24 +00:00
Olivier Teulière
3a82ab75fd More uses of the display characters 2009-06-23 13:21:19 +00:00
Olivier Teulière
47e4b8c6b0 Simplifications 2009-06-23 12:56:40 +00:00
Olivier Teulière
7569a58bb7 Each letter (tile) now has a display string, defaulting to its internal char. It is not yet possible to change it.
This display string is used in the ncurses and Qt interfaces.

Display strings are types "wdstring" instead of plain "wstring" in a few places (not all of them) to help recognize them.
2009-06-23 12:41:53 +00:00
Olivier Teulière
7f1c0def1a - Do not allow vertical words for the first turn in duplicate mode
- Adapted unit tests
2009-03-18 18:54:41 +00:00
Olivier Teulière
3bde966efb Fixed a compilation warning (potential buffer overflow) 2009-03-18 18:53:57 +00:00
Olivier Teulière
6f14e34fe7 Allow the first word to be vertical 2009-03-12 18:56:25 +00:00
Olivier Teulière
6f9a343677 - Fixed the previous fix for joker games, for real this time
- Added tests for joker and explosive games in all modes
2009-02-21 16:56:32 +00:00
Olivier Teulière
903905c7bc Fixed a regression: joker games were not working correctly in version 1.8.
Thanks to Marcel Jolly for spotting this
2009-02-19 18:26:11 +00:00
Olivier Teulière
ed2a20a3e3 - Allow setting the coordinates of the played word by clicking on the board
- New PlayWordMediator class, to encapsulate the behaviour of the controls
   used to play a word
 - The Training mode now has input fields to play words directly, without
   choosing them in the search results
2009-02-19 18:25:17 +00:00
Olivier Teulière
a8b842a1a7 - Added missing files in the build system
- One more update of the French translation
2009-01-24 23:02:42 +00:00
Olivier Teulière
1df3c3ff51 Updated a few copyright dates 2009-01-24 17:44:56 +00:00
Olivier Teulière
4ffaef3e1d - Throw exceptions in case of problem in Duplicate::setPlayer()
- Clean up of the text interface:
    - removed all uses of wcstok()
    - factorized common code
    - made code a bit more robust
2009-01-24 17:11:07 +00:00
Olivier Teulière
7a5056354a - Setting the rack manually is now done via a command, and can thus be undone
- Added non-regression tests for the navigation in the game history (all modes), and removed a less useful test
2009-01-24 10:28:20 +00:00
Olivier Teulière
87e1d4795b Sorting the search results happens to be quite slow, often much slower than the search itself.
But we don't need to sort them all the time, and in general we don't even need to keep all the rounds.

This commit greatly improves the search performance by filtering the results in 3 different ways, depending on the context:
 - A limit to the number of results can be given (useful for the training mode). The kept results are the best ones, not the first ones found by the search.
 - When only the best round is needed (when the AI is playing with level 100, or when preparing the rack for an explosive game), we don't need to keep rounds with a lower score
 - When the AI has a level lower than 100, it is still possible to skip many rounds

The search limit in training mode is configurable (defaulting to 100) and can be deactivated.
2009-01-22 18:30:22 +00:00
Olivier Teulière
771ba0c35e New BoardSearch class to avoid carrying const parameters all over the place.
No functional change.
2009-01-17 14:57:32 +00:00
Olivier Teulière
8b9478542a - The core is now able to handle "explosive games" ("parties détonantes"). No interface uses this ability yet.
- Fixed a bug in Game::helperSetRackRandom()
2009-01-14 21:53:37 +00:00
Olivier Teulière
229f1fcc14 - Removed the RACK_MANUAL enum value, and the obsolete Training::setRack() method
- qt/board_widget.cpp: cosmetics
2009-01-11 14:20:35 +00:00
Olivier Teulière
5b1e228fb5 New command to handle the player points, useful to handle the end of a free game 2008-11-30 21:10:25 +00:00
Olivier Teulière
687a31bee8 The AI passes instead of changing letters when it has nothing to play 2008-11-30 21:09:37 +00:00
Olivier Teulière
81b44a8050 - When displaying an old turn, do not allow playing
- Turns start at 0 instead of 1, to indicate that nothing was played on the first turn
2008-11-30 21:08:29 +00:00
Olivier Teulière
06dd7dff71 Removed Game::back() 2008-11-30 21:07:19 +00:00
Olivier Teulière
67306bec3e Added auto-execution of commands when clearing future commands.
The goal is to automatically replay commands involving AI, so that the user cannot be 'blocked'.
2008-11-30 20:55:45 +00:00
Olivier Teulière
f6d7804847 - New PublicGame class, intended to be used by the interfaces instead of accessing Game directly
- Migrated the text, Qt and ncurses interfaces to the new PublicGame API.
2008-11-30 20:53:44 +00:00
Olivier Teulière
d4f4646b4f Get rid of Duplicate::prevHumanPlayer() and Duplicate::nextHumanPlayer() + cosmetics 2008-11-30 20:51:42 +00:00
Olivier Teulière
a79b71f028 When navigating in the history, display the current turn in the status bar 2008-11-30 20:51:05 +00:00
Olivier Teulière
c430d712b8 Improved debugging 2008-11-23 20:13:02 +00:00
Olivier Teulière
13f2e8daad - Really fixed duplicate games when noone plays a valid move
- Added a unit test to ensure it
 - Fixed Game::back() (this fixes some unit tests broken by a previous commit)
 - Added a unit test for a duplicate game with only one player
2008-11-23 18:18:02 +00:00
Olivier Teulière
fa225881c0 Do not allow navigating before the first turn, and do not count an empty turn as a real one when navigating.
The navigation in the history is now more natural.
2008-11-23 17:08:12 +00:00
Olivier Teulière
8e7c61e2d8 New command to handle changes of the current player. This fixes history navigation in free game mode 2008-11-23 17:07:42 +00:00
Olivier Teulière
e8cd922186 New Duplicate::MarkPlayedCmd command to change the "hasPlayed" status of a player, in duplicate mode 2008-11-23 17:06:44 +00:00
Olivier Teulière
9dc84ed963 - Duplicate: end turns after defining the new rack, not before
- FreeGame: create an additional turn after defining the initial rack
2008-11-23 17:05:13 +00:00
Olivier Teulière
b5c63ea6e3 Removed the useless return value of Game::start() 2008-11-23 17:04:40 +00:00
Olivier Teulière
40d25bd63a Handle the case when all players play an invalid move 2008-11-23 17:03:29 +00:00
Olivier Teulière
53cccd529e Added toString() methods to the commands to ease debugging 2008-11-23 17:02:33 +00:00
Olivier Teulière
7fa8c2b58f Removed experimental support of the real bag. It was not a good idea after all... 2008-11-23 16:58:31 +00:00
Olivier Teulière
675b534e77 - Fixed compilation in debug mode
- Centralized navigation in the game history in the Navigation class
 - The Qt interface now has (very) basic controls to navigate in the history.
2008-11-23 16:55:28 +00:00
Olivier Teulière
bce4ce4604 - The main game modifications (playing a move, setting a new rack, ...) are now done using the Command design pattern, which alows undoing these changes easily.
- Added support for navigation in the game history to the text interface (not unit-tested yet)
2008-11-23 08:18:03 +00:00
Olivier Teulière
4b766d2622 - Bumped version to 1.8-cvs
- Improved the error message when the dictionary cannot be loaded at startup
 - Updated the french translation
 - Made some Game fields private
 - Added more constness
2008-11-22 14:40:25 +00:00
Olivier Teulière
70be50c64e A lot of clean-up:
- Removed logiv from the History class
 - Used BOOST_FOREACH to simplify loops
 - Remove useless annotations and doxygen blocks
 - Added some constness
 - Marked Training::setRack() as deprecated
 - Improved compilation order in game/
2008-11-22 13:09:28 +00:00
Olivier Teulière
e3ef487ebb Sort the search result in a predictible way. The unit tests have been adapted accordingly. 2008-10-16 17:51:16 +00:00