Skip to content

Instantly share code, notes, and snippets.

@samelinux
Created December 7, 2012 17:08
Show Gist options
  • Save samelinux/4234739 to your computer and use it in GitHub Desktop.
Save samelinux/4234739 to your computer and use it in GitHub Desktop.
Wall Killer
var Robot = function(robot) {
robot.rotateCannon(180);
};
Robot.prototype.onIdle = function(ev) {
ev.robot.back(30);
};
Robot.prototype.onScannedRobot = function(ev) {
ev.robot.fire();
};
Robot.prototype.onWallCollision = function(ev) {
ev.robot.ignore("onRobotCollision");
ev.robot.ignore("onScannedRobot");
ev.robot.turn(ev.bearing - 90);
ev.robot.listen("onScannedRobot");
ev.robot.listen("onRobotCollision");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment