Ultimate word in Wordle!

During the pandemic Wordle was extremely popular. It was so popular that it was the top Google search term globally in 2022. But what is Wordle? Wordle is a word game, where you have 6 attempts to guess a five-letter word. As you make attempts you get clues and hints about the final answer. The clues are as follows:

Main Goal!

My goal for this blog post was to find the best theoretical opening word that gives the best chance of winning in the shortest guesses. There have been a lot of people that attempted to answer this question and I wanted to explore different ways and ideas that made sense to me.

First Approach - ROATE

In this approach, I decided on a heuristic that the best word to guess during any Wordle attempt, is a word that would eliminate the most words and reduce the searchspace (entropy). In the algorithm I designed, I kept track of the number of words eliminated as adding more and more color hints, and I did that for all the possible words that can be accepted. This gave me the best word of ROATE with average reduction of searchspace to 60.42 words from 2315 total words.

001.roate: (60.424622030237515)
002.raise: (61.00086393088577)
003.raile: (61.33088552915751)
004.soare: (62.30107991360683)
005.arise: (63.7257019438448)

My results above match with other resources I found online (reddit post and Finding the best Wordle Opening).

Second Approach - SALET

After my first attempt to solve the problem, I realized that it can be suboptimal. Assuming a word that reduces the search space the most on the first attempt does not conclude that it is the best strategy overall. The best analogy of this is eating a bowl of cereal with a ladle, yes the first swig will be plentiful but it is very inefficient for 2nd and 3rd attempt. So I opted for a tree-like search by analyzing words eliminated after multiple attempts. This led me to find the word SALET with an average reduction of the searchspace to 3.37 words after 2 attempts from 2315 total words.

001.salet: (3.3706263498920634)
002.toile: (3.400863930885407)
003.slate: (3.4146868250541047)
004.slane: (3.424190064794857)
005.roate: (3.440604751619958)

The word SALET given the original Wordle answer set was a very popular mathematical opening word. A lot of other online resources reached the same conclusion such as (MIT Journal, 3Blue1Brown, and jonathanolson.net).

Conclusion

I put all my code for this project on github. I did not try to get further statistics on the word SALET and analyze the average win rate (Online sources say 3.4 average attempt win rate). The word SALET can get unlucky specially with double letter words such as JIFFY and FIZZY, and could take up to 5 tries to solve. Will I change my Wordle strategy and use words such as SALET? Probably not, SALET might be super efficient for computers, but it is not an efficient word for Humans as we do not perform exhaustive searches. For humans using words that highlight all the vowels or have a higher likelihood of green letters might be a better choice.

For Nerds: Additional Hairy Computational Details

Disclaimer: I don’t have professional training in math, this just made sense to me and the result matched other sources online. But some of the assumptions I made can be wrong so forgive me. This is just how I went about it.

Wordle Mechanics

In Wordle there are two wordsets. The first wordset (answer_wordset) consists of all the possible answers that the Wordle game can be (2315 words total). The second one, which is a much bigger set, is a wordset of all the possible words (combined_wordset) that the game allows you to input which are much rarer (12972 words total).

How did I approach this problem?

To solve this problem mathematically I set out to find words that reduce the most entropy (searchspace) after multiple rounds of playing assuming the user makes optimal choices. Given the total color outcomes after inputting a word \( 3^5 \) (3 different colors at 5 different letters), I assumed at first the summation of the probability of the given color pattern times the number of words reduced would be a good heuristic. The equation can be seen below:

\[ N(WORD) = \sum_{i=1}^{n} P(Color(X_i)) * N(Color(X_i)) \]

Unfortunately the probability of each color outcome is not perfectly distribute of \( 1/3^5 \). Given the answer_wordset, some color probabilities for an inputted word are more common than others. Also the probabilities and word reductions at each color outcome are not independent of each other, as same words can be reduced at different color patterns.

I introduced a new color set that does not give any information about the final word. Since with the current Wordle color patterns, gray also provides information by reducing the entropy (It cuts all the words that have the gray letters). I added a light blue color hint that it does not provide any information on the inclusion or exclusion of the letter. This helps because it introduces the Probability that all the colors will be light blue is 1, since all the letters can and can not be in the final word. This helped me with the math later.

Having introduced the color light blue it gave me this flexibility for Wordle to calculate probabilities like this.

\[ P(Color(GGGGB)) = P(Color(GGGGB)|Color(GGGBB)) * P(Color(GGGBB)) \]

Where G and B are the colors Green and Blue at a letter position.

Now all that is left to count all the color possibilities and the respective amount of words they reduce. Given the conditional probability nature of how I set up the problem, this can be done by recursively searching the color tree and summing up the words reduced at each step without performing additional recomputation for the probability.

To find the number of words reduced after two word inputs, I reran the same algorithm for all the combined_words with the possible word set I got after step one. That's how I found the word SALET.

Thanks for reading.