Commit graph

98 commits

Author SHA1 Message Date
Olivier Teulière
10f5e98747 Check the played word against the game rack, not against the current player rack.
This is the same in most cases, except for arbitration games where
current player may already have an assigned move.

This change notably fixes a bug when using the "Check word" button in
arbitration mode: if the current player already had an assigned move,
the checked move would often be considered invalid (wrongly).
2016-02-07 09:48:56 +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
33214c62b2 Rack: add a contains() convenience method 2013-01-17 17:59:33 +01:00
Olivier Teulière
b493b3b365 Rack: rename a method 2013-01-17 17:59:33 +01:00
Olivier Teulière
a13f7d2968 Bag: add a contains() convenience method 2013-01-17 17:59:28 +01:00
Olivier Teulière
c1c3f3b48b Bag: rename a method 2013-01-17 17:14:38 +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
4e533eed27 Fix a small bug in explosive games.
Before this commit, if the top move did not need the blank tile, the
blank tile stayed in the rack. It is now replaced with another (randomly
selected) tile.
2013-01-16 18:04:57 +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
4111afc04c RackWidget: after a drag & drop, notify the game that the rack has changed.
This allows synchronizing all the controls displaying the player rack
(visual and textual ones).
2013-01-09 18:56:25 +01:00
Olivier Teulière
7a6ca367fb Game: remove a TODO 2013-01-09 18:52:11 +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
681a7b28cb New topping mode (very beginning) 2012-12-29 17:51:16 +01:00
Olivier Teulière
c138947138 Move Duplicate::setGameAndPlayersRack() to Game 2012-12-29 17:49:25 +01:00
Olivier Teulière
fb8e464d7c Display the word being played on the board 2012-12-29 17:46:18 +01:00
Olivier Teulière
2c3cb83e0a Allow more types of invalid input when previewing a move being played 2012-12-29 17:46:18 +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
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
fa345a9f7b Rename Turn into TurnData (step 1) 2012-10-06 17:49:35 +02:00
Olivier Teulière
47a827e9d4 Remove useless code 2012-10-06 17:49:35 +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
f1123e1229 Fix a very rare bug in rack generation 2012-10-05 01:25:01 +02:00
Olivier Teulière
937138c21d Split the helperSetRackRandom() method.
There is now one method to check whether the rack can be drawn, and
another one (still called helperSetRackRandom()) to do all the work.
2012-10-05 01:24:56 +02:00
Olivier Teulière
b1e7381b39 Players can now have a table number 2012-03-19 22:49:58 +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
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
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
5d98402891 Changed the prototype of PlayedRack::getRack() (and similar methods) 2012-01-26 21:10:41 +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
9aea22d968 Use an enum for the variants 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
d6fbd6bef1 Allow combining several variants in a single game 2011-08-28 18:47:25 +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
0c76b9d781 Simplified the looging macros, and added logs in various key places. 2011-01-29 23:47: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
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
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
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
06dd7dff71 Removed Game::back() 2008-11-30 21:07:19 +00:00
Olivier Teulière
d4f4646b4f Get rid of Duplicate::prevHumanPlayer() and Duplicate::nextHumanPlayer() + cosmetics 2008-11-30 20:51:42 +00:00