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.

Revisions

  1. gilad905 revised this gist Aug 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Debugging Tools
    Ant Queen of the Hill Contest - Debugging Tools
    ---------------

    Some handy functions that you can use for better debugging your answers.
  2. gilad905 revised this gist Aug 22, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ 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):
    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() {
    @@ -20,6 +20,7 @@ Paste these into the developer tools' console before starting a game (once, not


    You can then use them in your answer, e.g:

    ...
    if (view[4].ant.type == 5 && view[4].ant.food > 10)
    console.pause();
  3. gilad905 revised this gist Aug 22, 2017. 1 changed file with 18 additions and 17 deletions.
    35 changes: 18 additions & 17 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,26 +2,27 @@ 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');
    };
    // 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');
    };
    // 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);
    ...
    ...
    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);
    ...
  4. gilad905 renamed this gist Aug 22, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. gilad905 created this gist Aug 22, 2017.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    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);
    ...