Elevator Saga The elevator programming game

Wiki & Solutions Documentation Help

Challenge #1: Transport 15 people in 60 seconds or less

2x

0
1
2
0 012
Transported0
Elapsed time0s
Transported/s0.00
Avg waiting time0.0s
Max waiting time0.0s
Moves0
x
15
 
1
{
2
    init: function(elevators, floors) {
3
        var elevator = elevators[0]; // Let's use the first elevator
4
5
        // Whenever the elevator is idle (has no more queued destinations) ...
6
        elevator.on("idle", function() {
7
            // let's go to all the floors (or did we forget one?)
8
            elevator.goToFloor(0);
9
            elevator.goToFloor(1);
10
        });
11
    },
12
    update: function(dt, elevators, floors) {
13
        // We normally don't need to do anything here
14
    }
15
}

Confused? Open the Help and API documentation page