2048.mx auto sequence
random or sequence keys for 2048.mx
by Laurens Maneschijn
HTML
<a href="http://2048.mx" target="_blank">http://2048.mx</a> run script below in javascript console of linked page
JavaScript
window.requestAnimationFrame(function () {
window.manager = new GameManager(4, KeyboardInputManager, HTMLActuator);
});
function rand(min,max){
return min + Math.floor(Math.random()*(max-min));
}
window.sequence = [0,1,2,3]; // up,right,down,left
window.sequence = [2,3,2,3,2,3,2,3,2,3,2,3,1];
window.sequence = [2,3,2,1,2,3,2,1,2,3,2,1,0];
window.sequence = [2,3,2,1];
window.cnt = 0;
// 2,3,2,1 : this seems to work best, often around 5000-7000 at max 512
if(window.myinterval){clearInterval(window.myinterval);}
window.myinterval = setInterval(function(){
// window.manager.inputManager.emit('move',rand(0,4));
window.manager.inputManager.emit('move', window.sequence[window.cnt % window.sequence.length] );
window.cnt++;
}, 10);