SCORE OFTEN
Lately, I've been obsessed with Wordle. I know I'm not the only one; I'm constantly seeing my social media flooding with everyone's black, yellow, and green boxes.
For the uninitiated, a summary: Wordle is a word game. Each day, there is a new puzzle to find a five-letter word. With each guess you make, the puzzle lets you know if each letter is correct and in position (green), a correct letter but in the wrong spot (yellow), or if the letter is not in the word at all (black). You have a total of 6 guesses to find the word of the day. It sounds simple, but the strategies can get complex fast.
I've been liking the challenge each day, but lately, I've been thinking deeper about the strategies. What are the best words to guess? How quickly can we accurately guess a word?
CRAFT LOGIC
I've always said that I have a penchant for finding efficiency. I get excited when I can figure out the logic behind complex problems. That excitement only builds when I can automate these solutions. When I thought about this specific problem, I dove in with all haste.
I knew that I wanted to build a solver for the game, but I didn't want it to merely take the hints that the game already gives to you. I wanted it to think. What makes a good word? To this end, I developed the following strategies to implement:
- I wanted the solver to take unique letters into account. The more letters that you can eliminate, the fewer words that you'll have to dig through for your solution. SASSY would only end up informing you about three letters. On the other hand, a word like STARE could give you hints on up to five letters.
- I also wanted the solver to consider English letter distribution. Letters are not distributed evenly across our language, and our solver can take advantage of this fact. By taking some data into account, we can make the solver more intelligently choose which words to guess next.
I'm sure there are more strategies that I could dig into, but this was sufficient to get a good start on cracking the code. But what medium should we use to solve this? Surely, some coding with a database of dictionary words would be the the most efficient way to solve the problem.
WORDY SHEET
My weapon of choice for this challenge actually ended up being the classic Microsoft Excel. By turning every word into its own formula, we've made Excel an effective tool for churning out a solution.
And this is what I eventually came up with.
The spreadsheet is loaded with a dictionary of over 5700 words. Out of these words, every word is assigned a score of how "good" the word is in your next guess. The first few calculations are pretty straightforward. We're looking at any of the hints that we've already received from the puzzle immediately eliminating anything that's impossible. The last few calculations are what give the solver its wings. By finding the number of unique letters and scoring each word based on how many high distribution letters it has, we can pick out words that are going to give us the most amount of hints in each guess. Interestingly enough, the solver has decided that IRATE is the best first word to use, as each letter is very common in English words and has entirely unique letters.
VALUE TESTS
Since the original Wordle only has a single puzzle each day, I tested the solver against Wordle Unlimited, a Wordle clone that has an unlimited number of plays each day. In my testing, my Wordle solver sheet was typically able to get the puzzle accurately solved in four guesses, though results vary depending on the puzzle. Sometimes it would get stuck if a word had a common shared set of endings, as it would only get hints on eliminating one or two letters at a time.
Can you think of any additional strategies that would make the solver even more accurate? If so, I would love to hear about what you have to share.