-
-
Save mdonahoo/4209481 to your computer and use it in GitHub Desktop.
pan rozowy wons
This file contains 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 characters
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
for(var i=0;i<5;i++) | |
{ | |
robot.move(60); | |
robot.turn(45); | |
} | |
for(var i=0;i<5;i++) | |
{ | |
robot.move(120); | |
robot.turn(-45); | |
} | |
}; | |
Robot.prototype.onScannedRobot = function(ev) { | |
var robot = ev.robot; | |
robot.fire(); | |
}; | |
Robot.prototype.onHitByBullet = function(ev) { | |
var robot = ev.robot; | |
robot.turn(ev.bearing); | |
robot.fire(); | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
var robot = ev.robot; | |
robot.turn(180); | |
robot.ahead(100); | |
}; | |
Robot.prototype.onRobotCollision = function(ev) { | |
var robot = ev.robot; | |
if(robot.myFault) | |
{ | |
robot.turn(150); | |
robot.ahead(100); | |
}else{ | |
robot.turn(ev.bearing); | |
robot.fire(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment