Skip to content

Instantly share code, notes, and snippets.

@plagelao
Created December 5, 2012 16:45
Show Gist options
  • Save plagelao/4217279 to your computer and use it in GitHub Desktop.
Save plagelao/4217279 to your computer and use it in GitHub Desktop.
plagebot
//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(1)
robot.clone()
};
Robot.prototype.onWallCollision = function(ev) {
};
Robot.prototype.onScannedRobot = function(ev) {
var scannedRobot = ev.scannedRobot;
var robot = ev.robot;
if (scannedRobot.parentId == null) {
robot.fire();
robot.turn(-25);
robot.rotateCannon(10);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment