Skip to content

Instantly share code, notes, and snippets.

@thinklinux
Last active March 21, 2019 11:01

Revisions

  1. thinklinux revised this gist Mar 21, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion KukuKubeBot.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // 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 hypnotize! :D
    // 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!

  2. thinklinux renamed this gist Apr 11, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. thinklinux revised this gist Apr 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion KukuKubeBot
    Original file line number Diff line number Diff line change
    @@ -61,4 +61,4 @@

    setInterval(function () {
    init();
    }, 1);
    }, 0);
  4. thinklinux created this gist Apr 11, 2015.
    64 changes: 64 additions & 0 deletions KukuKubeBot
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    // 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 hypnotize! :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();
    }, 1);