Skip to content

Instantly share code, notes, and snippets.

@gilad905
Last active August 22, 2017 15:17
Show Gist options
  • Select an option

  • Save gilad905/bd30b5c3e5dd8c0165fc47c173ac0a54 to your computer and use it in GitHub Desktop.

Select an option

Save gilad905/bd30b5c3e5dd8c0165fc47c173ac0a54 to your computer and use it in GitHub Desktop.
Ant Queen of the Hill Contest - Debugging Tools

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