How would you design an elevator algorithm ?
Solution 1:
Solution 2:
Elevator class: it has states such as up/down/stand/maintenance, current floor, list of floor requests sorted in the direction.
Elevator bank class: contains elevators and receives requests from the floors. It has scheduling such as:
if available pick a standing elevator for this floor.
else pick an elevator moving to this floor.
else pick a standing elevator on an other floor.
else pick the elevator with the lowest load.