Wordle is one of the biggest internet fads in recent years. This daily online word game challenges players to solve for a five-letter word in six attempts.
Originally created by British software engineer Josh Wardle, Wordle has become so popular that The New York Times Company purchased the web-based game from Wardle for over one million dollars in January 2022.
I know that I am not the only one in the Institute for Advanced Analytics (IAA) community who has become obsessed with Wordle (see Noah Sundberg’s post), and I look forward to facing the challenge each day. The satisfaction of solving for the correct word is amazing. It is even more rewarding when you solve it before friends. The sheer competition created when over two million people across an entire country have quick access to a brain teaser is energizing.
As attached as I am to the game, along with several million daily players in the US, I do have one complaint; once the word is solved or the six guesses are gone, that’s it for the day. You must wait until tomorrow. Maybe the supply of the puzzle is what creates the demand, causing us to come back each day, craving tomorrow’s new word as soon as that day’s is done. I, however, am impatient, and I quickly sought to find a way around the once-a-day limitation.
My instinct told me to turn to Python and code my own solution. My version, WordGame, is not based upon a “word of the day,” but rather, pulls randomly from a bank of five-letter words created by Stanford University with over five thousand possibilities. I even added streak statistics and visualizations to track player performance! With access to my code (look at my Github), players are no longer limited to feeling the satisfaction of finding the correct word only once a day.
The code I created to replicate Wordle may not be the most complex, but doing so allowed me to practice the basics of Python. I was able to refresh my skills with for loops, if/then statements, and defining functions. I also practiced using global vs. local variables at appropriate times and became familiar with the PyEnchant library. This library contains a large portion of all English words and returns a Boolean (True/False) if the guessed string is in the PyEnchant library or not. This was crucial while coding the guessing portion of the game, because an attempt to solve it must include an English word and not a random sequence of five letters. I even got to work with plotting in Python, creating a bar chart with Matplotlib, representing how many attempts each correctly solved word took.
Several versions of Wordle are available across both the web and app stores, created by coders looking to either replicate Wordle, or put their own unique twist on it.
I had fun coding my own unique version, but I have even more fun playing it. I challenge you to check out my code and see how long of a streak you can get!
Columnist: Garrett Watkins