Created
December 5, 2012 14:24
-
-
Save samelinux/4215862 to your computer and use it in GitHub Desktop.
Revisions
-
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 0 additions and 67 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,67 +0,0 @@ -
samelinux revised this gist
Dec 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ Robot.prototype.onScannedRobot=function(ev) { return; } io.fire(); if(io.parentId) { io.rotateCannon(-25); -
samelinux revised this gist
Dec 5, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,5 +63,5 @@ Robot.prototype.onHitByBullet=function(ev) { var io=ev.robot; io.turn(180); io.ahead(10); } -
samelinux revised this gist
Dec 5, 2012 . 1 changed file with 60 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,67 @@ var Robot=function(robot) { robot.clone(); }; Robot.prototype.onIdle=function(ev) { var io=ev.robot; io.ahead(10); if(io.parentId) { io.rotateCannon(10); } else { io.rotateCannon(-10); } }; Robot.prototype.onScannedRobot=function(ev) { var io=ev.robot; var nemico=ev.scannedRobot; if (io.id==nemico.parentId || io.parentId==nemico.id) { return; } // io.fire(); if(io.parentId) { io.rotateCannon(-25); } else { io.rotateCannon(25); } }; Robot.prototype.onRobotCollision=function(ev) { var io=ev.robot; var nemico=ev.collidedRobot; if (io.id==nemico.parentId || io.parentId==nemico.id) { io.turn(180); io.ahead(10); } else { io.turn(-ev.bearing); } } Robot.prototype.onWallCollision=function(ev) { var io=ev.robot; io.ignore('onRobotCollision'); io.turn(180); io.listen('onRobotCollision'); } Robot.prototype.onHitByBullet=function(ev) { var io=ev.robot; io.turn(180); o.ahead(10); } -
samelinux created this gist
Dec 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ //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(); };