Skip to content

Instantly share code, notes, and snippets.

@rafaellucio
Created December 11, 2012 17:29
Show Gist options
  • Save rafaellucio/4260476 to your computer and use it in GitHub Desktop.
Save rafaellucio/4260476 to your computer and use it in GitHub Desktop.
Rafael Lucio
//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.turn(360);
robot.back(100);
};
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
console.log(robot.angle);
robot.turn(robot.angle);
robot.stop();
robot.fire(100);
};
Robot.prototype.onHitByBullet = function(ev) {
var robot = ev.robot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment