Skip to content

Instantly share code, notes, and snippets.

@mauroreisvieira
Last active February 28, 2019 20:33
Show Gist options
  • Save mauroreisvieira/faa012258a538ce47c6ce5aa2e932537 to your computer and use it in GitHub Desktop.
Save mauroreisvieira/faa012258a538ce47c6ce5aa2e932537 to your computer and use it in GitHub Desktop.
Hack Memory Game
/**
* HACK MEMROY GAME
*
* 1º - Open the Link: http://artycoder.mistycreates.com/memory-game/
* 2º - Open the Chrome Dev Tools
* 3º - Paste the this code
* 4º - Magic happens
*/
function playGame(duration) {
const time = setInterval(() => {
const card = document.querySelector('.card:not(.match)');
if (card) {
const nextCard = document.querySelectorAll(`[data-name="${card.dataset.name}"]`)[1];
card.children[0].click();
nextCard.children[0].click();
} else {
console.log('%cCongratulations you WIN!', 'font-size: 20px; color: green');
clearInterval(time);
}
}, 100);
}
playGame(100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment