# Is Wordle always beatable under optimal play?

Is Wordle always beatable under optimal play on easy mode (where you can guess any valid word)?

To put the question more formally, does there exist a deterministic computer program that can play Wordle successfully, without cheating, for every target word? Wordle is a deterministic game besides the hidden target word, and there is a known, finite list of target words, so this question should be decidable. An examination of Wordle's source code shows that there are 2,315 possible target words and 10,657 additional allowed guess words (12,972 total allowed guess words).

## Bonus questions

(These are included in case an answer happens to have them; they are not necessary to answer the question.)

• Is the answer different for easy mode (where you can guess any valid word) vs hard mode (where your guess has both be a valid word and match the clues you've been given so far)?

• If there is such a program, what is the word it uses for it's first guess? (If the program is deterministic, it should always use the same opener)

• What is the worst case performance of an optimal program (ignoring the 6 guess limit if there is no optimal program that always wins)?

• Your final two questions might be best split off into their own questions depending on the answer you get here. They're more like programming questions though, so you might have better luck asking them on one of the programming sites.
– Wipqozn
Commented Feb 3, 2022 at 16:32
• I imagine it's not always beatable in hard mode. Consider if the word was LIGHT, and you started by guessing BIGHT. The last four letters are now locked in, and it could still be NIGHT, FIGHT, MIGHT, SIGHT, TIGHT, RIGHT or WIGHT, and you have no way of narrowing the options other than by guessing at random. Commented Feb 4, 2022 at 4:08
• @Showsni I'd argue that a strong definition of optimal play would preclude guessing BIGHT in the first place (on hard mode) since it would lead to a situation where you can't guarantee a win. An impossibility result would need to involve a much larger subtree of the possibility space.
– Zags
Commented Feb 4, 2022 at 15:10
• @Showsni It turns out Wordle is always beatable on hard mode (gaming.stackexchange.com/a/395310/163348) and the one of the keys is identifying a few starting nodes in the move tree that avoid unwinnable dead-ends such as BIGHT
– Zags
Commented Mar 2, 2022 at 14:50
• Related on puzzling.se: What's the optimal strategy for Wordle? Commented Apr 2, 2022 at 3:58

Wordle is always beatable under optimal play, on both easy and hard modes. This is doable using Knuth's minmax algorithm for mastermind with a curated starting guess tree.

Here is an example program that does so on easy: https://codegolf.stackexchange.com/a/242412/73123.

This program wins in at most 5 moves despite being suboptimal (at a minimum, the codegolf challenge restricts the guess space to the 2,315 word list when actual Wordle has 12,972 allowed guesses). It uses the starting word "LANCE", along with a curated list for some of the 2nd and 3rd round guesses, and the word that creates the smallest max split for the rest of it's guesses. Its win distribution is:

• Turn 1: 1
• Turn 2: 49
• Turn 3: 871
• Turn 4: 1354
• Turn 5: 40

Here is an example that wins every game on hard mode: https://gist.github.com/zags/a093467ee6e71fd35ff849a5b76f22e5

It's worst case performance is 6 moves, and uses the starting word "CALMS" and if it's a total miss, uses "BENTO"; otherwise, it uses the word that creates the smallest max split, with a small weight for guessing valid answer words over non-answer words. Its win distribution is:

• Turn 2: 94
• Turn 3: 834
• Turn 4: 1120
• Turn 5: 253
• Turn 6: 14

Yes, any valid Wordle puzzle will always be beatable with optimal play, as proven by Absurdle being solvable in 4 guesses.

Absurdle is an adversarial variant of Wordle where the game changes the secret word after each guess in a way that still matches the information from previous guesses. In the site's own words:

Wordle picks a single secret word at the beginning of the game, and then you have to guess it. Absurdle gives the impression of picking a single secret word, but instead what it actually does is consider the entire list of all possible secret words which conform to your guesses so far. Each time you guess, Absurdle prunes its internal list as little as possible, attempting to intentionally prolong the game as much as possible.

It's important to note that there is no randomness to Absurdle. The game will simulate the worst-case scenario* by considering every possible Wordle answer and picking the one that gives you the least information for any given guess. Therefore, since Absurdle's simulated worst-case can be solved in 4 guesses, we can assume that any "easy mode" Wordle should also be solvable with optimal play.

*Technically Absurdle isn't always the absolute worst case scenario. However, any extra challenge an optimal Absurdle would provide should be offset by 2 extra guesses allowed by Wordle's 6 guess limit

• While related, optimal solutions to Absurdle are not a true commentary on optimal solutions to Wordle. In Absurdle, the solutions that win in four moves are intentionally chasing down specific branches of the possibility space of Wordle. I have yet to see a Wordle algorithm that can always win in four moves or fewer (the best I have seen win in five moves in some cases).
– Zags
Commented Feb 25, 2022 at 1:50