3 ms·
If you're using Chrome, this should save you some time: function step() { var eventObj = document.createEvent("Events"); eventObj.initEvent("keyd
by danielsamuels 13y ago
If you're using Chrome, this should save you some time:
function step() {
var eventObj = document.createEvent("Events");
eventObj.initEvent("keydown", true, true);
eventObj.which = 37 + Math.floor(Math.random(0, 1)*3);
document.dispatchEvent(eventObj);
}
int = setInterval(step, 0.001);
- trothamel 13y agoHuh. After a few minutes of this, it told me the only way to win was not to play the game.
- rapsnoj 13y agoYeah, the sum of the numbers on the board goes up by at most four each turn.
- goldbeck 13y agoThis never presses the down key. A small correction so it'll move randomly in all directions function step() { var eventObj = document.createEvent("Events"); eventObj.initEvent("keydown", true, true); eventObj.which = 37 + Math.floor(Math.random(0, 1)*4); document.dispatchEvent(eventObj); } int = setInterval(step, 0.001);
- gracenotes 13y agoBased on comments from the 2048 thread, I'm running a deterministic variant of this which just cycles Left, Down, Right, Down. After an hour or so, the largest tile is 524288, 2^19: http://i.imgur.com/Yk758sx.png http://i.imgur.com/Yk758sx.png While I was writing this comment, it collapsed down to the next largest tile, 1048576, 2^20: http://i.imgur.com/PVPCvUC.png http://i.imgur.com/PVPCvUC.png
- saganus 13y agoAnd I thought I went too far with 32k...