CSE Roadmap

Core tier · about 4 hours · 6 parts

Part 2 of 6 · 1 min read

Requirements

Calls from halls, presses inside cars.

Think of a lift in an office tower. A person on floor 4 presses "up". A car arrives, the person enters and presses 9. The car must remember both stops and visit them in a sensible order.

Questions and the answers assumed here:

  1. How many cars and floors? Several cars, one bank of floors.
  2. Which buttons? A hall call outside (up or down) and a floor button inside a car.
  3. Which order of stops? Serve stops in the direction of travel, then turn around.
  4. Who picks the car for a hall call? A dispatcher.
  5. Out of scope: weight limits, fire mode, and door sensors.

The numbered requirements:

  • R1. A car moves one floor per tick.
  • R2. A car has a direction: up, down or idle.
  • R3. A car visits every requested stop on its path before it turns.
  • R4. The door opens at a stop and closes on the next tick.
  • R5. A request for a floor outside the building is refused.
  • R6. A hall call is given to the car with the lowest cost, found by the dispatcher.
  • R7. A car with no stops becomes idle.

Sweep

A sweep is a pass in one direction in which every requested stop on the path is served before the direction reverses.

Example: a car at floor 0 with stops 2, 5 and 8 serves them in that order, and does not return to 2 until it has finished going up.

Check yourself: 1. Which two kinds of button exist? 2. What does a car do when its stops run out? 3. Why is a request for floor 12 in a 10-floor building refused?