Getting a Highscore in Kuku Kube First of all, this is more a challenge, than a serious programming question, I would like to share.

Some of you might know the game Kuku kube, where you have to identify a square in a grid, which has a different colour than the others and click it.

You can find it under http://kuku-kube.com/ .

As this seems to be an ideal exercise for our image processing students, I want to see, which way is the best to get the highest score.

My code so far:

from pymouse import PyMouse
import time
b=time.time()
m=PyMouse()
start=(2912,895)
tl=(2695,387)
br=(3129,814)
def click():
    m.click(start[0],start[1])
    time.sleep(0.1)
    while time.time()-b&lt;60:
        for i in range(0,9):
            for l in range(0,9):
                m.click(2696+i*53.625,390+l*53.125)
                time.sleep(0.004)

click()


gets me to about 370-ish. Is it possible to get more? Use image processing?

High-score wins!
Javascript (Cheating), Score = limitless?

I realized that the game timer was using setInterval, which is a very unreliable way of keeping time.  With that in mind, since js is single threaded, if we simply hog the thread, the timer can't update.  As a result, you can essentially get any score you want.  If you perform 1000 clicks in a single function call without releasing the thread, you guarantee a score of at least 60000 (in fact I did this and got 180000).  This is obviously cheating because the game lasts longer than 60 seconds, though the game doesn't realize it.  For this reason, any js solution at all is really sort of cheating.  Though the time increase is minimal for code that completes quickly, you can still potentially delay the timer for as long as your code runs.

var factor = 1000;

function findAndClick() {
  var array = document.getElementById("box").children;

  for(var j = 0; j &lt; factor; j++){
      var one = array[0].style.cssText;
      var two = array[1].style.cssText;

      var color;
      if(one != two){
        color = array[2].style.cssText;
      } else {
        color = one;
      }

      for (var i=0; i &lt; array.length; i++) {
        if (array[i].style.cssText != color) {
          array[i].click();
          break;
        }
      }
    }
}
$(".play-btn").click();
setInterval(findAndClick, 0);


Javascript (REALLY Cheating), Score = limitless?

The game's object is actually global.  As a result, you can tweak various properties to your advantage.  The easiest of which is to just set your score to whatever you want it to be:

$(".play-btn").click();
Game.lv = 1000000;