Skip to content

Instantly share code, notes, and snippets.

@wanderr
Created December 4, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanderr/4200615 to your computer and use it in GitHub Desktop.
Save wanderr/4200615 to your computer and use it in GitHub Desktop.
SPAM
//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(5);
robot.rotateCannon(5);
robot.fire();
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.fire();
};
// this method gets called whenever we hit a wall...
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
robot.turn(20);
robot.ahead(10);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment