Skip to content

Instantly share code, notes, and snippets.

@roman-zaharenkov
Created March 11, 2014 13:48
Show Gist options
  • Save roman-zaharenkov/9485974 to your computer and use it in GitHub Desktop.
Save roman-zaharenkov/9485974 to your computer and use it in GitHub Desktop.
// Bot for http://gabrielecirulli.github.io/2048/
FakeActuator = function() {}
FakeActuator.prototype.actuate = function () {
}
score = 0;
max = 0;
while (max < 1024) {
manager = new GameManager(4, KeyboardInputManager, FakeActuator)
move = 0;
while (!manager.over) {
manager.move(move);
move = (move + 1) % 4;
}
max = 0;
for (var i in manager.grid.cells) {
var row = manager.grid.cells[i];
for (var j in row) {
cell = row[j];
if (cell.value > max) {
max = cell.value;
}
}
}
console.log(max);
}
manager.actuator = new HTMLActuator
manager.actuate()
@ivan-leschinsky
Copy link

ivan-leschinsky commented Mar 16, 2018

Fix for the GameManager constructor 😄

manager = new GameManager(4, KeyboardInputManager, FakeActuator, LocalStorageManager)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment