Commit graph

148 commits

Author SHA1 Message Date
Olivier Teulière
01297ebdb4 Sort the word list before processing it. It allows a much better compression, and avoid problems when a word is a prefix of the word just before.
Also, the word list is not a raw buffer anymore, which makes it a bit easier to understand the algorithm.
2010-05-16 10:06:01 +00:00
Olivier Teulière
9d5c9fe1d0 The dictionary creation is now encapsulated into a dedicated class, to allow reusing it easily 2010-05-15 12:14:53 +00:00
Olivier Teulière
cd78568af4 Fixed BOM handling 2010-04-20 20:49:58 +00:00
Olivier Teulière
3093d0fd7c Fixed an encoding bug on Windows, when trying to convert empty strings 2010-01-29 21:46:13 +00:00
Olivier Teulière
2a1932437c Fixed potential read of invalid memory 2010-01-04 21:57:27 +00:00
Olivier Teulière
d1a1254dbe Made an error message clearer 2010-01-04 21:00:33 +00:00
Olivier Teulière
2404d359ca - Refuse to build a dictionary with a non-alphabetical character (except '?')
- Marked many strings for translation, and improved their formatting
2010-01-02 12:44:56 +00:00
Olivier Teulière
9b52668612 - Allow dictionaries without jokers
- The listdic binary now accepts non-alphabetical characters.
   But playing with such a dictionary is still impossible.
2010-01-01 18:01:35 +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
d0a7ce6947 Fixed an encoding problem on Windows: do not assume input is UTF-8.
This fixes a crash when typing a character like 'é' in an input field.
2009-10-23 20:01:49 +00:00
Olivier Teulière
79b6c0b53c Fixed a crash on Windows, when trying to convert an empty string 2009-10-14 19:36:37 +00:00
Olivier Teulière
43d42a0388 Little hack to have the 7+1 search in alphabetical order (or more precisely, in the order of the letters as defined at dictionary creation) 2009-09-21 20:10:34 +00:00
Olivier Teulière
08c9816d32 Tiny optimization of the compressed dictionary 2009-07-03 21:51:08 +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
8485e317b5 - Improved some strings
- Update of the French translation
 - Fixed make distcheck (compdic.cpp contains non-ascii chars)
2009-06-28 12:11:10 +00:00
Olivier Teulière
e42bc55965 Display the alternative inputs in the dictionary information tab 2009-06-28 11:47:50 +00:00
Olivier Teulière
4fda3fed5e Support display and input strings in the dictionary header 2009-06-28 10:55:24 +00:00
Olivier Teulière
0e9711da25 Accept various inputs for the same tile in the Qt interface.
The dictionary format still needs to support that.
2009-06-27 18:09:44 +00:00
Olivier Teulière
da85bde477 First step in accepting various input strings for the same tile: input coming from the text interface is now passed through a conversion method (... which does nothing yet!) 2009-06-23 21:39:07 +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
fc04b0604b Little refactoring 2009-06-23 15:36:28 +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
9b8526b451 Improved error messages 2009-06-21 12:32:25 +00:00
Olivier Teulière
1b585e8a49 Simplified code a little 2009-06-13 21:44:05 +00:00
Olivier Teulière
3d525af762 Got rid of the custom HashTable class: Boost.Unordered provides a better one for free... 2009-05-01 09:04:47 +00:00
Olivier Teulière
b4140b3fea - Fixed some warnings on Windows build
- Open the dictionary in binary mode. This fixes a bug in the Windows version of compdic
2009-02-28 09:23:07 +00:00
Olivier Teulière
66538b4806 Removed support for the old dictionary format. The code becomes simpler and (very slightly) faster. 2008-11-22 13:11:48 +00:00
Olivier Teulière
70be50c64e A lot of clean-up:
- Removed logiv from the History class
 - Used BOOST_FOREACH to simplify loops
 - Remove useless annotations and doxygen blocks
 - Added some constness
 - Marked Training::setRack() as deprecated
 - Improved compilation order in game/
2008-11-22 13:09:28 +00:00
Olivier Teulière
003b403422 - dic_search.cpp: Do not add twice the same word in a 7+1 search (this can happen when using jokers)
- dic_tools_widget.cpp: Allow up to 2 jokers in the 7+1 search
2008-10-30 19:03:07 +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
37359e97c0 - Renamed the binaries: eliot is now the Qt interface, whereas wxeliot is the wxWidgets interface
- Embed the program icon into the executable on Windows: the icon is not visible in Windows explorer
 - Fixed gettext configuration on Windows. The translations now appear, but the accents still don't display correctly.
 - Fixed a few translation issues
2008-09-07 13:17:39 +00:00
Olivier Teulière
990f4c5212 Qt interface:
- Initialize the random numbers generator, and print the seed value
 - Handle properly Qt builds without STL support
 - Save the position of the main window
 - Got rid of the useless toolbar
 - Better size of the preferences dialog
 - Hopefully fixed translation issues on Windows
 - The Settings class throws an exception when asked for a non-existing setting
2008-09-05 21:31:30 +00:00
Olivier Teulière
f5bde7fb4e - Compilation fix for Windows
- Display the Eliot icon
 - Improved printing
 - Allow changing the level of computer players
 - Generate automatically a default name for players
 - Translate Qt's own strings (only works on Linux at the moment)
2008-09-03 17:28:27 +00:00
Olivier Teulière
75a67b28a5 Dic:
- Throw an exception if a regular expresison is invalid
 - Handle the exception in callers code

Game:
 - Fixed a bug in setRackRandom()

Qt interface:
 - Display the dictionary name in the status bar
 - Implemented printing
 - Translation of the interface into French. The menus have temporarily lost their accelerator keys in English.
2008-08-31 11:48:11 +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
468951ca0f Cosmetic change 2008-07-28 20:24:06 +00:00
Olivier Teulière
cad582d912 Fixed a off-by-one error. 2008-07-28 18:37:09 +00:00
Olivier Teulière
2b161abd2c Added consts, renamed a class, and simplified the code using vectors 2008-07-27 15:28:50 +00:00
Olivier Teulière
90badeca21 - Fixed a bug in the parser, preventing to parse correctly some regular expressions with wide chars. The regular expressions seem now to work fine with a dictionary using polish words.
- More C++ in the automaton code
 - Simplified the code in several places
2008-07-27 13:32:47 +00:00
Olivier Teulière
7ea51d2f23 Compilation fixes for some systems (missing headers) 2008-07-20 12:15:51 +00:00
Olivier Teulière
0bfcad6d58 Various little fixes to the regexp engine to support wide characters.
It now works fine on any dictionary using non-ASCII characters!
2008-07-13 07:55:47 +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
414baa8d7a - Use vectors instead of lists to store the results of dictionary searches
- New parameter to most search functions, allowing to limit the number of results.
   No interface uses it yet.
2008-03-02 18:45:10 +00:00
Olivier Teulière
099d531177 Indicate that the input of compdic should be sorted and without duplicate entries 2008-02-24 11:30:56 +00:00
Olivier Teulière
f19bc036f8 - Handle the BOM properly if it is present
- Ignore empty lines even if the file format is not the native one
2008-02-22 20:30:01 +00:00
Olivier Teulière
7d81fc5420 Fixed the crossword search (the new dictionary is more sensitive).
Anyway, this search is useless since the same can be done with a regexp...
2008-01-19 21:34:58 +00:00
Antoine Fraboulet
6c831c5534 - add compile-time dependences to compile erl.lpp and erl.ypp from a CVS checkout 2008-01-13 20:26:04 +00:00
Olivier Teulière
572b31c64e - dic/encoding.cpp: simplification (this also removes a warning)
- game/rack.*: added a missing const
 - game/game_io.cpp: fixed a compilation warning
2008-01-11 10:09:26 +00:00
Olivier Teulière
81e980104f - Board::GetLetterMultiplier() and Board::GetWordMultiplier() are now static
- Added 2 convenient getters: Dictionary::getName() and Bag::getDic()
2008-01-09 10:48:19 +00:00
Olivier Teulière
ba230eda60 - Bumped version number to 1.6
- Used the -Wall option of automake, and fixed the reported warnings
 - Updated french translation
2008-01-08 16:09:08 +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
Antoine Fraboulet
d86bd2af4a - 32/64 bits types
- unused function parameters
2007-08-04 20:01:27 +00:00
Antoine Fraboulet
33e5b23004 - automake 1.10 (ylwrap) naming system modification 2007-08-04 19:57:45 +00:00
Olivier Teulière
5a10ec911a Fixed my previous commit 2006-10-14 10:19:12 +00:00
Olivier Teulière
ae67aa71ee Do not perform any dictionary search on a zero-length intput. This was the case due to the Refresh methods in the wxWidgets interface, during a search.
What's more, since wxWidgets is very slow to handle the list of results (benjamins in particular), a search done with the search windows open seems more responsive.
2006-10-14 09:46:15 +00:00
Olivier Teulière
0683b6a516 Fixed more memory leaks of the same kind 2006-10-08 18:24:17 +00:00
Olivier Teulière
749db006f6 Fixed a memory leak 2006-10-08 18:12:17 +00:00
Olivier Teulière
ba11fc3be6 Removed another useless include 2006-09-30 22:19:17 +00:00
Olivier Teulière
8519a4d794 Removed useless includes 2006-09-30 22:11:56 +00:00
Antoine Fraboulet
86c65ebc4a - add load dictionnary functions for bigendian arch
regression test is ok on linux/ppc
2006-04-16 11:27:19 +00:00
Olivier Teulière
77be2e9219 Backport of the 'multibyte' branch on HEAD. 2006-01-22 12:23:52 +00:00
Antoine Fraboulet
c44a16dc13 - small typo fix in comments
- add doxygen file description
  - revert Dic_chr / board_search patch
    returning the character instead of the code
    was a HUGE performance penalty
    The dictionary must use codes, the board must be
    made to use codes instead of dic using tiles.
  - add Dic_char and Dic_char_lookup as temporary
    fixes for board_search. Should modify Board and Cross class
    instead.
  - create dic_code_t type
2006-01-01 19:51:00 +00:00
Olivier Teulière
96fe9f22b1 Dic_chr returns the actual char, not a code between 0 and 31.
Dic_lookup takes a string containing real chars, not codes.
The idea is to hide the internal representation of the characters from the
users of the dictionary, who don't care about it.
2005-12-24 18:42:44 +00:00
Olivier Teulière
a9e51998f8 Fixed a segfault 2005-12-24 16:49:26 +00:00
Olivier Teulière
b54b760677 Backported modifications in dic/ 2005-11-05 17:56:22 +00:00
Olivier Teulière
fe13a5e627 Removed the $Id:$ lines on HEAD 2005-11-04 20:00:05 +00:00
Olivier Teulière
e3bc46b114 Updated licence text with FSF's new address. 2005-10-23 14:53:42 +00:00
Antoine Fraboulet
d0418c3e8d commit to tag v1.5 2005-05-28 20:59:14 +00:00
Antoine Fraboulet
699f5fa205 fixed a typo for doxygen 2005-05-06 07:39:58 +00:00
Antoine Fraboulet
9cd294492e adding untyped list type for use in automaton 2005-05-06 07:25:40 +00:00
Antoine Fraboulet
b9f9bd763e - regexp are now complete and correct
- licence update in files header
2005-05-05 23:45:04 +00:00
Antoine Fraboulet
49a41bb311 - added + ? and [^xx] works in most of the cases, automata is no more
deterministic, I have to rewrite the automaton_build to correct this.
2005-04-27 17:35:03 +00:00
Antoine Fraboulet
e29aa11a75 lexer/parser function name changed yy* -> regexp* 2005-04-26 16:31:45 +00:00
Antoine Fraboulet
2b829c1768 doxygen doc changes 2005-04-26 07:37:55 +00:00
Antoine Fraboulet
70cbbedede QMARK and PLUS are working, still a small thing to correct for QMARK (a[bc]?d) 2005-04-25 09:17:53 +00:00
Antoine Fraboulet
a0b083e83b adding QMARK, PLUS 2005-04-25 08:18:24 +00:00
Antoine Fraboulet
c8dde79bc3 uint_t -> dic_elt_t for dictionary 2005-04-20 18:11:00 +00:00
Antoine Fraboulet
072afe50f8 fixed a memory leak when freeing automaton 2005-04-19 20:18:32 +00:00
Antoine Fraboulet
909a29a43d minor changes 2005-04-19 20:02:55 +00:00
Antoine Fraboulet
473ef6d47f DEBUG_RE removed 2005-04-19 18:09:44 +00:00
Antoine Fraboulet
9296520b64 correction for generated files derived from er.l and er.y 2005-04-19 18:07:14 +00:00
Antoine Fraboulet
120f342c5d small typo fixed 2005-04-19 16:40:24 +00:00
Antoine Fraboulet
be0dea2a08 - documentation added for the dictionary
- regexp is now working (still needs some testing)
- regexp syntax error recovery is not implemented
2005-04-19 16:26:50 +00:00
Antoine Fraboulet
ad5b5963d5 *** empty log message *** 2005-04-18 17:40:36 +00:00
Antoine Fraboulet
59f7c6df9c yyparser ok. must change things to have a unique prefix instead of yy* 2005-04-16 20:55:51 +00:00
Olivier Teulière
5b70753b50 Fixed a warning in Doxygen generation 2005-04-10 13:35:10 +00:00
Antoine Fraboulet
4f1420ed31 - minor dictionary .h changes
- starting integrating regexp into eliot
2005-04-09 19:16:09 +00:00
Olivier Teulière
6b025b9541 - Several fixes in the build system
- Added a bootstrap script to reduce manual work
 - Added a --enable-debug configure switch to define the DEBUG variable
2005-04-03 21:12:03 +00:00
Antoine Fraboulet
8121c6ab4c raccords and benjamins are now search active 2005-03-29 08:22:55 +00:00
Olivier Teulière
b7032e2d78 - The Game library is now in C++.
This simplifies the code in many places, and allows inheritance of the
   game mode classes (Training, Duplicate and FreeGame).
 - A Tile is no more an unsigned char, but a class: it should help supporting
   i18n of the game. The Dic library still uses unsigned chars though.
 - Improved the configure script, to enable/disable the compilation of some
   interfaces.
 - Added a ncurses interface, much nicer than the text one. The game mode and
   the number of players are currently hardcoded, it is not possible to change
   them interactively (yet).
 - Repaired the save/load functions.

NOTE: The wxWindows interface compiles, but is completely broken. I'm afraid it
needs a full rewrite (to support the various game modes in particular).
2005-02-05 11:14:56 +00:00
Olivier Teulière
b102aafbcd Support for 3 different game modes:
- 'Training' mode: same behaviour as before
  - 'Duplicate' mode: all the players (who can be human players or AI
    players) have the same rack, and the best word is played on the
    board
  - 'Free game' mode: the players (human or AI) have different racks,
    and they play one after another

Status:
  - Core: the main functions are written, but the API could be more
    homogeneous between the different modes.
  - Interfaces: the text interface is almost up-to-date, but the
    wxwindows one only supports Training mode.
  - AI: Currently, AI players always play the best word, which is
    optimal in Duplicate mode but not in FreeGame mode. Other strategies
    will be written in the future.
  - Handling of saved games is broken: a game can be saved and loaded,
    but no information about the mode and the players is stored, so it
    crashes whatever you do after loading the game.
2004-08-07 18:10:42 +00:00
Olivier Teulière
acd1aa0f1b Added .cvsignore files 2004-07-08 18:17:31 +00:00
Olivier Teulière
61963c0fe0 Fix pour la compilation windows, et la compatibilit avec wxWindows 2.5
(pas encore suffisant)
2004-06-22 21:04:07 +00:00
Antoine Fraboulet
3241a1c1af ajout de regexp.c 2004-06-21 16:06:54 +00:00
Antoine Fraboulet
1b498989bd dbut des ER, parcours d'arbre ok, construction automate ok. Manque construction
de l'arbre et utilisation automate avec dictionnaire.
2004-06-20 20:13:59 +00:00
Antoine Fraboulet
c7899d0807 *** empty log message *** 2004-06-19 18:43:35 +00:00
Antoine Fraboulet
90b1affcef *** empty log message *** 2004-04-08 09:43:06 +00:00