Created
December 5, 2012 23:57
-
-
Save diguinhorocks/4220673 to your computer and use it in GitHub Desktop.
Revisions
-
diguinhorocks revised this gist
Dec 6, 2012 . 1 changed file with 3 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 @@ -11,7 +11,7 @@ Robot.prototype.onIdle = function(ev) { robot.rotateCannon(-20); robot.turn(100); robot.ahead(300); robot.rotateCannon(90); }; @@ -26,7 +26,8 @@ Robot.prototype.onScannedRobot = function(ev) { }; Robot.prototype.onRobotCollision = function(ev) { ev.robot.rotateCannon(20); ev.robot.fire(2); }; Robot.prototype.onHitByBullet = function(ev) { -
diguinhorocks revised this gist
Dec 6, 2012 . 1 changed file with 3 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,10 +8,11 @@ var Robot = function(robot) { Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(300); robot.rotateCannon(-20); robot.turn(100); robot.ahead(300); robot.rotateCannon(-90); }; -
diguinhorocks revised this gist
Dec 6, 2012 . 1 changed file with 5 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 @@ -8,9 +8,9 @@ var Robot = function(robot) { Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(300); robot.rotateCannon(20); robot.turn(100); robot.ahead(300); robot.rotateCannon(90); }; @@ -19,6 +19,8 @@ Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.fire(2); robot.fire(2); robot.fire(2); }; @@ -29,7 +31,7 @@ Robot.prototype.onRobotCollision = function(ev) { Robot.prototype.onHitByBullet = function(ev) { var robot; robot = ev.robot; robot.turn(ev.bulletBearing); }; Robot.prototype.onWallCollision = function(ev) { -
diguinhorocks 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,40 @@ //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(300); robot.turn(100); robot.rotateCannon(90); robot.turn(20); robot.rotateCannon(90); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; robot.fire(2); }; Robot.prototype.onRobotCollision = function(ev) { ev.robot.fire(2); }; Robot.prototype.onHitByBullet = function(ev) { var robot; robot = ev.robot; robot.turn(90 - ev.bulletBearing); }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turn(ev.bearing); // turn enought to be in a straight // angle with the wall. };