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

fix: Error with duplicate letters #12

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

DenverCoder1
Copy link
Contributor

@DenverCoder1 DenverCoder1 commented Feb 7, 2022

Although it was attempted to be fixed by an earlier commit (#7), it is still incorrect

Previously, if the guess contains duplicate letters, letters in the wrong spot could appear yellow even if there is only 1 occurrence in the word.

Example:

If the answer is "THOSE", if a player were to guess the word "GEESE", the algorithm above would produce the colors:

image

This would imply that the correct answer has one E's in the wrong location and one E in the correct location (a total of two E's).

The result should, however, only show 1 E being in the word:

image

Another example:

If the answer is "DREAD", and "ADDED" is guessed, the result produced would be:

'YELLOW', 'YELLOW', 'YELLOW', 'YELLOW', 'GREEN'

This implies no letters are missing, but in fact, one of the D's is wrong and the R is missing. Only one of the wrongly placed D's should be marked Yellow.

'YELLOW', 'YELLOW', 'GRAY', 'YELLOW', 'GREEN'


The change I've made to the code accounts for these duplicates and produces results similar to the original Wordle.

Although it was attempted to be fixed by an earlier commit, it is still incorrect
@burkeholland burkeholland merged commit 5f3fb94 into burkeholland:master Feb 9, 2022
@burkeholland
Copy link
Owner

thank you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants