Skip to content

Instantly share code, notes, and snippets.

@Abreto
Created January 25, 2019 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abreto/6f9522d4f6d0d5e8354abe878ba7381e to your computer and use it in GitHub Desktop.
Save Abreto/6f9522d4f6d0d5e8354abe878ba7381e to your computer and use it in GitHub Desktop.
game-cheating
// 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