The Mathematics of Wordle
Wordle is an online puzzle similar to Master Mind where the aim is to guess a secret word of fixed-length in six guesses. Each guess can potentially reveal information about the secret word through a coloured response code: a letter placed in the correct position is coloured green, a letter placed in the wrong position is coloured yellow, and a letter that is not present in the secret word is coloured grey. The guesses must be from a list of allowed guesses, which are all (mostly common) English words, and the set of possible secret words is a (significantly smaller) subset of the allowed guesses. The usual variant of Wordle deals with 5-letter words, but variants with more or less letters exist. There are also variants that twist the rules or are loosely inspired by Wordle, such as Absurdle, Nerdle, Quordle, Squardle, Semantle, Worldle, and the humourous but surprisingly challenging Lewdle.
When I encountered Wordle, I wondered whether there was a way to solve it programmatically. Master Mind has well-known optimal strategies (for various reasonable definitions of optimal), so it did not seem like a stretch to imagine that Wordle should be easily solvable too. Unfortunately the solution space and guess space are constrained to be English words, whereas in Master Mind the solutions and guesses are numeric sequences with no constraints on the digits of the sequence. It turns out that there are still somewhat optimal strategies and upper bounds on how “badly” one can do. Here are some resources I found.