Giant 2048 clone hack

Recently my brother has been addicted to the game 9007199254740992, a giant clone of the popular 2048. After developing mild RSI from playing this for hours on end, he asked me if I could write something that would play it automatically while he sat back and got on with more important things like smoking cigarettes and drinking coffee.

After a bit of scraping round inside the code we came up with the following hack that will get your scores soaring in no time.

Instructions:

  1. Follow the link to the game http://www.csie.ntu.edu.tw/~b01902112/9007199254740992/

  2. Open the JavaScript console, paste in the following code, then press return:

var directionIsLeft = true;  
var currEmptyCellsCount;  
var prevEmptyCellsCount;  
var emptyCellsSameCounter = 0;  
var cycleCounter = 0;

function cycle() {  
  //0: up, 1: right, 2:down, 3: left
  GM.move(0);
  GM.move(directionIsLeft ? 3 : 1);

  currEmptyCellsCount = GM.grid.availableCells().length;

  if(currEmptyCellsCount === prevEmptyCellsCount){

    if(emptyCellsSameCounter >= 5) {
      directionIsLeft = !directionIsLeft;
    }

    emptyCellsSameCounter++;
  }

  prevEmptyCellsCount = currEmptyCellsCount;
}

var cycleInterval = setInterval(cycle, 1);  
  1. To stop it from cycling paste in the following code and press return:
clearInterval(cycleInterval);  

Now leave it running over night and see that score rack up!