Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misplaced letters are highlighted even when already placed #2

Closed
nate-anderson opened this issue Feb 3, 2022 · 1 comment
Closed

Comments

@nate-anderson
Copy link

nate-anderson commented Feb 3, 2022

If a guess contains the same letter twice, and one instance of the letter is in the correct place, the other letter should only be highlighted yellow if that letter does, in fact, appear twice in the target word.

For example, if the target word is "SMILY" and a user guesses "SKILL", the first L should be highlighted green and the second should not be highlighted at all.

Attached is an example from Powerlanguage's implementation demonstrating specified behavior, and a screenshot of the bug in this program. Notice the first "T" in "TRIST" is not highlighted yellow.

Screenshot_20220202-170658_Firefox Beta

image

@AshishShenoy
Copy link
Owner

AshishShenoy commented Feb 3, 2022

You're right. I knew there was an issue but couldn't figure out what it was.
I guess the logic needs two rounds of comparisons between guess_word and selected_word, one to mark all green characters and then one to mark yellow characters if the corresponding index hasn't already been marked green.

You interested in doing the pull request for this issue?

AshishShenoy added a commit that referenced this issue Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants