Summary
I was playing a web based Wordle battle royale game called squabble.me. After playing for a little bit, I decided to start on this project, because I thought it would be interesting to write something to solve Wordle puzzles.
I began by writing the game in Python. This version of Wordle is a text based version of the popular game. The game can be initialized so that you have a random word, an assigned word, or an unknown word. The unknown word mode was developed with squabble.me or the daily Wordle in mind.
After writing the game, I started to work on a solver that would solve a puzzle quickly. I considered taking an approach that would examine all of the possibilities for each word, but running that on my laptop took a very long time to run, which was not ideal for squabble.me, as the game is very fast paced. To give some perspective, the method I was pursuing was examining a large conditional statement 243 times for each word in the dataset (12,972). Considering each word took around 4 seconds on my laptop, so it would take about 14 hours and 25 minutes to make the first guess. The method I settled on is based on frequencies of letters given with respect to the index and current wordbank. The algorithm quantifies a guess from the eligible word pool by computing two times the amount that the letter is green (an exact match) plus how many times the letter is yellow (contained in the word, but not an exact match) with respect to the current eligible wordbank. This method runs much faster, while still guessing with a decent average guess amount of 4.2849 when the word was correctly guessed and a success rate of 88.79%.
The most difficult part of the project was the method to narrow the word pool down based on the guess and the information provided by the guess. The way I did it was looped over all words in the set and compared them to the information and guess in a single if statement that checks if the word should be added to the set of new words.
Feel free to use my code to play squabble.me or to cheat on your daily Wordle. The code is linked below ina GitHub repository.

Log in or sign up for Devpost to join the conversation.