Last active
April 16, 2023 13:16
-
-
Save Nekall/3b9661cbe429293ba3755d70c20db12e to your computer and use it in GitHub Desktop.
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
// 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