Last active
February 28, 2019 20:33
-
-
Save mauroreisvieira/faa012258a538ce47c6ce5aa2e932537 to your computer and use it in GitHub Desktop.
Hack Memory Game
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
/** | |
* 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