Q1) How does Wordle evaluate your guesses?
The source code actually contains two lists of words. The first is the list of daily solutions. The second is a list of valid words which will never be a correct solution. In total there 12972 possible words in the two word lists. If your guess is not in either of the two lists, then it is deemed an "invalid word".
Hot recommendation: don't ruin the game for yourself by looking at the solution list!
Q2) Are there any client-to-server communications?
No! Wordle is completely client-side. It requires no server-side evaluation of solutions and no fetching of new data. Even once you successfully solve a Wordle, there is no communication to a backend. It seems Wordle is not collecting statistics on anyone's guesses! 🙅♂️📊
This really surprised me - but it is actually very smart and cost-effective. It also answers one of the big questions I had: how much does it cost to host Wordle?
Furthermore, these static assets are cached on the user's browser, meaning users only need to download it periodically. The
cache-control response header tells us the cache expiry is set to 4 hours.
Q3) Where is application state stored?
Application state is stored in your browser's local storage. That is why you can refresh the page, and not lose your previous guesses. It is also where your running statistics (like streaks) are stored 💾
gameState object with a simple plain-text history of your guesses, and the corresponding evaluation ("correct", "present", or "absent"). The current day's solution is also saved in the
gameState object each day.
At the start of each day, the
gameState object in Local Storage is reset.
Q4) How does the game know when to stop showing today's Wordle, and start showing tomorrow's?
This elegantly ensures that the word changes at midnight local time, regardless of time zone. The lack of a backend webserver simplifies this mechanism, by allowing users in different time zones to have different experiences. For example, I will see today's word 20 hours before people in Hawaii (and that's okay!).
Wordle is a great game. My family and I are having a lot of fun with it.
Diving into the source code showed me that you can make something fun and immensely successful while still being simple. In fact, often the simplicity facilitates its success!
Kudos to the creator!