Last active
December 26, 2021 03:14
-
-
Save marcus-crane/9d33a830fbea7939daeec6599088f9cb to your computer and use it in GitHub Desktop.
A small devtools sketch for reflecting the Daily Wordle grid as a group of emojis
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
let tiles = [] | |
document.querySelector("game-app").$board.querySelectorAll("game-row").forEach(row => { | |
let rowTiles = [] | |
row.$tiles.forEach(tile => rowTiles.push(tile._state)) | |
tiles.push(rowTiles) | |
}) | |
for (let row of tiles) { | |
let rowString = "" | |
for (let tile of row) { | |
switch (tile) { | |
case 'absent': | |
rowString += '⬛️ ' | |
break | |
case 'present': | |
rowString += '🟨 ' | |
break | |
case 'correct': | |
rowString += '🟩 ' | |
break | |
default: | |
// This will just print nothing for empty tiles | |
break | |
} | |
} | |
if (rowString) { | |
console.log(rowString) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also realised in hindsight that game state probably lives in local storage so here's an even shorter snippet: