Last active
August 29, 2015 13:57
-
-
Save malleor/9513275 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
function play(iteration) { | |
var ctrl = { | |
up: function() { window.gm.inputManager.emit('move', 0); return window.gm.moved; }, | |
right: function() { window.gm.inputManager.emit('move', 1); return window.gm.moved; }, | |
down: function() { window.gm.inputManager.emit('move', 2); return window.gm.moved; }, | |
left: function() { window.gm.inputManager.emit('move', 3); return window.gm.moved; } | |
}; | |
while(!window.gm.over && !window.gm.won) { | |
if(!iteration(ctrl)) { | |
break; | |
} | |
} | |
} | |
function start() { | |
window.gm.restart(); | |
} | |
window.gm = new GameManager(4, KeyboardInputManager, HTMLActuator, LocalScoreManager); |
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
play(function(ctrl) { | |
return ctrl.up() || ctrl.left() || ctrl.up() || ctrl.right(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment