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).
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.
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.
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.
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
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.
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
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.