Skip to content

Instantly share code, notes, and snippets.

@benjic
Created January 21, 2016 03:53
Show Gist options
  • Save benjic/745a7825adab238d906f to your computer and use it in GitHub Desktop.
Save benjic/745a7825adab238d906f to your computer and use it in GitHub Desktop.
Elevator Saga solution -- http://play.elevatorsaga.com/
{
init: function(elevators, floors) {
var elevator = elevators[0]; // Let's use the first elevator
// Whenever the elevator is idle (has no more queued destinations) ...
elevator.on("idle", function() {
// let's go to all the floors (or did we forget one?)
elevator.goToFloor(0);
elevator.goToFloor(1);
});
},
update: function(dt, elevators, floors) {
// We normally don't need to do anything here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment