Skip to content

Instantly share code, notes, and snippets.

@diofeher
Forked from musashix90/robot.js
Created December 3, 2012 17:57
Show Gist options
  • Save diofeher/4196730 to your computer and use it in GitHub Desktop.
Save diofeher/4196730 to your computer and use it in GitHub Desktop.
better robit
//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(90);
robot.turn(80);
robot.rotateCannon(90);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.stop();
robot.fire(3);
robot.fire(5);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment