Skip to content

Instantly share code, notes, and snippets.

@wacaw
Created December 4, 2012 14:37
Show Gist options
  • Save wacaw/4204589 to your computer and use it in GitHub Desktop.
Save wacaw/4204589 to your computer and use it in GitHub Desktop.
lol
//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.back(200);
robot.rotateCannon(360);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
};
Robot.prototype.onHitByBullet = function(ev) {
var robot;
robot = ev.robot;
robot.turn(90 - ev.bulletBearing);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment