2 ms·
A person waiting for the elevator doesn't put anything into the queue. The loop for challenge 1 is: q: [] idle -> enqueue 0, 1, 2 --- q: [0, 1, 2] go to
by shagie 4y ago
A person waiting for the elevator doesn't put anything into the queue.
The loop for challenge 1 is:
q: []
idle -> enqueue 0, 1, 2 --- q: [0, 1, 2]
go to floor 0; (noop@floor0)q: [1, 2]
go to floor 1; q: [2]
go to floor 2; q: []
idle -> enqueue 0, 1, 2 --- q: [0, 1, 2]
go to floor 0; q: [1, 2]
...
It doesn't matter if anyone wants to go to that floor who is in the elevator or wants to get on the elevator at that floor.
https://play.elevatorsaga.com/documentation.html https://play.elevatorsaga.com/documentation.html
And then you get into the events... something like this would likely be interesting/chaotic.
elevator.on("floor_button_pressed", function(floorNum) {
elevator.goToFloor(floorNum, true);
})
- anigbrowl 4y agoI'm not having difficulty understanding the coding problem. I'm talking about how the comments would actually be misleading to a person who was.