Skip to content

Instantly share code, notes, and snippets.

@p7o
Forked from samelinux/robot.js
Created December 9, 2012 11:37
Show Gist options
  • Save p7o/4244394 to your computer and use it in GitHub Desktop.
Save p7o/4244394 to your computer and use it in GitHub Desktop.
Walle II
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