MY ROBOTS

ABSOLUTELY EVERYTHING ABOUT YOUR ARMY OF ROBOTS
  • # 19803
    Awesomeness
    created 11/29/12 0 code lines fork
    1371 SCORE
    2 KILLS
    90 SHOTS
    53 HITS
    58.24%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //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.rotateCannon(360); robot.back(100); robot.rotateCannon(360); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.fire(); };
  • # 3575
    Chaser
    created 11/30/12 36 code lines
    1535 SCORE
    92 KILLS
    1,956 SHOTS
    865 HITS
    44.20%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • # 19673
    exterminussun do futuro
    created 11/28/12 63 code lines fork
    1386 SCORE
    6 KILLS
    473 SHOTS
    121 HITS
    25.53%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot){ this.shouldFire = 0; }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; if (this.shouldFire > 0){ robot.ahead(10); robot.fire(); this.shouldFire = this.shouldFire - 1; return; } robot.clone(); robot.listen('onScannedRobot'); robot.ahead(100); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; if (robot.id == scannedRobot.parentId || robot.parentId == scannedRobot.id) { return; } this.shouldFire = 10; robot.ignore('onScannedRobot'); robot.stop(); }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.listen('onScannedRobot'); if (robot.parentId){ robot.turn(ev.bearing + 90); robot.rotateCannon(ev.bearing + 90); } else { robot.turn(ev.bearing - 90); robot.rotateCannon(ev.bearing - 90); } robot.ahead(40); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.rotateCannon(ev.bearing); robot.turn(ev.bearing + 90); robot.ahead(20) this.shouldFire = 10; }; Robot.prototype.onHitByBullet = function(ev) { var robot; robot = ev.robot; robot.turn(45 - ev.bulletBearing); robot.rotateCannon(ev.bulletBearing); robot.fire(); };