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