Skip to content

Instantly share code, notes, and snippets.

@tajchert
Created December 4, 2012 20:48
Show Gist options
  • Save tajchert/4208508 to your computer and use it in GitHub Desktop.
Save tajchert/4208508 to your computer and use it in GitHub Desktop.
RUSH, RUSH
//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.turn(360);
robot.ahead(10);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
robot.ahead(100);
robot.fire();
};
Robot.prototype.onRobotCollision = function(ev) {
robot.back(10);
robot.turn(-10);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment