Skip to content

Instantly share code, notes, and snippets.

@timmc
Last active January 29, 2022 13:25
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 timmc/c80e7e998269bb5adc3dd117912131ae to your computer and use it in GitHub Desktop.
Save timmc/c80e7e998269bb5adc3dd117912131ae to your computer and use it in GitHub Desktop.
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);
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