16 Commits

Author SHA1 Message Date
Mike Mueller
d820ab1f1c Remove some useless checks.
Some solution length logic was previously moved to handle_message.  Some of
the code in _valid_solution became nonsensical (not broken, just weird).

Cleaned up.
2012-03-04 22:57:10 -08:00
Mike Mueller
943b0c2adf More README updates. 2012-03-04 15:26:32 -08:00
Mike Mueller
60c7fd09e7 Update the command help in README. 2012-03-04 14:05:17 -08:00
Mike Mueller
b69967628a Change default dictionary and improve configurability.
Now defaults to the /usr/share/dict/american-english dictionary which is
probably found on many Linux systems today (avoiding the need to dig up a word
file on the interwebs).  On Debian/Ubuntu, you can 'apt-get install wamerican'.

Added a configurable regexp to filter the word list down to reasonable words.
Defaults to allow lowercase a-z only, therefore filtering out proper names,
hyphenations, contractions, and words with accented characters like "adiós".
(But hopefully still supporting non-English users by allowing this to be
changed.)
2012-03-04 13:46:46 -08:00
Mike Mueller
82e4665a82 Minor wording fix. 2012-03-03 14:42:58 -08:00
Mike Mueller
029ba10906 Oops, handle missing word file gracefully.
Apparently I backed out the previous change that handled this.
2012-03-03 14:41:00 -08:00
Mike Mueller
844723d28a Filter duplicate words in puzzles.
Was occasionally generating a puzzle foo > --- > --- > foo.  Oops.
2012-03-02 17:23:31 -08:00
Mike Mueller
a443d66473 Fix a performance issue in _find_solutions.
WordTwist successors can take you in circles (scare > stare > scare),
so check for this condition to avoid generating overly many potential
solutions.
2012-03-02 17:04:21 -08:00
Mike Mueller
17d1f91f8c Revise game difficulty settings.
Instead of taking lengths, the games now take easy|medium|hard|evil.
These values correspond to a range of puzzle lengths, word lengths, and
number of possible solutions.  I attempted to tune them to reasonable
values, but I could see them changing.

Also did a little more code clean-up.
2012-03-02 16:46:54 -08:00
Mike Mueller
b519259f54 Update copyright information. 2012-03-02 15:25:44 -08:00
Mike Mueller
51ca3bedfd Improve WordShrink's is_trivial definition.
No substrings should occur in any word of any solution (not just two
successive words).  This is really going to narrow down the set of puzzles,
hopefully it doesn't churn or get repetitive.
2012-02-24 20:18:36 -08:00
Mike Mueller
5e570f61c1 Refactor, optimize, clean-up.
The two games have a lot in common, so factored out a base class called
WordChain that implements most of the logic.  The game-specific behaviors
are implemented in the (now smaller) WordTwist and WordShrink classes.

Optimized to build a map of word relationships first and then derive all game
behavior from that map.  This could probably be improved even more, but for
the moment it is working nicely.
2012-02-24 19:17:05 -08:00
Mike Mueller
25136ae926 Fix a bug in error reporting. 2012-02-24 01:04:10 -08:00
Mike Mueller
e74ca803fe Restrict input snarfing a bit.
Only attempt to validate responses that look like words.
2012-02-24 00:33:14 -08:00
Mike Mueller
180252e826 Handle missing wordfile gracefully. 2012-02-24 03:21:45 -05:00
Mike Mueller
4afb3cbe3e Initial commit! 2012-02-24 00:10:33 -08:00