When Wordle became popular, I saw it as more than just a fun little puzzle, but as a challenge to create as optimized an algorithm as possible to solve the puzzle.

It’s a fairly simple algorithm – it’ll build a list of every five letter words, and score them based on the frequency of each letter in the word (for example, the letter “e” is the most common letter and so has the highest score).

After each guess, it’ll filter out any words that have letters that stay gray, keep only words which have letters matching the green letters set, and then for the yellow letters keep all words that contain that letter in general.

It’s possible for a word to slip through the cracks, by having common enough letters so that there’s a larger list of possible words, but also not so common so that it’s obvious what the word is. That said, I’ll usually solve the Wordle before seeing how the algorithm performs and more often than not it beats me and guesses the word in fewer guesses.

* As a side note, it has a much larger dictionary than the Wordle dictionary, which doesn’t seem to include all English words. So when I check THAT bot, it will believe that real words aren’t possible solutions and tell me my guess was bad since it isn’t possible… hm. Interesting. And wrong.

It’s on my CodePen, so check it out!