MY ROBOTS

ABSOLUTELY EVERYTHING ABOUT YOUR ARMY OF ROBOTS
  • # 15125
    CodeBeard_1
    created 03/29/13 119 code lines
    1462 SCORE
    72 KILLS
    3,678 SHOTS
    793 HITS
    21.55%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • # 21117
    DumberZero
    created 04/01/13 60 code lines fork
    14 SCORE
    1 KILLS
    22 SHOTS
    11 HITS
    47.83%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    // helpers function areEnemies(robot, sighted) { var sightedIsChild = (robot.id == sighted.parentId); var sightedIsParent = (robot.parentId == sighted.id); return !(sightedIsChild || sightedIsParent); }; function baseStep(robot) { return 6 * direction(robot); }; function charge(robot) { robot.ahead(360); }; function direction(robot) { return isParent(robot) ? 1 : -1; }; function fallback(robot) { robot.ignore('onHitByBullet'); robot.back(30 * baseStep(robot)); robot.listen('onHitByBullet'); }; function isParent(robot) { return robot.parentId ? true : false; }; function seekAndDestroy(robot) { var step = baseStep(robot); robot.rotateCannon(step); robot.turn(step); robot.ahead(step); }; // robot var Robot = function(robot) { robot.clone(); }; Robot.prototype.onIdle = function(ev) { seekAndDestroy(ev.robot); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; var scanned = ev.scannedRobot; if (areEnemies(robot, scanned)) { var adjustment = -(36 * direction(robot)); robot.fire(); robot.fire(); robot.rotateCannon(adjustment); } };