Wordle Replay
Motivation
At the beginning of 2022, a coworker first introduced me to the daily word guessing game called Wordle that was taking the world by storm. I was intrigued from the very first time I played, which is rare enough since I don’t play many games. That same night I shared the game with my wife and mother-in-law, and when I later discovered that they both had gotten hooked too, I knew that this game was special.
I couldn’t help but think that I could make a tool that could help solve these puzzles. After all, I had been looking for an excuse to improve my web development skills.
What is Wordle?
The premise is refreshingly simple: each day, guess the secret 5-letter English word in as few tries as possible but no more than 6.
Throughout the whole world, everyone tries to guess the same secret word. And once you’ve found it, you have to wait until the next day to play again on the new secret word.
After each guess, which itself must be a valid 5-letter word, each letter will change to one of three colors:
- green: that particular letter is in the word AND in the correct spot
- yellow: that particular letter is in the word but NOT in the correct spot
- gray: that particular letter is NOT in the word.
If you haven’t played, you really ought to check it out.
What did I build?
I ended up building what I’ve called Wordle Replay with the following features:
stays in sync with the real Wordle as the days go by (i.e., refreshes at midnight of the timezone of each user).As of November 7, 2022, the New York Times, who purchased Wordle, hides future words, thereby preventing me or anyone else from being able to automatically stay up to date. For now, staying up to date has become a manual process.- provides what it considers to be the top suggestions for the user’s next guess.
- allows the user to play a Wordle from any day in the past.
Suggesting the top next guesses
Without getting too lost in the details, this is how I implemented the feature that suggests the next top guesses.
- Starting with the list of all valid words, calculate the frequency of each letter.
- Score each word based on the letter frequency (words with more frequently used letters get a higher score).
- Choose the words with the highest scores (broken out by the number of duplicate letters – words with fewer duplicates tend to provide more information).
- Once a user enters a guess, compare the guess with the actual word to get a breakdown of the guess’ green/yellow/gray letters.
- Based on the guess’ green/yellow/gray breakdown, remove any words from the valid word list that would be inconsistent with the results of the guess.
- Restart at step 1.
Wordle Replay tool
Embedded below is the live version of Wordle Replay. Navigate to wordlereplay.com for a full-page view. It works well on mobile too.
Enjoy!