Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results.
The words in the list will be distinct and so should be the output.
You may assume that for given inputs a solution exists. If there is more than one, you may output any or all of them.
Take your input in any convenient manner: including string of coloured rectangles, string of 3 distinct characters of your choice, array of 3 distinct values, etc. You may output list of words first-to-last or reversed.
You can omit the last row of clues as it will be all "green" or take the target word as the last row if you like. The target word is also optional in the output.
This is code-golf, so shortest answer wins.
input => clues: 00100 00000 11100 01210 22222 or ⬜⬜🟨⬜⬜ ⬜⬜⬜⬜⬜ 🟨🟨🟨⬜⬜ ⬜🟨🟩🟨⬜ 🟩🟩🟩🟩🟩 target: CGOLF words: ABCDE,CGOLF,EDCBA,LOGOS,VLOGS,WORDS,XYZAB output => ABCDE,XYZAB,LOGOS,VLOGS,CGOLF
How does Wordle exactly work?
Taken from @pxeger's related challenge.
In Wordle, you try to guess a secret 5-letter word, and some letters in your guess are highlighted to give you hints.
If you guess a letter which matches the letter in the same position in the secret word, the letter will be highlighted green. For example, if the secret word is
LEMON and you guess
BEACH, then the
E will be highlighted green.
If you guess a letter which is present in the secret word, but not in the correct corresponding position, it will be highlighted yellow.
If a letter appears more times in the guess than it does in the secret word, only upto as many occur in the secret may be highlighted. If any of the occurrences are in the same place, they should be preferentially highlighted green, leaving earlier letters unhighlighted if necessary.
For example, with the secret
LEMON and the guess
SCOOP, the second
O will be green, because it is in the right place, but the first
O will be unhighlighted, because there is only one
O in the secret, and one
O has already been highlighted.
Any of the remaining letters in the secret may be highlighted yellow if they match, as long as the right number are highlighted in total. For example, with the secret
LEMON and the guess
GOOSE, only one of the
Os should be highlighted; it does not matter which.
ABCDE as target and
ABCDE,DECAB,EDCBA,QWERT as words:
clues: 22222 output: ABCDE clues: 11211 11211 22222 output: DECAB,EDCBA,ABCDE or EDCBA,DECAB,ABCDE clues: 00100 22222 output: QWERT,ABCDE
GOOSE as target and
GOOSE,LEMON,SCOOP as words:
clues: 01010 10210 22222 output: LEMON,SCOOP,GOOSE