MY ROBOTS

ABSOLUTELY EVERYTHING ABOUT YOUR ARMY OF ROBOTS
  • none
    ByLLL
    created 04/02/13 1 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    var Robot=function(a){var b=a.position.x;var c=a.position.y;var d=a.arenaHeight;var e=a.arenaWidth;a.clone();};Robot.prototype.onIdle=function(a){var b=a.robot;if(b.parentId){b.turn(1);b.ahead(1);b.rotateCannon(1);}else{b.turn(-1);b.rotateCannon(-1);b.ahead(-1);}};Robot.prototype.onWallCollision=function(a){var b=a.robot;if(b.parentId){b.turn(20);b.back(20);b.rotateCannon(-20);}else{b.turn(-20);b.rotateCannon(20);b.back(100);}};Robot.prototype.onRobotCollision=function(a){var b=a.robot;if(b.parentId){b.turn(20);b.back(20);}else{b.turn(-20);b.back(100);}};Robot.prototype.onScannedRobot=function(a){var b=a.robot,c=a.scannedRobot;if(b.id==c.parentId||b.parentId==c.id)return;if(c.parentId&&c.id==c.parentId)return;b.fire();if(b.parentId)b.rotateCannon(-25);else b.rotateCannon(25);};
  • # 12049
    Default c
    created 11/13/13 20 code lines fight fork
    1500 SCORE
    0 KILLS
    27 SHOTS
    0 HITS
    0.00%
    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(); };
  • none
    derp
    created 03/30/13 56 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    Eddie v2.0
    created 03/30/13 76 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var go=120; var Robot = function(robot) { }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; var clo =0 robot.clone(); if(robot.parentId!=null){ clo=-240; } robot.rotateCannon(90); robot = ev.robot; if(.6>Math.random()){ robot.ahead(go+clo); robot.turn(95); } }; Robot.prototype.onScannedRobot = function(ev) { var sr = ev.scannedRobot; var robot = ev.robot; var bFriendly = ( robot.parentId !=null && robot.parentId==sr.id); bFriendly |= ( sr.parentId !=null && sr.parentId==robot.id); if(bFriendly){ robot.back(50); } if(!bFriendly){ robot.fire(); robot.fire(); robot.rotateCannon(-15); robot.fire(); robot.fire(); robot.rotateCannon(-10); } }; Robot.prototype.onWallCollision= function(ev){ var robot = ev.robot; go=go*-1; robot.back(go); robot.rotateCannon(90); robot.back(go); robot.rotateCannon(90); } Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; if(robot.parentId!=null){ robot.turn(ev.bearing); robot.fire(); robot.fire(); robot.fire(); robot.fire(); robot.fire(); } }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.turn(20); robot.ahead(100); // trying to run away };
  • none
    Frextank
    created 04/02/13 0 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot) { var self = this; self.robot = robot; self.members = {}; self.enemies = {}; robot.clone(); }; Robot.prototype.onIdle = function(ev) { var self = this; var robot = ev.robot; // Initializing all tanks if (!self.members[robot.id]) { self.members[robot.id] = { scanning: true }; } if (self.members[robot.id].scanning) { robot.turn(30); if (robot.id != self.robot.id) robot.ahead(65); else robot.back(65); robot.rotateCannon(15); } }; Robot.prototype.onHitByBullet = function(ev) { var self = this; var robot = ev.robot; // run away right now robot.stop(); robot.fire(); robot.turn(30); if (robot.id != self.robot.id) robot.ahead(200); else robot.back(200); self.members[robot.id].scanning = true; }; Robot.prototype.onScannedRobot = function(ev) { var self = this; var robot = ev.robot; if (!self.members[ev.scannedRobot.id]) { robot.stop(); robot.fire(); robot.rotateCannon(-15); if (robot.id != self.robot.id) { if (robot.cannonRelativeAngle >= 0 && robot.cannonRelativeAngle <= 10) { robot.turn(-30); } robot.ahead(50); } else { if (robot.cannonRelativeAngle >= 170 && robot.cannonRelativeAngle <= 190) { robot.turn(-30); } robot.back(50); } //self.members[robot.id].scanning = false; } self.enemies[ev.scannedRobot.id] = ev.scannedRobot; }; Robot.prototype.onRobotCollision = function(ev) { var self = this; var robot = ev.robot; if (!self.members[ev.collidedRobot.id]) { robot.turn(ev.bearing); robot.rotateCannon(-ev.bearing); robot.fire(); } if (robot.id != self.robot.id) robot.back(100); else robot.ahead(100); self.members[robot.id].scanning = true; }; Robot.prototype.onWallCollision = function(ev) { var self = this; var robot = ev.robot; robot.turn(ev.bearing); if (robot.id != self.robot.id) robot.back(300); else robot.ahead(300); self.members[robot.id].scanning = true; };
  • none
    GOGA
    created 03/28/13 78 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    GOGA v2
    created 04/04/13 76 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    Grunt
    created 03/30/13 49 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot) { this.rotate = 1; this.dist = 0; this.lastAngle = 0; }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.turn(this.rotate); this.lastAngle = this.rotate; }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; var turnAngle = this.getAngle(robot.position, ev.scannedRobot.position); if (turnAngle < -180){ turnAngle += 360; }else if(turnAngle > 180){ turnAngle -= 360; } this.rotate = robot.cannonAbsoluteAngle - turnAngle this.dist = this.getDist(robot.position, ev.scannedRobot.position); robot.fire(); robot.ahead(this.dist/2); }; Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; this.rotate = ev.bearing; robot.turn(ev.bearing/2); robot.ahead(15); }; Robot.prototype.getAngle = function(a,b){ var tx = b.x - a.x, ty = b.y - a.y, rad = Math.atan2(ty,tx), angle = (rad/Math.PI * 180); return angle; } Robot.prototype.getDist = function(a,b){ return Math.sqrt((b.x - a.x) *(b.x - a.x) + (b.y - a.y) * (b.y - a.y)); }
  • none
    Motja
    created 03/30/13 45 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    Roar
    created 03/28/13 36 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    var Robot = function(robot) { this.dir=1; this.once=false }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.rotateCannon(-1*this.dir); else{ robot.rotateCannon(-1); } if(robot.parentId && !this.once){ this.once=true; robot.back(100); } robot.clone(); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; var srobo = ev.scannedRobot; var id1 = robot.parentId || robot.id; var id2 = srobo.parentId || srobo.id; if(id1!=id2){ if(!robot.parentId){ robot.stop(); robot.fire(); robot.rotateCannon(-30*this.dir); this.dir*=-1; } else{ robot.rotateCannon(15); robot.fire(5); } } };
  • none
    SAMPLE
    created 04/04/13 35 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    Simple Wall Robot
    created 04/02/13 0 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    var Robot = function(robot){ robot.turnLeft(robot.angle % 90); robot.turnGunRight(90); robot.clone(); this.direction = 1; }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(1); if (robot.parentId) { if (robot.cannonRelativeAngle > 270 || robot.cannonRelativeAngle < 90) { this.direction *= -1; } robot.turnGunRight(this.direction); //robot.turnGunRight(180); //robot.turnGunRight(-180); } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { robot.ahead(100); } if (robot.id != collidedRobot.parentId && robot.parentId != collidedRobot.id) { robot.turnGunRight(ev.bearing - robot.cannonRelativeAngle); robot.turnGunLeft(ev.bearing - robot.cannonRelativeAngle); } robot.listen('onRobotCollision') }; Robot.prototype.onHitByBullet = function(ev) { }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; if (robot.id == scannedRobot.parentId || robot.parentId == scannedRobot.id) { return; } robot.fire(); //robot.log('firing'); };
  • none
    Tig
    created 04/02/13 0 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    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(50); robot.rotateCannon(30); robot.turn(20); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.fire(); robot.rotateCannon(-30); }; // ohhh... we were hit by another robot... Robot.prototype.onHitByBullet = function(ev) { var robot; robot = ev.robot; robot.turn(45 - ev.bulletBearing); }; // this method gets called whenever we hit a wall... //Robot.prototype.onWallCollision = function(ev) { // var robot = ev.robot; // robot.back(50); // robot.turn(60); // };
  • none
    V2 sqrt
    created 04/04/13 20 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    Valera
    created 03/30/13 40 code lines fight
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
  • none
    White Knight
    created 03/28/13 68 code lines fight fork
    1500 SCORE
    0 KILLS
    0 SHOTS
    0 HITS
    0.00%
    AVERAGE HITS/SHOT
    SCORE OVER TIME
    //FightCode can only understand your robot //if its class is called Robot Math.ag = { radiansToDegrees: function radiansToDegrees(radians) { return (radians * 180) / Math.PI; }, dotProduct: function dotProduct(a, b) { return (a.x * b.x) + (a.y * b.y); }, magnitude: function magnitude(vector) { return Math.sqrt(Math.pow(vector.x, 2) + Math.pow(vector.y, 2)); } }; var Robot = function(robot) { robot.clone(); }; Robot.prototype.goTo = function goTo(robot) { var destination = robot.destination, position = robot.position, normalized = { x: destination.x - position.x, y: destination.y - position.y }, distance = Math.ag.magnitude(normalized), mposition = Math.ag.magnitude(position), angle = Math.ag.radiansToDegrees(Math.acos(Math.abs(Math.ag.dotProduct(position, normalized)) / (mposition * distance))); robot.turn(angle); robot.ahead(distance); }; Robot.prototype.onIdle = function(ev) { var i = ev.robot, amIFather = i.parentId === null, multiplier = amIFather ? 1 : -1, arenaQuarter = { x: Math.floor(i.arenaWidth / 4), y: Math.floor(i.arenaHeight / 4) }; position = i.position; console.log('Arena: ' + arenaQuarter.x + ', ' + arenaQuarter.y); console.log('Position: ' + position.x + ', ' + position.y); if (position.x != arenaQuarter.x || position.y != arenaQuarter.y) { i.destination = arenaQuarter; this.goTo(i); } }; Robot.prototype.onScannedRobot = function(ev) { var i = ev.robot, it = ev.scannedRobot, isItFather = it.parentId === i.id, isItSon = it.id == i.parentId, friend = isItFather || isItSon; if (!friend) { i.fire(); } };

LATEST COMBATS

WATCH THE LAST COMBATS OF THIS PLAYER'S ARMY