alex1770 / wordle

Finding optimal play in the game of wordle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The program wordle evaluates how good, on average, different words are as first guesses in the game of Wordle.

See (Jan 2022) http://sonorouschocolate.com/notes/index.php?title=The_best_strategies_for_Wordle for some results and a brief description, and

    (March 2022) https://sonorouschocolate.com/notes/index.php/The_best_strategies_for_Wordle,_part_2 for an updated article, and

    (July 2023) https://sonorouschocolate.com/notes/index.php/The_best_strategies_for_Wordle,_part_3_(July_2023) a further update using an extended hidden word list.

The above articles give some other example usage modes for the program.

Note that the default hidden word list here (wordlist_hidden) was changed in August 2023 to the extended version (3158 words).
To refer to the previous major version (2309 words), use the option -h wordlist_nyt20220830_hidden.

The description below was written for the original word lists, not the current default word lists.
To get the output as described, add the options -a wordlist_orig_all -h wordlist_orig_hidden.

Example usage (can use -H with each to get hard mode):

wordle -n10
Try to find the best starting word, restricting to the top 10 choices of words at each stage. This is a reduced search which in general will find an upper bound for the best score (lower=better). In this case will find the optimal word (SALET) with the correct value (7920), though without proof that this upper bound is exact (which it happens to be), or that there isn't a better word.

wordle -n100 -g5
As above but restrict to a maximum of five guesses.

wordle
Use all words at each stage (the default behaviour), so this finds the best word with proof, but it will take a long time to run (maybe a day or two on single core). See below for how to share out this work over different cores.

wordle -n100 -s
Same as wordle -n100, except that all first words are fully evaluated, rather than just lower bounds on most of them.
In practice -n100 will give very accurate upper bounds. The majority of answers will be correct, and of those than aren't, the majority will only be 1 too high, etc..
The summary output from an earlier version of this run can be found in the file normal.n100.

wordle -w raise
Fully evaluate the single first choice worse "raise".
This typically takes seconds (for first choice words other than "raise"), but can take several hours for a really bad first choice word, such as "qajaq".

wordle -w salet -p tree.txt
As above, but also print out the strategy tree in the file tree.txt.

wordle -w qajaq -b 7920
Evaluate the single first choice worse "qajaq" where we don't care if the result is bigger than 7920. This will terminate very quickly, because it can easily prove that qajaq is equal-or-worse than 7920.

wordle -t normal.n100
Evaluate all first choice words from the file normal.n100 in that order (instead of the algorithm making up its own order to evaluate).

wordle -s -b7951 -t normal.n100
As above but where the score cutoff is fixed at 7951 rather than derived from the best word found so far. This will make it faster to evaluate some of the harder words, though it will only return an answer of the form ">=7951".
This search will give a (proven) list of the top 10 words, because there are 10 that score below 7951.

wordle -s -b7951 -t normal.n100,3,12
As above, but only use lines 3, 15, 27, ... (in steps of 12; first line counts as 0). This is a useful mode for parallelising over different cores/CPUs.

wordle -H -d -w salet -g5
-H makes it use hard mode
-d means it only cares about whether it can guarantee to find the hidden word in the specified number of guesses (in this case 5, from -g5), not the average nmumber of guesses required.

wordle -h wordlist_all -w prate -d -n100 -p prate.tree
Set the hidden word list to include all test words too. Some people prefer to solve using this, rather than the set of allowable hidden words.

wordle -H -h wordlist_all -d -g8 -w brain
As above with the hidden words set to all words, in hard mode, proving that the start word brain guarantees solving within 8 guesses.

wordle -w parse.BBYBB.clint.BBYYB -p tree
Solve the situation where PARSE scored BBYBB and CLINT scored BBYYB, showing the best next guess, the average required number of guesses and the optimal strategy.
This allows you to compare your play with the optimal play at any turn, not just the first one.
If your actual guess in that situation was MINOR then you can do
wordle -w parse.BBYBB.clint.BBYYB.minor
and compare the results with the above. (This will reveal that MINOR was slightly suboptimal compared to the best guess.)

About

Finding optimal play in the game of wordle

License:MIT License


Languages

Language:C++ 97.3%Language:Python 1.4%Language:Makefile 1.3%Language:Shell 0.0%