It starts of easy, with just a few squares and an significant difference between the colors. But as you play it quickly gets harder. The number of squares increase and the difference in color decrease. After just a few successful clicks there is only a small difference in hue between one square and all the other squares in the grid.
After giving it a few tries I came up with the idea of writing a script that automatically plays the game. The plan was to see what kind of score a perfect player would get compare to the scores we got when we played ourselves.
A few minutes later the first version of the script was ready. The scripts algorithm was designed to as quickly as possible identify a uniquely colored square and then click on it. This is done by inspecting the color of the squares one by one until the script have seen two different colors, where one color has been seen only once and the other has been seen at least twice.
Since the game always only contains two colors we assume that if a color has been seen twice it is not the unique color. Therefor a square of another color that has only been seen once has to be unique. This assumption lets us avoid looking at every square before we can find the unique one.
After each click the script sleeps 10 ms to let the game load a new set of squares. This also lets the game timer work (almost) normal.
Below follows the code for the script. It can also be found on Github.
So there we have it; a somewhat worthless piece of code that automatically play a browser game that’s probably gone again in a few days. But it was a fun lunch break challenge and a way for me to clear my mind of my other work projects for a few minutes.
And one last thing. Try beating it yourself, if you can: