Skip to content

Instantly share code, notes, and snippets.

@clouder
Created December 5, 2012 09:52
Show Gist options
  • Save clouder/4214384 to your computer and use it in GitHub Desktop.
Save clouder/4214384 to your computer and use it in GitHub Desktop.
#HTTR v1
//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.rotateCannon(5);
robot.ahead(50);
robot.turn(45);
robot.ahead(50);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
robot.rotateCannon(3);
robot.fire();
robot.rotateCannon(3);
robot.rotateCannon(-25);
};
Robot.prototype.onHitByBullet = function(ev) {
var robot = ev.robot;
robot.ahead(200);
};
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
robot.turn(180);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment