r/pythonhelp • u/matthewfelgate • Jan 08 '22
Let's Solve Wordle
There is a game called Worlde where you have to guess the 5 letter word. I want to know if you can solve it for every answer after 3 guesses (so on your fourth guess).
There are 2315 possible answer words.
There are 12972 words you can use to guess.
Every guess gives you information on each letter:
Letter does not exist in word.
Letter exists but not in correct place.
Letter correct and in correct place.
My intuition tells me an algorithm should be able to know the word after 3 guesses every time.
But I'm not sure how to program it. Any ideas?
-----------------------
My thoughts are: you go through each possible starting word:
And for each answer, there will be a set of other possible answers.
So see if, with 2 additional guesses, you can always uniquely identify each of these possible other answers. So with a 2nd guess word, followed by a 3rd guess word, depending on the information gathered from the 2nd guess word.
So see if there is a 1st guess that, combined with 2nd and 3rd guesses you can always uniquely identify the Answer.
1
u/gwn81 Jan 08 '22
Not sure if you're just doing this for practice, but it's already been done https://github.com/yotam-gafni/wordle_solver
Worst-case performance, it needs 8 guesses to win, so it doesn't always win and there may be room for improvement, but it could be a good start/hint at least