Skip to content

Instantly share code, notes, and snippets.

@whiskers75
Created January 9, 2013 19:30
Show Gist options
  • Save whiskers75/4496077 to your computer and use it in GitHub Desktop.
Save whiskers75/4496077 to your computer and use it in GitHub Desktop.
FightCode bot whiskers75
//whiskers75's FightCode Robot
//Licenced under the GPLv2 or higher
//Forks of this may not battle this robot.
var Robot = function(robot) {
robot.log("whiskers75's robot initialized");
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(45 - robot.life);
robot.turn(90 - robot.life);
robot.log("Idle...");
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
robot.log("Found Robot");
};
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
robot.turn(180); // turn enought to be in a straight
// angle with the wall.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment