Commit graph

78 commits

Author SHA1 Message Date
Olivier Teulière
cdbb53f72c Gray out the players area when the game is finished.
This was broken since 196e02f9ad.
2013-01-29 22:58:00 +01:00
Olivier Teulière
30385abe30 Results: new MasterResults implementation, using the MoveSelector class.
This avoids calling MoveSelector everywhere in the code.
2013-01-19 00:36:07 +01:00
Olivier Teulière
664eec36ed New MoveSelector class, to help find the "best" move to play.
The best move has the highest possible score, but it is also the one
leading to the most interesting game. This is a subjective notion, but
some heuristics can help, such as:
 - a move sparing a blank is better than one using it
 - a move with many prefixes and suffixes is better than one without
   extensions
 - a move "opening" the game is better than one blocking it
 - a move leaving a nice rack is better than one leaving "bad" letters

At the moment, only the first heuristic is implemented.
2013-01-16 19:00:01 +01:00
Olivier Teulière
cdcb5c25b7 TurnData: remove the m_playerId member 2013-01-16 14:40:34 +01:00
Olivier Teulière
1e0de63ef8 Results: add a isEmpty() method, and use it where possible 2013-01-16 11:15:12 +01:00
Olivier Teulière
89b5f757ca Topping: do not assign an empty move to the player immediately.
It is now done only after a timeout, to avoid the need to replace
this empty move when the player finds a top move.
2013-01-15 11:43:30 +01:00
Olivier Teulière
76fefdf71d New "master game" feature.
When a master game is defined, the racks and moves played from the
current game will be the same as in the master game. This can be
practical to replay a game in a different mode, or to replay at home a
duplicate game played in a club, for example.
2012-12-30 16:38:07 +01:00
Olivier Teulière
c138947138 Move Duplicate::setGameAndPlayersRack() to Game 2012-12-29 17:49:25 +01:00
Olivier Teulière
8acebbc889 Game::checkPlayedWord() now takes a Move instead of a Round 2012-12-29 17:46:18 +01:00
Olivier Teulière
19a93988ad Arbitration: new option to handle solos automatically.
The option is not yet accessible from the interface.
2012-12-05 23:56:20 +01:00
Olivier Teulière
4d38c99336 Move Arbitration::getPlayerEventCmd() into Duplicate 2012-12-05 22:05:31 +01:00
Olivier Teulière
e34cc25fe1 Move commands to the game/cmd/ sub-directory.
The abstract Command class (from which all the others inherit)
is still game/, to hide the cmd/ subdir from most clients.
2012-12-05 20:26:47 +01:00
Olivier Teulière
08c3f2ccb2 Arbitration: when loading a saved game, make PlayerMoveCmd auto-executable.
This is not very clean, but without this the played moves of past turns
are not visible. This commit also fixes a test with was incorrect.
2012-10-24 11:11:24 +02:00
Olivier Teulière
4200e33c17 Change the copyright years for all the files modified in 2012 2012-10-11 13:45:24 +02:00
Olivier Teulière
cfa90e6394 Rename TurnCmd into Turn (step 1) 2012-10-06 17:49:35 +02:00
Olivier Teulière
a800863c1f Arbitration: do not handle solos automatically.
The arbitrator has to specify them manually. Otherwise, we cannot know
when a turn is complete and thus we cannot determine if solos can/should
be applied.
2012-10-05 12:52:42 +02:00
Olivier Teulière
bcc2aedbff Improve the detection of finished games for duplicate and arbitration modes 2012-10-05 01:42:46 +02:00
Olivier Teulière
58c88a3078 Let the PlayerMoveCmd decide whether it is human independent.
It fixes problems when trying to replay turns on a loaded game.
2012-10-05 00:27:47 +02:00
Olivier Teulière
74d4572a0a Arbitration: fix the "Replay turn" feature for games with only AI players 2012-10-05 00:27:34 +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
c4fad05ffd Arbitration: new option to deactivate the automatic random rack 2012-04-28 15:34:37 +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
84e46bef85 Handle warnings and solos in the core 2012-03-26 07:49:25 +02: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
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
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
4077a25fa0 Use the GameMoveCmd command 2012-02-25 23:25:40 +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
59fac223f4 Renamed some methods 2012-02-21 08:22:32 +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
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
17bdd27899 Moved the dictionary to the GameParams class 2011-08-28 19:25:26 +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
cfa88072a3 Replace the use of convertToMb() and convertToWc() with macros 2011-07-30 19:48:05 +00:00
Olivier Teulière
23771f3f71 Indicate the end of the game 2011-01-30 00:23:45 +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
b7fff8b4a1 - Removed various C-style casts
- Factorized code in the Bag class
2010-03-06 16:54:20 +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
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
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
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