Created
January 25, 2019 16:36
-
-
Save Abreto/6f9522d4f6d0d5e8354abe878ba7381e to your computer and use it in GitHub Desktop.
game-cheating
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
// cheater for http://www.cuishuai.cc/game/ | |
// use it in console of Chrome DevTools | |
function play() { | |
const box = document.getElementById('box') | |
const girds = box.children | |
const num = box.childElementCount | |
const ref = {} | |
const cnt = {} | |
for (let i = 0; i < num; i++) { | |
const g = girds[i] | |
const bgc = g.style.backgroundColor | |
ref[bgc] = g | |
cnt[bgc] = cnt[bgc] + 1 || 1 | |
} | |
for (let bg in ref) { | |
if (cnt[bg] === 1) { | |
console.log('click', ref[bg]) | |
ref[bg].click() | |
} | |
} | |
} | |
const pc = setInterval(play, 12) | |
// clearInterval(pc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment