Solving wordle efficiently (for humans and for computers) is all the rage right now.
One particular way of solving a wordle made me curious. The idea is to select 5 words that have distinct letters so you'll end up with 25 characters. If you use these 5 words as your first 5 guesses in the game, you'll have a close to 100% chance of getting the correct word in your last guess (it's essentially an anagram of all the clues and you'll probably have a few green ones). There is a set of words that is suggested (all of the words are valid English words):
- brick
- glent
- jumpy
- vozhd
- waqfs
But this made me wonder: How many of these 5 word combinations are out there and I started whipping up a recursive algorithm but I am close to giving up.
My initial thought was:
- Start with the first word
- reduce overlapping words from the word list
- pick the next remaining word in the word list
- Repeat with the next word
But this only really works if you have a set of five distinct words in order.
For this list:
- brick
- feast
- glent
- jumpy
- vozhd
- waqfs
I will end up with: [brick, feast, jumpy, vozhd]
because feast
comes before glent
and will filter it out but in the end glent
would have been the better pick.
I wasn't able to find any algorithms for this specific problem so I was wondering if there is any existing algorithm that can be applied to this?