Skip to content

Instantly share code, notes, and snippets.

@thinklinux
Last active March 21, 2019 11:01
Show Gist options
  • Save thinklinux/c3d8ea94b7065f778562 to your computer and use it in GitHub Desktop.
Save thinklinux/c3d8ea94b7065f778562 to your computer and use it in GitHub Desktop.
Bot for the eye test game called Kuku Kube
// I little bot that I've made for the game Kuku Kube
// I found 2 bots so far and they were a lot slower than this one :)
// Start the game and paste the code in the browser's console. Hit enter and... don't watch! You can be hypnotized! :D
// You can play (or cheat) the game here http://106.186.25.143/kuku-kube/en-3/
// Have fun!
console.log('I\'m a bot')
var init = function () {
var color_arr = [],
elementsMap = {},
basicColor;
var findBasicColor = function (color) {
if (color_arr.indexOf(color) !== -1) {
basicColor = color;
} else {
color_arr.push(color);
}
}
var findDiffColor = function () {
if (!basicColor) {
return;
}
var len = color_arr.length,
i = 0,
diffItem;
for (i; i<len; i++) {
var color = color_arr[i];
if (color !== basicColor) {
diffItem = elementsMap[color];
break;
}
}
return diffItem || null;
}
var matches = document.querySelectorAll("#box span"),
len = matches.length,
i = 0,
diffItem;
for (i; i<len; i++) {
var item = matches[i];
elementsMap[item.style.background] = item;
findBasicColor(item.style.background);
diffItem = findDiffColor();
if (diffItem) {
$(diffItem).trigger('click');
break;
}
}
}
setInterval(function () {
init();
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment