The Wordle Dictionary Lookup
Wordle
The Popular Word Guessing Game of Covid and Twitter
Wordle was based off a TV show from the 80s and has become popular on Twitter in the past few months. The game is simple, you have 6 tries to guess the word of the day. 5 letters long and only correct letters are told after you guess. If the letter is green, its in the right spot. If the letter is yellow, its in the word. Otherwise, the letter isn't in the word - and guesses have to be scrabble approved words.
Why am I posting about this? Well I've had some downtime between projects and decided to make a Wordle Dictionary that takes your guess and shows you what words are possible based on your hints. I started coding this in python and realized I'd need to brush up on my HTML and CSS to make it look half decent on here. Right now the python applet works locally and I'm working on the flask framework to put it up on my site. Check out the python script on github here: WordleDictionary and see the snippet below
Basically, the app walks through the solution list from PowerLanguage's Wordle site and does four things.
1) Checks your inputs are vaild
2) Searches through the solutions list words for matching letters in the same index as your green letters
3) Searches through those words from 2 for words that contain yellow letters
4) Removes words that have excluded letters in them
Currently, the script take about 450-500 ms to complete. There are a few ways I can increase the efficiency of the script. One, change the green search method so that it removes non-fitting words from the potential word list so that it is exponentially shorter each search - the same with yellow search. Two, restructure the order to run the exclude list first, such that the green and yellow searches are shorter lists to start. Third, optimize lists, dictionaries, sets, etc into different formats that could run faster.