Last active
January 29, 2022 13:25
-
-
Save timmc/c80e7e998269bb5adc3dd117912131ae to your computer and use it in GitHub Desktop.
Create score output for https://qntm.org/files/wordle/index.html and https://powerlanguage.co.uk/wordle/
This file contains hidden or 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
var letters = [...document.getElementsByTagName('table')[0].textContent]; | |
var emoji = {'wrong':'β', 'inexact':'π', 'exact':'π'}; | |
var cellClass = 'absurdle__guess-box'; | |
function getEmoji(node) { | |
var cl = [...node.classList].filter(e => e.startsWith(cellClass + '--'))[0]; | |
return emoji[cl.replace(cellClass + '--', '')]; | |
} | |
var icons = [...document.querySelectorAll('td.' + cellClass)].map(getEmoji); | |
var out = ""; | |
while (letters.length > 0) { | |
out += icons.splice(0, 5).join('') + ' ' + letters.splice(0, 5).join('') + '\n'; | |
} | |
console.log(out); |
This file contains hidden or 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
var data = JSON.parse(localStorage.gameState); | |
var words = data.boardState.filter(x => x).map(w => w.replaceAll(/./g, l => String.fromCharCode((l.charCodeAt(0) - 97 + 13) % 26 + 97))); | |
words.splice(-1, 1, ''); | |
var emojis = data.evaluations.filter(x => x).map(es => es.map(e => ({'absent':'β', 'present':'π', 'correct':'π'})[e]).join('')); | |
console.log(words.map((w, i) => emojis[i] + ' ' + w).join('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment