Commit graph

60 commits

Author SHA1 Message Date
Olivier Teulière
7f60f532ad FreeGame: fix an infinite game when all the players keep passing forever.
Now the game ends when all the players passed in the last 3 turns.
2015-02-24 23:28:31 +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
27c9b5015a Tests: remove the useless "Player" column in the game history 2013-01-16 14:27:08 +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
65ed44d66d Cosmetics 2012-10-06 17:49:35 +02:00
Olivier Teulière
2ab95b5ed9 Get rid of old CVS files 2012-10-06 01:44:33 +02:00
Olivier Teulière
88b6e09ffb Tests: move test cases to sub-directories 2012-10-06 01:41:59 +02:00
Olivier Teulière
1f9f42f17a Tests: comment commands failing due to the rand seeds problem.
The tests are valid, but after loading a game the random number
generator is broken. This commit hides the problem, but at least we
can see "real" failures more easily.
2012-10-05 20:37:57 +02:00
Olivier Teulière
5ae43b176a Tests: ignore comments during file comparison 2012-10-05 20:37:57 +02:00
Olivier Teulière
0e29e0a75f Force a setting in the unit test, to avoid failures depending on the environment 2012-05-13 09:41:20 +02:00
Antoine VINCENT
4e09a34c5a Flexible pathes configuration. Cosmetics. 2012-05-12 16:58:01 +02:00
Olivier Teulière
6391dd34e1 Added non-regression tests for saved games, in all modes 2012-04-28 15:34:37 +02:00
Olivier Teulière
fd1773ef6e Text interface: correctly check the return value when passing 2012-04-11 20:02:18 +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
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
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
b6b4958351 Be a bit more explicit if the text interface is not found 2012-01-26 21:15:58 +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
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
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
306d1e10bf Added tests for the "7 among 8" mode 2011-08-28 15:29:11 +02:00
Olivier Teulière
336a5a6111 eliottxt.cpp is now encoded in UTF-8 2011-08-28 15:06:15 +02: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
795c44827d Center correctly multi-chars letters in the text interface 2009-06-23 21:36:33 +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
6f82e8753a Do not save debug messages in the non-regression scenarii 2009-06-23 12:35:22 +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
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
7fc8309868 - Text interface: removed uses of the 'n' command with a negative argument 2009-01-24 17:43:57 +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
d0294b5a38 - Echo the input in the text interface when libreadline is not present, so that the non-regression tests can still pass in this case.
- Changed a bad file format in a test, and adapted the reference accordingly
2009-01-15 20:55:57 +00:00
Olivier Teulière
f3b4930dbe New test for a duplicate game where the only valid move in one turn scores 0 point 2008-11-23 18:56:49 +00:00
Olivier Teulière
1f99311d51 - Allow changing a setting from the text interface
- Force a setting in one unit test to be sure of the test outcome
2008-11-23 18:18:59 +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
9e330cf83b In the text interface, display the seed used for the random number generator 2008-11-23 08:33:16 +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
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
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
a32f1b7aaf Dic:
- regexp search results are now in uppercase, like other results
 - the regexp search indicates if there are more results than the maximum
   allowed
Qt interface:
 - new window with some dictionary tools: check word, word+1 and regexp search
2008-08-27 21:20:03 +00:00
Olivier Teulière
11adaba410 - Added several tests for the regular expressions engine
- New regexp parser using Boost.Spirit. Lex and yacc are now gone.
   The main advantage of this new parser, apart from being purely C++,
   is that it can handle wide characters.
   Currently, the new parser does the same as the previous one, but the
   code is not yet ready to use regular expressions with non-ASCII
   dictionaries.
2008-07-07 17:29:59 +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
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
8c3708fa99 - Removed Game::setRackRandomOld() (replaced by Game::setRackRandom())
- Adapted regression scenarii
2008-01-15 14:56:38 +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
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