Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The following script works like this:
1. Auto play the game
2. Get all the color elements (<span>) inside the game
3. Push the elements to different arrays based on it's color
– If it's a "red" color, goes to the "red" array
– If it's a "blue" color, goes to the "blue" array
4. Check each of those arrays has only one element, which is the one that
has a different/unique color compared to the others
5. Force a click on this element to move on to the next level
6. Repeat.
// Create a new instance of the click event
var clickEvent = new MouseEvent('click', { 'bubbles': true });
// Select the play-button and dispatch the click event to start the game
// Create a interval to run this script
setInterval(function () {
// object to store our colors
var colors = {};
// select all the <span> elements inside the #box
// we are using the $$, it works only on Chrome and Firefox:
var nodes = $$("#box span");
var color, i;
// Create a loop through our nodes
for (i = 0; node = nodes[i++];) {
// Get the background color of the <span> element
color =;
// Create an empty array on our object using the color as the object key
// but only if it wasn't created yet
if (!colors[color]) {
colors[color] = [];
// We add our <span> node to our just created array
// Loop through our object and check if the length is only 1
for (color in colors) {
// If it is, we stop the loop. We've found the unique color ;)
if (colors[color].length === 1) break;
// Force a click on our element
}, 1);
// go to the website and run this on the console
ev=new MouseEvent('click',{'bubbles': true});document.querySelector(".play-btn").dispatchEvent(ev);
setInterval(function(){ for(i=0,cs={};A=$$("#box span")[i++];) {;if(!cs[c]){cs[c]=[]};cs[c].push(A)};
for(k in cs){ if(cs[k].length === 1) break; }
cs[k][0].dispatchEvent(ev);}, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.