Created
March 11, 2014 13:48
-
-
Save roman-zaharenkov/9485974 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix for the
GameManager
constructor 😄