Skip to content

Instantly share code, notes, and snippets.

@naab
naab / robot.js
Created December 14, 2012 11:57
FU
function get_triangle_x_y(e,t){var n=Math.abs(e.x-t.x);var r=Math.abs(e.y-t.y);return{x:r,y:r}}function getDistanceBetween2Robots(e,t){var n=get_triangle_x_y(e,t);var r=n.x;var i=n.y;return Math.sqrt(r*r+i*i)}function calculer_angle_cannon(e,t){var n=e+t-90;if(n<0)n+=360;return Math.abs(n)%360}function findATarget(){if(list_ennemys.length==0)return null;if(list_ennemys.length==1)return list_ennemys[0].analyzeFuturePosition();var e=list_ennemys[0];var t=list_ennemys[1];if(!e.isParent()){e=list_ennemys[1];t=list_ennemys[0]}var n;if((n=e.analyzeFuturePosition())==null)return t.analyzeFuturePosition();return n}function registerEnnemy(e){
for(var t=0;t<list_ennemys.length;t++){if(list_ennemys[t].robot.id==e.id){var n=list_ennemys[t];n.update(e);list_ennemys[t]=n;return}}list_ennemys[list_ennemys.length]=new Ennemy(e)}function increaseEnnemyIntelAge(){intelAllCounter++}function ennemySeen(){for(var e=0;e<list_ennemys.length;e++){if(intelAllCounter-list_ennemys[e].position_age>intelTooOld)list_ennemys[e].seen=fals
@naab
naab / robot.js
Created December 12, 2012 18:03 — forked from satansfate/robot.js
Attempted Random
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
var angle = 0;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
@naab
naab / robot.js
Created December 10, 2012 14:21 — forked from HugoLnx/robot.js
[CAELUM TEAM] CrazyGiroscope
var CrazyGiroscope = function() {
var becameDistant = true;
var Robot = function(robot) {
robot.rotateCannon(-20);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@naab
naab / robot.js
Created December 10, 2012 12:38 — forked from ultek/robot.js
ocotuchodzi
var robots = new Array();
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.start = function( ev ){
@naab
naab / robot.js
Created December 9, 2012 22:53 — forked from JaZe/robot.js
Boozator
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
var rx = robot.position.x;
var ry = robot.position.y;
var aH = robot.arenaHeight;
var aW = robot.arenaWidth;
robot.clone()
};
@naab
naab / robot.js
Created December 9, 2012 15:53
Moving Around
//FightCode can only understand your robot
//if its class is called Robot
var arena = {
width: 0,
height: 0,
};
var nb_directions = 4;
@naab
naab / robot.js
Created December 9, 2012 13:17
M.O.N.T.E #2.1.2
var rot1 = 1;
var rot2 = 1;
var starting = 1;
function Robot(robot) {}
// well, we need to do something...
// whenever our robot is idle, this method gets called.
Robot.prototype.onIdle = function(ev) {
var robot;
robot = ev.robot;
@naab
naab / robot.js
Created December 9, 2012 12:39 — forked from bchoii/robot.js
Simple Wall Robot
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) {
@naab
naab / robot.js
Created December 9, 2012 12:11 — forked from yitsushi/robot.js
Folyam2
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {};
var target = null;
var intelAge = 0;
var cloned = false;
var pointAt = function(robot, enemy)
@naab
naab / robot.js
Created December 8, 2012 22:47
Roger
//FightCode can only understand your robot
//if its class is called Robot
var arena = {
width: 0,
height: 0,
};
var nb_directions = 4;