5 ms·
I've written a wordle solver (and tic-tac-toe, Chess, Leduc Poker CFR, mastermind and others) and I do agree it's a good start for AI. It's not trivial but stil
by Vetch 5y ago
I've written a wordle solver (and tic-tac-toe, Chess, Leduc Poker CFR, mastermind and others) and I do agree it's a good start for AI. It's not trivial but still quite approachable, much like the game itself. My solver takes a very simple approach and has algorithmic complexity O(N^2).
The word list for the initial guess can be precomputed (I handle this simply as well, top 16 words with 3+ vowels, no duplicated letters and maximized pairwise similarity). The easiest first step that goes a long way on its own is simply maintaining constraints. Having applied constraints, the next issue is selecting from narrowed word lists. To do that I compare every word to every other word by spelling, idea being highest scoring word will be most informative, but also constrained to maximize difference from previous guess (although this step is rarely needed).
As available guesses are already significantly whittled down even by second guess, it runs in << 1s and completes in 3-4 guesses.