Optimal coverage for Wordle with Monte Carlo methods – Part III
bytepawn.com
bytepawn.com
[['brung', 'waqfs', 'vozhd', 'cylix', 'kempt'],
['brung', 'waqfs', 'vozhd', 'xylic', 'kempt'],
['jumby', 'waqfs', 'vozhd', 'clipt', 'kreng'],
['jumby', 'waqfs', 'vozhd', 'pling', 'treck'],
['jumby', 'waqfs', 'vozhd', 'prick', 'glent'],
['jumpy', 'waqfs', 'vozhd', 'bling', 'treck'],
['jumpy', 'waqfs', 'vozhd', 'brick', 'glent']]
I was a little inspired by this thread [0] about the practicality of implementing brute force algs in pure python for solving wordle. Using only built-ins and with a bit of optimisation [1] it runs in 4 minutes single threaded in cpython.[0] https://twitter.com/eevee/status/1484716294179934209
[1] Instead of considering every possible combination, it discards non-optimal subsets. E.g. when considering o-words, only u- and a-word combos that already cover 10 letters are looked at. This significantly dampens the combinatorial explosion
My experience has been that the range of problems big enough for scale to matter, but small enough for language to matter isn't that big. If I won't wait a year for python to compute something, I probably won't wait three weeks for rust either.
Obviously if we're talking about paying for compute cycles then it matters, but surprisingly that's not usually where discussion is focused.
I have a decision tree that averages 3.67 guesses [0], so a bit worse than yours, but the maximum guess length is 5. My heuristic is to search for trees by looking at how the guesses split the remaining answers by their match patterns. For each guess, create a map from match pattern to the count of answers with that pattern. Order guesses by the sum of the squares of answer counts (to penalise patterns with lots of answers). Evaluate sub-trees for the top 2^(6 - depth) guesses.
Edit: How often do you need to evaluate sub-trees as a tie-breaker? I re-implemented your strategy of selecting the guess that minimizes the sum of the squares of the counts, but didn't include the evaluation of sub-trees. That was enough to reproduce your 3.67 average, (`{2: 23, 3: 802, 4:1416, 5:74}`), without the sub-tree recursion.
I feel like calculating the possibility space for such a small game doesn't really reveal a lot (because we can just observe that it is a small game in that sense).
Avg is 3.7 guesses, worst case is 6 over the entire wordle dictionary. I don't think it would have any issues scaling to 20 letter words. https://github.com/mschrandt/Wordle
Absolutely
"Optimal coverage" in the article title refers to unique letters. It's not the case that playing these is optimal, due to frequencies and position-density of letters (obviously).
https://en.wikipedia.org/wiki/Vozhd
https://en.wikipedia.org/wiki/Waqf
How many such (arguably) obscure words are there in the Wordle word list?
grep -P '^[a-z]{5}$' /usr/share/dict/words | sed 's/\(.\)/\1\n/g' | grep -Pv '^\s$' | sort | uniq -c | sort -n | xargs
42 q 70 j 89 x 97 z 261 v 418 w 445 f 480 k 549 g 557 b 636 y 646 h 647 m 757 p 793 c 828 u 990 d 1027 n 1266 t 1268 i 1305 l 1468 o 1488 r 1848 a 2443 e 2552 s
and:
$ grep -P '^[a-z]{5}$' /usr/share/dict/words | sed 's/\(.\)/\1\n/g' | grep -Pv '^\s$' | sort | uniq -c | sort -n | tail -n 10 | awk '{print $NF}' | xargs | rev
s e a r o l i t n d
for a bit more readability, is that "arose" is a better starting word for 5 letter english words.
That said, the difference between the i and the o is not large, so both probably work well.
It's not that easy. If you're guessing the most common position for a letter, you may not be gaining the maximum amount of information.
The heuristics approach you're using won't beat brute force evaluation of all possible guesses for all possible solutions (which is only a few million combinations).
I'm sure brute forcing will probably guarantee a win almost always, but will it be, for example a 3 or 4 word win which is pretty easy to do for a human.
1st: 303 t 305 p 343 b 370 c 629 s
2nd: 404 u 511 e 530 i 699 o 758 a
3rd: 325 n 370 r 405 o 444 i 515 a
4th: 253 a 299 l 313 n 358 t 1013 e
5th: 291 t 394 d 472 y 495 e 1506 s
So.. I guess unsurprisingly ending a word in "es" is the way to go and an "a" is 2nd is pretty good closely followed by "o"
With those values "cares" or "bares" seems like a better bet? It gets you that popular r in 3rd, and the ending es...
s e a o r i l t n d
e a r o t l i s n c
If you don't want spoilers, don't look them up? It's like complaining that the existence of archeology as a field takes the romanticism out of dinosaur stories.
Can you elaborate on how the game is broken? How does someone else writing a solver affect your own enjoyment of the game? Wordle isn’t competitive, right, so is the problem just knowing that a robot can do it demotivates you from trying?
This might be an interesting question about human behavior and our motivations that we should think about as we move into the AI age, because no, there will never be another popular game that escapes AI players. Not only are we going to make AI for every playable game, we are building AI for every human activity.
FWIW, I’ve written Sudoku and Boggle solvers, and still love to play those games manually. In fact writing the solvers I think increased my own enjoyment of them, it gives a certain perspective on the difficulty of the game, and of how much humans do to simplify our effort compared to a computer.
I completely agree that it's a fascinating wider question I think I'm alluding to here - living in a world where AI/computer brute force can achieve everything is a going to be a strange place to live in in 50-100 years time. Do we want to make humans redundant in this way - sure this is just a silly game, but, as COVID has shown us the last couple of years, supply chains, logistics etc are all minutely tuned and determined by computers with little human involvement - is that a world we all want to live in, I'm not so sure.
BTW I’m not trying to debate or contradict you, your opinion is valid and I’m hoping to dig into that wider question a little by getting more specific about your personal experience and emotions, to uncover in more detail what it is about AI that is bumming you out. I’m curious to hear about what the automation is taking away from you from your perspective. Does the Wordle anagram solver here feel worse to you or similar to older examples like the Big Blue chess AI? And how do computers in general fit in, as well as mechanical automation like cars & tractors, etc?
Are there certain kinds of AI automation you see value in, any things that leave humans with less manual labor and more free time? I’m kind of excited for driving AI, for example, if we can make it safe and reliable enough. It will definitely upset certain economies, but maybe fewer accidents and traffic jams and more free time during travel are redeeming values?
For a nice do-it-by-hand puzzle try this:
Fill a 4x4 grid with whole numbers less than 30, such that all rows have the same product (of all 4 numbers) and all columns have the same sum (of all 4 numbers). This can be done by hand with some paper - I kept notes in notepad to do it.
Part of the fun (and in game-nerdery terms, the “optimality”) is getting there before 6 guesses, which would require some adaptive strategy.
Not to belittle your effort, but one of the appeals of Wordle is 1) everyone has the same word, 2)Once per day. It becomes a ritual between friends.
Considering there is no LICENSE in the original notebook or repo, I'm not sure I can publish my changes.
Vozhd, for example, is not in Merriam-Webster.