Skip to content

Instantly share code, notes, and snippets.

@Nekall
Last active April 16, 2023 13:16
Show Gist options
  • Save Nekall/3b9661cbe429293ba3755d70c20db12e to your computer and use it in GitHub Desktop.
Save Nekall/3b9661cbe429293ba3755d70c20db12e to your computer and use it in GitHub Desktop.
// Hack for https://memory-game-elieb77.vercel.app/
// Just copy and paste the code into the console after clicking on "Play".
console.clear()
console.info("Neka Hack2000 - Memory Game init....");
let cards = document.querySelectorAll("div[class^='styles___card__']");
let backCards = document.querySelectorAll("div[class^='styles___back']");
let imagesUrls = [];
let identifications = [];
console.info("Card identifications....");
for(let card of backCards){
imagesUrls.push(card.children[0].src);
}
console.info("Data extraction....");
for(let imgUrl of imagesUrls){
let first = imagesUrls.indexOf(imgUrl);
let second = imagesUrls.lastIndexOf(imgUrl);
identifications.push([first, second]);
}
console.info("Peer identification....");
const flattenedID = identifications.flatMap(n => n);
const unique = new Set(flattenedID);
console.info("Solving the puzzle in progress...")
let timer = 0;
for(let id of unique){
setTimeout(()=> {
cards[id].click();
}, timer);
timer+=2000;
}
console.info("Solving the puzzle completed.");
console.info("Thank you for using Neka Hack2000 service.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment