Skip to content

Instantly share code, notes, and snippets.

@aquamoogle
Created December 7, 2012 20:06
Show Gist options
  • Select an option

  • Save aquamoogle/4236114 to your computer and use it in GitHub Desktop.

Select an option

Save aquamoogle/4236114 to your computer and use it in GitHub Desktop.
SpecialK 15 Gh3y
var Robot = function(robot) { };
var ticks = 0;
Robot.prototype.onIdle = function(ev) {
ev.robot.ahead(1000);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
for(var i = 0; i < 30; i++)
robot.fire();
};
Robot.prototype.onRobotCollision = function(ev) {
var robot = ev.robot;
robot.stop();
robot.back(10);
robot.turn(ev.bearing / 2);
for(var i = 0; i < 30; i++)
robot.fire();
};
Robot.prototype.onWallCollision = function(ev) {
var robot = ev.robot;
if(ev.bearing != 0)
robot.turn(ev.bearing);
robot.turn(90);
robot.ahead(1000);
};
Robot.prototype.onHitByBullet = function(ev) {
//var robot = ev.robot;
//robot.turn(90);
//robot.ahead(1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment