Python program to play a word-guessing game like Wordle, but…
- More addictive because you can play it over and over and over, not just once a day.
- Option for varying the word length (
-l
,--length
) or number of guesses (-g
,--guesses
) - Option to allow guesses that aren't known words (
-n
,--nonsense
) - Option to do guess-by-guess analysis, showing how many words you eliminate after each guess (
-a
,--analysis
) - Option to show time taken after every guess (
-t
,--timer
) - A bunch of unit tests to verify the logic
- Beautiful command-line text interface (😜)
Requires Python 3.x, the colorama
module
for printing colored letters, and a file containing a list of possible
words. The default wordlist is in /usr/share/dict/words
, which
should exist on any desktop Unix system.
Alternatively, the Collins Scrabble Word Lists seem to work nicely! CSW2019 contains 12,972 five-letter words, for example.
Install with pip3 install https://github.com/dlenski/lexeme/archive/main.zip
, then play the game with the command lexeme
.
usage: lexeme [-h] [-d DICT] [-g GUESSES] [-l LENGTH] [-n] [-a]
optional arguments:
-h, --help show this help message and exit
-d DICT, --dict DICT Wordlist to use, either an absolute path or a path
relative to /usr/share/dict. Default
/usr/share/dict/words.
-g GUESSES, --guesses GUESSES
Maximum number of guesses to allow
-l LENGTH, --length LENGTH
Length of word to guess
-n, --nonsense Allow nonsense guesses. (Default is to only allow
known words.)
-a, --analyzer Analyze remaining possible words, and show their
number after each guess. If repeated (cheater mode!),
it will show you all the remaining possible words when
there are fewer than 100
-t, --timer Show time taken after every guess.
Example of gameplay, with analyzer (-a
) and timer (`-t) enabled,
showing you the number of possible remaining words, and the time taken
for each guess:
Example of cheater mode (-aa
), show you all of the possible remaining words
after each guess, as long as there are ≤100 of them:
- Wordle, of course
- @jsha's brilliant Wordlyze (source for the analyzer mode
- The subtle handling of repeated letters inspired the unit tests