Skip to content

Instantly share code, notes, and snippets.

@thechriswalker
Created February 7, 2022 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thechriswalker/d88a0ab543414fb8ef0dde405c11afba to your computer and use it in GitHub Desktop.
Save thechriswalker/d88a0ab543414fb8ef0dde405c11afba to your computer and use it in GitHub Desktop.
Wordle Extra Hard Mode
// 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.")
}
;
@thechriswalker
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment