Skip to content

Instantly share code, notes, and snippets.

@therealbenpai
Last active January 3, 2023 12:46
Show Gist options
  • Save therealbenpai/717fc10303f8d6d1f391b226f5aba528 to your computer and use it in GitHub Desktop.
Save therealbenpai/717fc10303f8d6d1f391b226f5aba528 to your computer and use it in GitHub Desktop.
Wordle Exploit

Wordle Game Solver Script

Note: You require to be on a PC for this to work

  1. Go to the Wordle Game
  2. Press Ctrl+Shift+I
  3. Go to the tab labeled "Console"
  4. Copy the code from here and paste it, then press enter
  5. A popup will appear confirming if you want to run the code. If so, accept it. Otherwise, cancel it. Directions will be provided afterwords

This project is completely open source and this bug may be patched when you try to use it.

This was descovered by me on January 1st of 2022.

The code was created in Febuary 19th of 2022.

The code was last updated on January 3rd of 2023.

// Cheat Class
class Cheat {
constructor() {
}
static gameSolver() {
if (!location.host.includes("nytimes")) {return}
const wordleJSON = JSON.parse(localStorage.getItem('nyt-wordle-state'))
const wordleSolution = wordleJSON.solution
const time = Date.now()
const wordleGameState = {
"boardState": [
wordleSolution,
"",
"",
"",
"",
""
],
"evaluations": [
[
"correct",
"correct",
"correct",
"correct",
"correct"
],
null,
null,
null,
null,
null
],
"rowIndex": 1,
"solution": wordleSolution,
"gameStatus": "WIN",
"lastPlayedTs": time,
"lastCompletedTs": time,
"restoringFromLocalStorage": null,
"hardMode": false
}
return wordleGameState;
}
static addGameStreak() {
if (!location.host.includes("nytimes")) {return}
const wordleOldStats = JSON.parse(localStorage.getItem('nyt-wordle-statistics'))
const wordleStats = {
"currentStreak": wordleOldStats.currentStreak + 1,
"maxStreak": wordleOldStats.maxStreak + 1,
"guesses": {
"1": wordleOldStats.guesses[1] + 1,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"fail": 0
},
"winPercentage": 100,
"gamesPlayed": wordleOldStats.guesses[1] + 1,
"gamesWon": wordleOldStats.gamesWon + 1,
"averageGuesses": 1
}
return wordleStats;
}
static newGameStreak() {
if (!location.host.includes("nytimes")) {return}
const wordleStats = {
"currentStreak": 1,
"maxStreak": 1,
"guesses": {
"1": 1,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"fail": 0
},
"winPercentage": 100,
"gamesPlayed": 1,
"gamesWon": 1,
"averageGuesses": 1
}
return wordleStats;
}
static setStreak() {
if (!location.host.includes("nytimes")) {return}
const valid = localStorage.getItem('nyt-wordle-statistics')
if (typeof valid === "object") {
return this.newGameStreak()
} else if (typeof valid === "string") {
return this.addGameStreak()
} else {
throw new Error("Failed to set the streak in the existance check")
}
}
static set(m) {
if (!location.host.includes("nytimes")) {return}
if (m > 3 || m < 1) {
throw new Error("incorrect m value")
}
switch (m) {
case 1:
localStorage.setItem('nyt-wordle-state', JSON.stringify(this.gameSolver()))
break;
case 2:
localStorage.setItem('nyt-wordle-statistics', JSON.stringify(this.setStreak()))
break;
case 3:
localStorage.setItem('nyt-wordle-state', JSON.stringify(this.gameSolver()))
localStorage.setItem('nyt-wordle-statistics', JSON.stringify(this.setStreak()))
break;
}
console.log('%cSucsess', 'color:green;')
}
}
const firstLoad = () => {
const confirmation = confirm("This script will automatically solve the game for you. Continuing will permanently change your game statistics. Are you sure you want to continue?")
if (!confirmation) return alert("Script aborted")
alert("Hello! This is an automatic game solver for the New York Times Wordle game created on GitHub by sparty182020. This is currently only available on the nytimes version of Wordle. Once running this script, please refresh your browser and confirm that it has worked")
Cheat.set(3)
alert("Script finished. Please refresh your browser to see the changes")
}
firstLoad()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment