-
-
Save H1D/4214967 to your computer and use it in GitHub Desktop.
Revisions
-
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 2 additions and 17 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,17 +1,12 @@ var Robot = function(robot) { robot.rotateCannon(-90); }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(); //i'll add a clone but i need to refactor collision //robot.clone(); }; Robot.prototype.onScannedRobot = function(ev) { @@ -22,27 +17,17 @@ Robot.prototype.onScannedRobot = function(ev) { robot.rotateCannon(-15); robot.rotateCannon(15); }else{ } }; Robot.prototype.onHitByBullet = function(ev) { var robot; }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.rotateCannon(90); }; Robot.prototype.onWallCollision = function(ev) { -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 1 addition and 0 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 @@ -38,6 +38,7 @@ Robot.prototype.onHitByBullet = function(ev) { Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.rotateCannon(90); //robot.ahead(robot.position+5); //robot.ahead(robot.position-15); //robot.turn(180 - ev.Bearing); -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 2 additions and 2 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 @@ -19,8 +19,8 @@ Robot.prototype.onScannedRobot = function(ev) { var scanned =ev.scannedRobot; if(scanned.id !== robot.parentId && scanned.parentId !== robot.id) { robot.fire(); robot.rotateCannon(-15); robot.rotateCannon(15); }else{ //robot.ahead(-40); } -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 21 additions and 16 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,16 +1,16 @@ //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot) { robot.rotateCannon(-90); }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; //robot.clone(); robot.ahead(); //robot.rotateCannon(Math.floor((Math.random()-0.5))*360); //robot.back(10); }; @@ -19,27 +19,32 @@ Robot.prototype.onScannedRobot = function(ev) { var scanned =ev.scannedRobot; if(scanned.id !== robot.parentId && scanned.parentId !== robot.id) { robot.fire(); //robot.rotateCannon(30); //robot.rotateCannon(-30); }else{ //robot.ahead(-40); } }; Robot.prototype.onHitByBullet = function(ev) { var robot; //robot = ev.robot; //robot.turn(90 - ev.bulletBearing); //robot.ahead(-50); //robot.turn(60 - ev.bulletBearing); //robot.back(90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; //robot.ahead(robot.position+5); //robot.ahead(robot.position-15); //robot.turn(180 - ev.Bearing); // trying to run away }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turn(-90+ev.bearing); }; -
Shipow 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 @@ -33,7 +33,7 @@ Robot.prototype.onHitByBullet = function(ev) { robot.turn(90 - ev.bulletBearing); robot.ahead(-50); robot.turn(60 - ev.bulletBearing); //robot.back(90); }; Robot.prototype.onRobotCollision = function(ev) { -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 2 additions and 2 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 @@ -8,8 +8,8 @@ Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.clone(); robot.ahead(100); robot.rotateCannon(Math.floor((Math.random()-0.5))*360); robot.back(10); robot.rotateCannon(360); }; -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 2 additions and 2 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 @@ -19,10 +19,10 @@ Robot.prototype.onScannedRobot = function(ev) { var scanned =ev.scannedRobot; if(scanned.id !== robot.parentId && scanned.parentId !== robot.id) { robot.fire(); robot.rotateCannon(30); robot.rotateCannon(-30); }else{ robot.ahead(-40); } -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 27 additions and 5 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,4 +1,3 @@ //FightCode can only understand your robot //if its class is called Robot var Robot = function(robot) { @@ -7,6 +6,7 @@ var Robot = function(robot) { Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.clone(); robot.ahead(100); robot.rotateCannon(360); robot.back(100); @@ -15,9 +15,31 @@ Robot.prototype.onIdle = function(ev) { }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; var scanned =ev.scannedRobot; if(scanned.id !== robot.parentId && scanned.parentId !== robot.id) { robot.fire(); robot.rotateCannon(-3); robot.rotateCannon(-30); }else{ robot.ahead(30); } }; Robot.prototype.onHitByBullet = function(ev) { var robot; robot = ev.robot; robot.turn(90 - ev.bulletBearing); robot.ahead(-50); robot.turn(60 - ev.bulletBearing); robot.back(90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.ahead(robot.position+5); robot.ahead(robot.position-15); // trying to run away }; -
Shipow revised this gist
Dec 5, 2012 . 1 changed file with 1 addition and 0 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 @@ -16,6 +16,7 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.stop(); robot.fire(); }; -
Shipow 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(); };