octokatherine / word-master

A Mastermind-like word guessing game
MIT License
381 stars 240 forks source link

If the same letter appears twice in a guess, only the first occurrence is colored green or yellow #133

Closed vmenkov closed 2 years ago

vmenkov commented 2 years ago

Suppose the secret word is FLAIR, and the player enters RALLY as his guess. The letter L is present in the secret word, but neither of the two occurrences of that letter in the guess is in the right position. So, logically, both Ls in RALLY should appear in yellow. However, it is not the case: I see the first L (position 3 in the guess word) as yellow, but the second one (position 4) as blue!

Screenshot from 2022-03-14 00-57-56

Similarly, in the following example MOORS or BLOOM in the example above, only the first O is shown as green or yellow the second one is blue, although yellow would make more sense.

Screenshot from 2022-03-14 01-22-57

octokatherine commented 2 years ago

This is intentional. It originally behaved where both letters would be yellow, but that confused people by making them think it appeared twice in the answer.