-
-
Save samelinux/4232357 to your computer and use it in GitHub Desktop.
Revisions
-
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 0 additions and 53 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,53 +0,0 @@ -
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 12 additions 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 @@ -20,8 +20,19 @@ Robot.prototype.onIdle = function(ev) { { ev.robot.back(30); } if(ev.robot.cannonRelativeAngle==300 || ev.robot.cannonRelativeAngle==60) { if(firesign==1) { firesign=-1; } else { firesign=1; } } // if(!fired) ev.robot.rotateCannon(10*firesign); }; Robot.prototype.onHitByBullet = function(ev) { -
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 1 addition 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 @@ -20,7 +20,6 @@ Robot.prototype.onIdle = function(ev) { { ev.robot.back(30); } // if(!fired) // ev.robot.rotateCannon(10*firesign); }; @@ -39,5 +38,5 @@ Robot.prototype.onRobotCollision = function(ev) { }; Robot.prototype.onWallCollision = function(ev) { ev.robot.turn(ev.bearing - 90); }; -
samelinux revised this gist
Dec 7, 2012 . No changes.There are no files selected for viewing
-
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 6 additions and 25 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 @@ -20,43 +20,24 @@ Robot.prototype.onIdle = function(ev) { { ev.robot.back(30); } ev.robot.log(ev.robot.cannonRelativeAngle); // if(!fired) // ev.robot.rotateCannon(10*firesign); }; Robot.prototype.onHitByBullet = function(ev) { eading=1-eading; }; Robot.prototype.onScannedRobot = function(ev) { // ev.robot.fire(); // ev.robot.rotateCannon(-20*firesign); }; Robot.prototype.onRobotCollision = function(ev) { eading=1-eading; }; Robot.prototype.onWallCollision = function(ev) { ev.robot.turn(ev.bearing - 90);// }; -
samelinux revised this gist
Dec 7, 2012 . 1 changed file with 41 additions and 27 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,48 +1,62 @@ var eading; var firesign; var lasthealth; var fired; var Robot = function(robot) { eading=1; firesign=1; lasthealth=100; fired=false; robot.rotateCannon(-90); }; Robot.prototype.onIdle = function(ev) { if(eading==1) { ev.robot.ahead(30); } else { ev.robot.back(30); } if(ev.robot.cannonRelativeAngle==60 || ev.robot.cannonRelativeAngle==300) { if(firesign==1) firesign=-1; else firesign=1; } if(!fired) ev.robot.rotateCannon(10*firesign); }; Robot.prototype.onHitByBullet = function(ev) { eading=1-eading; }; Robot.prototype.onScannedRobot = function(ev) { if(lastRobotHealth>=ev.scannedRobot.life) { if(firesign==1) { firesign=-1; } else { firesign=1; } } ev.robot.fire(); ev.robot.rotateCannon(-10*firesign); }; Robot.prototype.onRobotCollision = function(ev) { eading=1-eading; }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turn(ev.bearing - 90); }; -
Szymon Zachara revised this gist
Dec 7, 2012 . 1 changed file with 3 additions and 3 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 @@ -33,12 +33,12 @@ Robot.prototype.onScannedRobot = function(ev) { Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.stop(); robot.back(10); robot.listen('onScannedRobot'); robot.ignore('onWallCollision'); robot.turn(90); robot.listen('onWallCollision'); robot.listen('onScannedRobot'); }; Robot.prototype.onWallCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 7, 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.onRobotCollision = function(ev) { robot.ignore('onWallCollision'); robot.turn(90); robot.listen('onWallCollision'); robot.listen('onScannedRobot'); }; Robot.prototype.onWallCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 7, 2012 . No changes.There are no files selected for viewing
-
Szymon Zachara revised this gist
Dec 7, 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 @@ -26,7 +26,7 @@ Robot.prototype.onScannedRobot = function(ev) { robot.ignore('onWallCollision'); robot.fire(3); robot.ahead(50); robot.turn(-30); robot.listen('onWallCollision'); }; -
Szymon Zachara revised this gist
Dec 7, 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 @@ -26,7 +26,7 @@ Robot.prototype.onScannedRobot = function(ev) { robot.ignore('onWallCollision'); robot.fire(3); robot.ahead(50); robot.turn(-90); robot.listen('onWallCollision'); }; -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 4 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 @@ -14,8 +14,10 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; robot.ignore('onHitByBullet'); robot.turn(-45); robot.ahead(100); robot.listen('onHitByBullet'); }; Robot.prototype.onScannedRobot = function(ev) { -
Szymon Zachara revised this gist
Dec 6, 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 @@ -14,7 +14,7 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; robot.turn(-45); // Turn to wherever the bullet was fired // so we can see who shot it }; -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 7 additions 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 @@ -12,13 +12,19 @@ Robot.prototype.onIdle = function(ev) { }; Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; robot.turn(-90); // Turn to wherever the bullet was fired // so we can see who shot it }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.stop(); robot.ignore('onWallCollision'); robot.fire(3); robot.ahead(50); robot.turn(-35); robot.listen('onWallCollision'); }; -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 6 additions 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 @@ -1,7 +1,9 @@ var Robot = function(robot) { robot.ignore('onScannedRobot'); robot.rotateCannon(-90); robot.listen('onScannedRobot'); }; Robot.prototype.onIdle = function(ev) { @@ -12,6 +14,7 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.stop(); robot.ignore('onWallCollision'); robot.fire(3); robot.ahead(50); @@ -21,6 +24,9 @@ Robot.prototype.onScannedRobot = function(ev) { Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.stop(); robot.back(10); robot.ignore('onWallCollision'); robot.turn(90); robot.listen('onWallCollision'); -
Szymon Zachara revised this gist
Dec 6, 2012 . No changes.There are no files selected for viewing
-
Szymon Zachara revised this gist
Dec 6, 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 @@ -14,8 +14,8 @@ Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.ignore('onWallCollision'); robot.fire(3); robot.ahead(50); robot.turn(-20); robot.listen('onWallCollision'); }; -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 2 additions 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 @@ -21,7 +21,9 @@ Robot.prototype.onScannedRobot = function(ev) { Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.ignore('onWallCollision'); robot.turn(90); robot.listen('onWallCollision'); }; Robot.prototype.onWallCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 4 additions and 6 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,24 +1,22 @@ var Robot = function(robot) { robot.rotateCannon(-90); }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(30); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.ignore('onWallCollision'); robot.fire(3); robot.back(60); robot.turn(20); robot.listen('onWallCollision'); }; Robot.prototype.onRobotCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 4 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 @@ -13,10 +13,12 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; //robot.stop(); robot.ignore('onWallCollistion'); robot.fire(3); robot.back(60); robot.turn(20); robot.listen('onWallCollistion'); }; Robot.prototype.onRobotCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 2 additions 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 @@ -15,7 +15,8 @@ Robot.prototype.onScannedRobot = function(ev) { //robot.stop(); robot.fire(); robot.back(60); robot.turn(20); }; Robot.prototype.onRobotCollision = function(ev) { -
Szymon Zachara revised this gist
Dec 6, 2012 . 1 changed file with 5 additions 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 @@ -18,6 +18,11 @@ Robot.prototype.onScannedRobot = function(ev) { robot.back(50); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.turn(90); }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turn(ev.bearing - 90); -
Szymon Zachara created this gist
Dec 6, 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,25 @@ //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.ahead(30); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; //robot.stop(); robot.fire(); robot.back(50); }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turn(ev.bearing - 90); };