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
Implementation of rules is wrong with multiple same letters #1
Comments
Indeed, you're right! I'll fix the rules. The JavaScript code of the original game is obfuscated or something, and is hard to read, but the row state evaluation function goes roughly like this (I reformatted it a bit to be more readable): var e = this.boardState[this.rowIndex], // row to evaluate
a = this.solution, // the answer
s = Array(a.length).fill("absent"), // the state
t = Array(a.length).fill(true),
o = Array(a.length).fill(true)
for (var n = 0; n < e.length; n++) {
if (e[n] === a[n]) {
s[n] = "correct"
t[n] = false
o[n] = false
}
}
for (var i = 0; i < e.length; i++) {
var L = e[i]
if (t[i]) {
for (var j = 0; j < a.length; j++) {
var A = a[j]
if (o[j] && L === A) {
s[i] = "present"
o[j] = false
break
}
}
}
} |
Should be fixed by c6a1411 My example now looks like this: your example: and the "official" one: |
Thanks for fixing it so fast :) |
Here are a couple examples that show some issues with the coloration of the letters.
(screenshot used in Harbour)
In the 3rd line, only one E should be colored to match the number of E in the end word
(from one of my game)
In the 3rd line, the last L shouldn't be colored at all as it's already colored at the right 1st place (and there's no other L in the end word)
For reference, here's a screenshot from the official game that show the validity of my remarks
The text was updated successfully, but these errors were encountered: