Last active
August 22, 2017 15:17
-
-
Save gilad905/bd30b5c3e5dd8c0165fc47c173ac0a54 to your computer and use it in GitHub Desktop.
Ant Queen of the Hill Contest - Debugging Tools
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
| Debugging Tools | |
| --------------- | |
| Some handy functions that you can use for better debugging your answers. | |
| Paste these into the developer tools' console before starting a game (once, not for each game): | |
| // Pauses the game (just like hitting the 'pause' button) | |
| console.pause = function() { | |
| console.log("PAUSE"); | |
| $('#pause').trigger('click'); | |
| }; | |
| // Sets the game step delay to a new value | |
| console.setDelay = function(value) { | |
| console.log("SET DELAY"); | |
| $('#delay').val(value); | |
| $('#delay').trigger('change'); | |
| }; | |
| You can then use them in your answer, e.g: | |
| ... | |
| if (view[4].ant.type == 5 && view[4].ant.food > 10) | |
| console.pause(); | |
| else if (view[4].ant.type == 1 && view[4].color.red) | |
| console.setDelay(1000); | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment