Gilad 905
2017-08-22T15:15:27Z

gistfile1.md

Ant Queen of the Hill Contest - 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);
...