Before starting at the MSA this spring, I had no experience in programming. I learn best through jumping in and tackling projects, so when I thought about creating something to beat Wordle, I knew it would be the perfect way for me to start learning Python.
Use this link to see my project in GitHub.
Wordle is a five-letter word guessing game where you get six attempts to guess the correct word. There are three “feedback types” for each letter in a guess: green, yellow, or black (I have changed black to blue for viewing ability):
- Green indicates the letter is in the answer and in the correct position
- Yellow indicates it is in the answer but not in the correct position, and
- Black (blue) indicates it is not in the answer
This screenshot walks through a single game with two wrong guesses, “sores” and “geode,” and the solution being “oxide.”
Word suggestions are generated by ranking each word in the list of possible guesses based on the frequency of letters given their position.
For example, if there were only three possible guesses left [‘hello,’ ‘crane,’ ‘haste’], a word starting with ‘h’ should be suggested as ‘h’ occurs more frequently in the first position than ‘c.’
It is not as simple as this because some letters in other positions might weigh heavier than the first, but that is the general premise. The guess list is continually parsed down based on the information learned from each guess. In the future, I plan to incorporate more ranking metrics for the word suggestions to make it less reliant on position. While I chose positional frequency for ranking, there are many other theories and methods on the internet for best first guesses and even ranking guesses 2-6. These are two other methods: wordplay and NYT bot.
This was a challenging project that enabled me to learn about loop control, functions, call-backs, and many other crucial parts of Python programming. My next project is creating a website, so anyone can play my word game against my solver bot or use the bot as an aid in the official Wordle game.
Columnist: Noah Sundberg