Skip to content

Instantly share code, notes, and snippets.

@mwclarkson
Created December 3, 2012 20:27
Show Gist options
  • Select an option

  • Save mwclarkson/4197741 to your computer and use it in GitHub Desktop.

Select an option

Save mwclarkson/4197741 to your computer and use it in GitHub Desktop.

Revisions

  1. mwclarkson created this gist Dec 3, 2012.
    26 changes: 26 additions & 0 deletions robot.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@

    //FightCode can only understand your robot
    //if its class is called Robot
    var Robot = function(robot) {

    };

    Robot.prototype.onIdle = function(ev) {
    var robot = ev.robot;
    robot.ahead(100);
    robot.rotateCannon(360);


    };

    Robot.prototype.onScannedRobot = function(ev) {
    var robot = ev.robot;
    robot.stop();
    robot.fire();
    robot.turn(25);
    robot.ahead(50);
    robot.rotateCannon(-30);
    robot.fire();

    };