You've arrived on an alien planet. The writing system, the culture and the language there are completely foreign to any language you know. But somehow they are all playing wordle already.
So as a method to learn their language and culture you start playing their version of wordle. Their wordle works a little bit differently than ours. Just like ours it's a guesssing game. There's a secret hidden word which you must guess. The secret word is made of 5 glyphs, and at each step of the game you guess 5 glyphs. The game then highlights each of them either
- \$\mathrm{Black}\$: if that glyph doesn't appear in the word at all.
- \$\color{orange}{\overline{\mathrm{Yellow}}}\$: if that glyph appears in the target word but in a different place.
- \$\color{green}{\underline{\mathrm{Green}}}\$: if that glyph appears in the target word at the same place.
Unlike our wordle there are no special rules for double letters.
Now because you don't know the language all you can do is guess random sequences of glyphs to eventually brute force some information out of the game.
If we look at this example game where I've replaced the alien glyphs with positive numbers for convenience:
$$ \begin{matrix} 1 & 2 & \color{green}{\underline 3} & 4 & 5 \\ 6 & \color{green}{\underline7} & \color{orange}{\overline 8} & \color{green}{\underline 9} & 4 \\ \color{orange}{\overline 0} & 10 &\color{orange}{\overline 7} & \color{green}{\underline9} & 4 \\ \end{matrix} $$
In the first guess we found out \$3\$ was the middle letter and that \$1, 2, 4, 5\$ don't appear in the solution. In the second guess we learned that \$7\$ and \$9\$ are the second and fourth positions respectively. We also learned that \$8\$ appears somewhere, and that \$6\$ doesn't appear anywhere. In the third guess we learned that \$0\$ appears but not in the first position.
At this point since we know that the second, third and fourth positions are occupied \$0\$ must be in the last position. This leaves one position, the first, open for \$8\$. So from this board we know the solution is \$8\,\,7\,\,3\,\,9\,\,0\$.
You don't know how many glyphs are present in the alien language, so you cannot do process of elimination to determine a glyph is in the solution without having a guess containing that glyph.
Task
Given a list of guesses and a list of color responses, determine if the solution can be uniquely determined from the board. Glyphs should be represented by integers, and you may assume they are strictly positive. Other than that you may take input in any reasonable format. For example the colors could be 0 1 2
or B Y G
. You may take the list of guesses and color responses separately or zipped together as a single structure. You may assume that each guess is 5 glyphs long and each response as well.
You should output one of two fixed values if the solution is uniquely determined and the other of the two values if it is not.
This is code-golf so the goal is to minimize your source code as scored in bytes.
Test cases
Test cases are presented as alternating guesses and responses. The guesses are (mostly) single digit numbers for the convenience of formatting, but this should not be assumed.
Responses are in the form of B Y G
for black yellow green respectively.
Ones
Unique solution
5 4 3 2 1
G G G G G
1 2 3 4 5
Y Y G G G
1 2 3 4 5
Y B G B B
6 7 8 9 0
B B Y G G
1 2 3 4 5
B B G G G
6 7 8 9 0
G G B B B
9 3 3 8 4
G G Y Y G
1 2 3 5 6
B Y Y B B
2 2 3 2 1
Y Y G Y Y
4 1 3 1 5
Y Y G Y Y
6 5 3 4 10
B Y G Y B
No unique solution
1 1 1 1 1
1 2 2 2 2
The first value isn't 1, but it could be anything else.
Example solutions: 0 1 1 1 1
, 2 1 1 1 1
1 2 3 4 5
B G G G G
1 6 8 7 9
B B B B B
There is one value missing which could be anything.
Example solutions: 0 2 3 4 5
, 10 2 3 4 5
1 2 3 4 5
Y Y Y Y Y
You know the glyphs in the solution but cannot determine the order.
Example solutions: 5 3 4 2 1
, 5 4 2 3 1
1 2 2 3 4
G G Y Y G
Unlike earth wordle you don't know whether there are 1 or two 2s based on this.
Example solutions: 1 2 3 2 4
, 1 2 3 5 4
This puzzle was inspired by the kilordle wordle variant.
Glyphs should be represented by integers, and you may assume they are strictly positive.
I suggest you change "strictly positive" to "non-negative" for consistency. \$\endgroup\$0
is only 1 character so things line up. If you want to adjust it to your format simply add 1 to every glyph, just like if you want to representBYG
as123
you will have to make that adjustment. \$\endgroup\$[[glyphs 1], [glyphs 2], ...], [[colours 1], [colours 2], ...]
or[[[glyphs 1], [colours 1]], [[glyphs 2], [colours 2]], ...]
, but are we allowed to take it as[[[glyph 1:1, colour 1:1], ..., [glyph 1:5, colour 1:5]], [[glyph 2:1, colour 2:1], ..., [glyph 2:5, colour 2:5]], ...]
(Can we take input "double-zipped" together?) \$\endgroup\$