Skip to content

Instantly share code, notes, and snippets.

@guillaumepotier
Created December 6, 2012 20:12
Show Gist options
  • Save guillaumepotier/4227906 to your computer and use it in GitHub Desktop.
Save guillaumepotier/4227906 to your computer and use it in GitHub Desktop.
CoBaLt
//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;
for(var i = 0; i <= 10; i++) {
robot.ahead(20*i);
robot.rotateCannon(10*10);
robot.back(5*10);
robot.rotateCannon(5*10);
robot.turn(90*(i%2));
}
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment