Skip to content

Instantly share code, notes, and snippets.

@Ghabriel
Forked from mwclarkson/robot.js
Created December 4, 2012 19:32
Show Gist options
  • Save Ghabriel/4207804 to your computer and use it in GitHub Desktop.
Save Ghabriel/4207804 to your computer and use it in GitHub Desktop.
Out Of Cheese Error v2.0
//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(90);
robot.turn(80);
robot.rotateCannon(90);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.stop();
robot.fire(3);
robot.fire(5);
robot.rotateCannon(-30);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment