Commit graph

44 commits

Author SHA1 Message Date
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
Olivier Teulière
21c07afee4 Removed useless files 2006-11-05 17:24:32 +00:00
Olivier Teulière
9949225b8b Fixed a nasty bug, due to the way jokers are handled 2006-11-05 17:04:39 +00:00
Antoine Fraboulet
f0949a59de - adding some tests : training_joker2 still fails, no clue where it comes from
search should find much more results - regression from 1.4
2006-11-05 13:34:27 +00:00
Antoine Fraboulet
a97b91dfe6 - add new regression test for a bug on loading previously saved games 2006-08-11 22:04:45 +00:00
Antoine Fraboulet
f6fa78c32c - driver
add "training_cross" test that checks horizontal scores in board_cross.cpp
    add several load/save tests
    add regexp test

  - Corrections
       training_search.ref : correcting reference file - 5 points instead of 4 on (Eh, En, Es, Ex)
       training_back.ref : sorting order (linked to points bug - insertion order in list)
       duplicate_2_ai.ref : correct score, change the whole game
       freegame_passing.ref : correct score (JEUNE H11 +2 : 45 -> 47)
       freegame_3_ai.ref : correct score 13:CAPEYE+4, 14:VOLETE+3, 16:FULL+2, 17:VIDE+5
2006-01-01 19:25:10 +00:00
Antoine Fraboulet
644653be0a - add regression test for Game::load - this test currently fails with a segfault 2005-12-27 09:13:48 +00:00
Antoine Fraboulet
e9dca4ea65 - adding regression test for Game::back() method 2005-12-27 01:04:49 +00:00
Olivier Teulière
f060497e47 Unlike libreadline 4, libreadline 5 echoes the input given with < input_file.
The regression scenarios are now adapted to the behaviour of libreadline 5.
2005-12-24 17:50:11 +00:00
Olivier Teulière
b4e66f273e Use the readline library in the text interface. In particular, it provides
a history of commands
2005-04-27 17:55:32 +00:00
Olivier Teulière
25304bd978 test/*: Added non-regression tests, based on the text interface.
'regression.pl' is the script that runs the regression, and 'drivers' contains
the list of scenario files to be played.
By default, the complete regerssion is played, but you can play specific
scenarios by adding them to the command-line.
Example: ./regression.pl training_bag freegame_change
2005-04-16 15:47:59 +00:00