Block interview question

Design an algorithm to control an elevator.