Ultra Hard: prevent using letter in a previously grey position (#54)
For example, with a target word of RALLY ([challenge link]), guessing ARRAY gives [elsewhere, elsewhere, absent, absent, correct]. This commit makes guessing SPRAY a violation, as we know that A cannot be in the first or fourth positions (or else one of them would be correct), and R cannot be in the second or third positions. [challenge link]: https://hellowordl.net/?challenge=cmFsbHk
This commit is contained in:
parent
32be1606cf
commit
c56b7ab526
|
@ -77,11 +77,12 @@ export function violation(
|
|||
} else if (clue === Clue.Elsewhere) {
|
||||
if (!guess.includes(letter)) {
|
||||
return "Guess must contain " + upper;
|
||||
} else if (difficulty === Difficulty.UltraHard && guess[i] === letter) {
|
||||
return nth + " letter can't be " + upper;
|
||||
}
|
||||
}
|
||||
if (difficulty === Difficulty.UltraHard) {
|
||||
if (clue !== Clue.Correct && guess[i] === letter) {
|
||||
return nth + " letter can't be " + upper;
|
||||
}
|
||||
const clueCount = clues.filter(
|
||||
(c) => c.letter === letter && c.clue !== Clue.Absent
|
||||
).length;
|
||||
|
|
Loading…
Reference in a new issue