Skip to content

Instantly share code, notes, and snippets.

@mythmon
Created December 6, 2012 04:35
Show Gist options
  • Save mythmon/4221799 to your computer and use it in GitHub Desktop.
Save mythmon/4221799 to your computer and use it in GitHub Desktop.
Squiggleslashsrc
//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(3);
robot.turn(1);
robot.rotateCannon(10);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
};
Robot.prototype.onWallCollision = function(ev) {
ev.robot.back(50);
ev.robot.turn(90);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment