MY ROBOTS

ABSOLUTELY EVERYTHING ABOUT YOUR ARMY OF ROBOTS
  • # 24803
    test1
    created 03/28/13 40 code lines fight fork
    1438 SCORE
    8 KILLS
    183 SHOTS
    60 HITS
    32.61%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(r) { }; Robot.prototype.onIdle = function(ev) { var r = ev.robot; r.clone(); r.rotateCannon(360); r.ahead(150); r.turn(30); r.ahead(150); }; Robot.prototype.onScannedRobot = function(ev) { var r = ev.robot; if (ev.scannedRobot.parentId == r.id || ev.scannedRobot.id == r.parentId) { return; }; r.rotateCannon(2); r.fire(); r.turn(8); r.rotateCannon(-20); r.ahead(15); }; Robot.prototype.onHitByBullet = function(ev) { var r = ev.robot; r.disappear(); }; Robot.prototype.onWallCollision = function(ev) { var r = ev.robot; r.back(50); }; Robot.prototype.onRobotCollision = function(ev) { var r = ev.robot; r.back(30); };
  • # 319
    The One
    created 03/28/13 37 code lines fight fork
    1543 SCORE
    3 KILLS
    50 SHOTS
    31 HITS
    60.78%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot){ robot.clone(); robot.turn(45); this.offset = 1; }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.turn(1); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; if (robot.id == scannedRobot.parentId || robot.parentId == scannedRobot.id) { return; } robot.stop(); for (var i=0; i<10; i++) { robot.fire(); robot.ahead(10); } }; Robot.prototype.onWallCollision = function(ev) { ev.robot.stop(); ev.robot.turn(ev.bearing - 180); ev.robot.ahead(10) }; Robot.prototype.onRobotCollided = function(ev) { ev.robot.stop(); this.offset = -1 * this.offset; ev.robot.turn(10 * this.offset); };