Created
February 7, 2022 13:30
-
-
Save thechriswalker/d88a0ab543414fb8ef0dde405c11afba to your computer and use it in GitHub Desktop.
Wordle Extra Hard Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Turn into a bookmarklet, or user-script or paste into your console. | |
if (!wordle.extraHardMode) { | |
wordle.extraHardMode = true; | |
// toggle hardMode | |
const state = JSON.parse(localStorage.gameState); | |
state.hardMode = true; | |
localStorage.gameState = JSON.stringify(state); | |
const originalEvaluateRow = wordle.bundle.GameApp.prototype.evaluateRow; | |
wordle.bundle.GameApp.prototype.evaluateRow = function extraHardMode() { | |
// force hard extraHardMode | |
this.hardMode = true; | |
// the original code checks that no yellow/green letters are omitted, this code checks that no | |
// known "missing" letters are _used_. | |
const knownAbsentLetters = this.evaluations.flatMap((x,i)=>{ | |
return x ? x.map((y,j)=>{ | |
if (y === 'absent') { | |
return this.boardState[i][j]; | |
} | |
} | |
).filter(Boolean) : []; | |
} | |
); | |
if ([...(this.boardState[this.rowIndex]??"")].some(c=>knownAbsentLetters.indexOf(c) !== -1)) { | |
return this.$board.querySelectorAll("game-row")[this.rowIndex].setAttribute("invalid", ""), | |
void this.addToast("Must not use known absent letters"); | |
} | |
return originalEvaluateRow.call(this); | |
} | |
document.querySelector("game-app").addToast("Extra Hard Mode Enabled.") | |
} | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This adds a check to the hard mode to not only insist that you use the green/yellow letters you have discovered, but also forbids you from using any letters you have ruled out as absent.
The next step is to insist that you don't guess a "yellow" letter in the same spot you have already tried... but that's it little more complex.