Created
December 3, 2012 13:11
-
-
Save tarsisazevedo/4194972 to your computer and use it in GitHub Desktop.
Revisions
-
tarsisazevedo revised this gist
Dec 3, 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 @@ -40,6 +40,7 @@ Robot.prototype.onRobotCollision = function(ev) { Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; robot.turnGunRight(ev.bearing); robot.ahead(100); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; -
tarsisazevedo revised this gist
Dec 3, 2012 . 1 changed file with 0 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,6 @@ Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) { robot.turnRight(ev.bearing - 90); } else robot.turnRight(ev.bearing + 90); }; -
tarsisazevedo revised this gist
Dec 3, 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 @@ -17,11 +17,11 @@ Robot.prototype.onIdle = function(ev) { }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) { robot.turnRight(ev.bearing - 90); robot.turnGunLeft(180); robot.turnGunRight(180); } else robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { -
tarsisazevedo revised this gist
Dec 3, 2012 . 1 changed file with 4 additions and 4 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 @@ -12,17 +12,17 @@ Robot.prototype.onIdle = function(ev) { this.direction *= -1; } robot.turnGunRight(this.direction); robot.turnGunRight(360); } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.turnRight(ev.bearing - 90); robot.turnGunLeft(180); robot.turnGunRight(180); else robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; -
tarsisazevedo revised this gist
Dec 3, 2012 . 1 changed file with 4 additions and 4 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 @@ -12,17 +12,17 @@ Robot.prototype.onIdle = function(ev) { this.direction *= -1; } robot.turnGunRight(this.direction); } else { robot.turnGunRight(360); } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.turnRight(ev.bearing - 90); else hsuarobot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; -
tarsisazevedo revised this gist
Dec 3, 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 @@ -40,7 +40,8 @@ Robot.prototype.onRobotCollision = function(ev) { robot.listen('onRobotCollision') }; Robot.prototype.onHitByBullet = function(ev) { var robot = ev.robot; robot.turnGunRight(ev.bearing); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; -
tarsisazevedo revised this gist
Dec 3, 2012 . No changes.There are no files selected for viewing
-
tarsisazevedo revised this gist
Dec 3, 2012 . No changes.There are no files selected for viewing
-
tarsisazevedo revised this gist
Dec 3, 2012 . 1 changed file with 6 additions and 7 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,12 +8,12 @@ Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(1); if (robot.parentId) { if (robot.cannonRelativeAngle > 270 || robot.cannonRelativeAngle < 90) { this.direction *= -1; } robot.turnGunRight(this.direction); robot.turnGunRight(180); robot.turnGunRight(-180); } }; @@ -48,5 +48,4 @@ Robot.prototype.onScannedRobot = function(ev) { return; } robot.fire(); }; -
Zolmeister revised this gist
Dec 2, 2012 . No changes.There are no files selected for viewing
-
Zolmeister revised this gist
Dec 2, 2012 . 1 changed file with 47 additions and 31 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,36 +1,52 @@ 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) { //if (robot.cannonRelativeAngle > 270 || robot.cannonRelativeAngle < 90) { // this.direction *= -1; //} //robot.turnGunRight(this.direction); //robot.turnGunRight(180); //robot.turnGunRight(-180); } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.turnRight(ev.bearing - 90); else robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { robot.ahead(100); } if (robot.id != collidedRobot.parentId && robot.parentId != collidedRobot.id) { robot.turnGunRight(ev.bearing - robot.cannonRelativeAngle); robot.turnGunLeft(ev.bearing - robot.cannonRelativeAngle); } robot.listen('onRobotCollision') }; Robot.prototype.onHitByBullet = function(ev) { }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot, scannedRobot = ev.scannedRobot; if (robot.id == scannedRobot.parentId || robot.parentId == scannedRobot.id) { return; } robot.fire(); //robot.log('firing'); }; -
Zolmeister revised this gist
Dec 2, 2012 . 1 changed file with 31 additions and 47 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,52 +1,36 @@ var Robot = function(robot) { this.dir=1; this.once=false }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.rotateCannon(-1*this.dir); else{ robot.rotateCannon(-1); } if(robot.parentId && !this.once){ this.once=true; robot.back(100); } robot.clone(); }; Robot.prototype.onScannedRobot = function(ev) { var robot = ev.robot; var srobo = ev.scannedRobot; var id1 = robot.parentId || robot.id; var id2 = srobo.parentId || srobo.id; if(id1!=id2){ if(!robot.parentId){ robot.stop(); robot.fire(); robot.rotateCannon(-30*this.dir); this.dir*=-1; } else{ robot.rotateCannon(15); robot.fire(5); } } }; -
Zolmeister revised this gist
Dec 2, 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 @@ -28,7 +28,7 @@ Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { robot.ahead(100); } -
Zolmeister revised this gist
Dec 2, 2012 . 1 changed file with 4 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 @@ -19,13 +19,16 @@ Robot.prototype.onIdle = function(ev) { }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; if(!robot.parentId) robot.turnRight(ev.bearing - 90); else robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { //robot.back(100); } else { robot.ahead(100); } -
Zolmeister revised this gist
Dec 2, 2012 . 1 changed file with 5 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,17 +1,17 @@ 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) { //if (robot.cannonRelativeAngle > 270 || robot.cannonRelativeAngle < 90) { // this.direction *= -1; //} //robot.turnGunRight(this.direction); //robot.turnGunRight(180); //robot.turnGunRight(-180); } @@ -20,7 +20,6 @@ Robot.prototype.onIdle = function(ev) { Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; -
cezarsa revised this gist
Dec 2, 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 @@ -46,5 +46,5 @@ Robot.prototype.onScannedRobot = function(ev) { return; } robot.fire(); //robot.log('firing'); }; -
cezarsa revised this gist
Dec 2, 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 @@ -46,4 +46,5 @@ Robot.prototype.onScannedRobot = function(ev) { return; } robot.fire(); robot.log('firing'); }; -
cezarsa revised this gist
Nov 30, 2012 . 1 changed file with 8 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 @@ -2,13 +2,20 @@ 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) { if (robot.cannonRelativeAngle > 270 || robot.cannonRelativeAngle < 90) { this.direction *= -1; } robot.turnGunRight(this.direction); //robot.turnGunRight(180); //robot.turnGunRight(-180); } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; -
cezarsa revised this gist
Nov 30, 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 @@ -5,7 +5,10 @@ var Robot = function(robot){ }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot; robot.ahead(1); if (robot.parentId) { robot.turnGunRight(1) } }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; @@ -14,7 +17,6 @@ Robot.prototype.onWallCollision = function(ev) { }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); -
cezarsa revised this gist
Nov 29, 2012 . No changes.There are no files selected for viewing
-
cezarsa revised this gist
Nov 29, 2012 . No changes.There are no files selected for viewing
-
cezarsa revised this gist
Nov 29, 2012 . No changes.There are no files selected for viewing
-
cezarsa revised this gist
Nov 29, 2012 . No changes.There are no files selected for viewing
-
cezarsa revised this gist
Nov 29, 2012 . 1 changed file with 7 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 @@ -13,18 +13,20 @@ Robot.prototype.onWallCollision = function(ev) { }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot, collidedRobot = ev.collidedRobot; robot.ignore('onRobotCollision') if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { robot.ahead(100); } if (robot.id != collidedRobot.parentId && robot.parentId != collidedRobot.id) { robot.turnGunRight(ev.bearing - robot.cannonRelativeAngle); robot.turnGunLeft(ev.bearing - robot.cannonRelativeAngle); } robot.listen('onRobotCollision') }; Robot.prototype.onHitByBullet = function(ev) { -
cezarsa revised this gist
Nov 29, 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,7 @@ Robot.prototype.onWallCollision = function(ev) { Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.ignore('onRobotCollision'); if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { @@ -24,6 +24,7 @@ Robot.prototype.onRobotCollision = function(ev) { robot.turnGunRight(ev.bearing - robot.cannonRelativeAngle); robot.turnGunLeft(ev.bearing - robot.cannonRelativeAngle); robot.listen('onRobotCollision'); }; Robot.prototype.onHitByBullet = function(ev) { -
cezarsa revised this gist
Nov 29, 2012 . 1 changed file with 5 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,13 +14,16 @@ Robot.prototype.onWallCollision = function(ev) { }; Robot.prototype.onRobotCollision = function(ev) { var robot = ev.robot; robot.stop(); if (ev.bearing > -90 && ev.bearing < 90) { robot.back(100); } else { robot.ahead(100); } robot.turnGunRight(ev.bearing - robot.cannonRelativeAngle); robot.turnGunLeft(ev.bearing - robot.cannonRelativeAngle); }; Robot.prototype.onHitByBullet = function(ev) { -
cezarsa revised this gist
Nov 28, 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 @@ -9,7 +9,7 @@ Robot.prototype.onIdle = function(ev) { }; Robot.prototype.onWallCollision = function(ev) { var robot = ev.robot; robot.turnRight(ev.bearing + 90); }; Robot.prototype.onRobotCollision = function(ev) { -
cezarsa revised this gist
Nov 28, 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 @@ -20,6 +20,7 @@ Robot.prototype.onRobotCollision = function(ev) { robot.ahead(100); } robot.turnGunLeft(ev.bearing - 90); robot.turnGunRight(ev.bearing - 90); }; Robot.prototype.onHitByBullet = function(ev) { -
cezarsa revised this gist
Nov 28, 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 @@ -19,6 +19,7 @@ Robot.prototype.onRobotCollision = function(ev) { } else { robot.ahead(100); } robot.turnGunLeft(ev.bearing - 90); }; Robot.prototype.onHitByBullet = function(ev) { -
cezarsa revised this gist
Nov 28, 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 @@ -1,7 +1,7 @@ var Robot = function(robot){ robot.turnLeft(robot.angle % 90); robot.turnGunRight(90); robot.clone(); }; Robot.prototype.onIdle = function(ev) { var robot = ev.robot;
NewerOlder