How an Algorithm Solves Wordle

Everyone has an opinion on how to play wordle, the popular word guessing game. Start every game with AUDIO. Or maybe CRANE, or ARISE. Bill Gates shared his strategy. Thus has Kamala Harris.

A new paper by MIT Professor Sloanand Alex Paskov, a PhD student at MIT Sloan, could settle the matter once and for all.

Using a modeling method known as exact dynamic programming, the researchers designed an algorithm that optimally solves the game without fail. In Wordle, players have six tries to guess a five-letter word. After entering a word, colored tiles indicate whether the letters are in the word and whether they are in the correct place. The model solves the game in just two guesses 4% of the time and in three guesses 57% of the time. He only needs a fifth guess 3% of the time, and he never relies on that sixth and final round.

What word does the computer start with? SALET – an obsolete form of salett, which is an “ornamentally engraved helmet”, according to Wiktionary. For audiophiles, Bertsimas and Paskov note that SALET reveals an average of 1,683 colored tiles on the first hit, while AUDIO reveals an average of 1,320 colored tiles. Other main words include REAST (a resting obsolete spelling), TRACE, CRATE, and SLATE.

Related Articles

With SALET, the computer model averages one win in just 3,421 guesses. For comparison, Saint Paul, Minnesota, which has the highest average Wordle score of any city in the United States, comes to 3.51 guesses.

The algorithm reaches this score by opening the game with SALET. Based on the colored tiles revealed by this initial guess, it then determines all the possible guesses that could follow, from a list of 10,657 five-letter words. (Only 2,315 of these are possible answers, because Wordle limits the universe of solutions.) Finally, based on what is available, the algorithm chooses the next most strategically illuminating word.

Bertsimas and Paskov designed the algorithm to explain every move – in a sense, it teaches best practice by demonstrating its logic. (The website allows users to see what the algorithm suggests based on SALET as the starting word.) As an example, they present a hypothetical case where someone starts with the word LIGHT. This guess reveals that IGHT are all the right letters in the right position.

To figure out what comes next, most people would start scrolling through the possibilities – TIGHT, FIGHT, MIGHT, RIGHT, and NIGHT, for example. Instead, the computer takes a second estimate of FERMS (Middle English form of “farms”) and, in one line, eliminates five possibilities at once.

For those who play Wordle, it might be helpful to take note of the algorithm’s approach, study a Scrabble dictionary, and brush up on your average English. But an easier first step is to start a game with SALET and see where it takes you.

Figure comparing the Wordle table resulting from a possible game played by a human and the optimal policy. Credit: Bertsimas, D. and Paskov, A., “An exact and interpretable solution for Wordle”, 2022.

Comments are closed.