-
-
Save ivan-leschinsky/5bbe7e5f01795559ffe5fa1cf2187f4a 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; | |
| maxReach = 512; | |
| while (max < maxReach) { | |
| manager = new GameManager(4, KeyboardInputManager, FakeActuator, LocalStorageManager) | |
| 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