Load each example and read it like code. First-Come takes item 1 of REQUESTS β whoever pressed first β and drives there no matter what it passes on the way: 3β10β2β8β5, crossing the whole building three times. Closest-First walks the list with STEP and BEST to find the nearest floor before every single move: 3β2β5β8β10, almost one clean sweep. Use β One block and watch BEST change in the lift's memory.
Watch First-Come on the Classic Puzzle: on its way from 3 to 10 it sails past floors 5 and 8 where people are waiting! Add the βis someone waiting on MY FLOOR?β diamond into its loop, wire YES to an OPEN DOORS block, and race again. One extra question, dramatically better numbers β that's what algorithm design feels like.
Run The Forgotten Floor with the Closest-First program. Someone presses on floor 9 at the very start, but the lower floors keep pressing and there is always someone closer. The average still looks fine β check π€ longest wait instead. This failure mode has a real name in computer science: starvation.
The Sweeper remembers a direction in DIR and finishes it before turning around β that's LOOK/SCAN, what real elevators do. Now add the βhas the FIRST person waited more than N ticks?β diamond at the top of your loop, and wire YES into a First-Come-style rescue (set TARGET to item 1, drive there). You've invented aging β the trick real operating systems use to stop starvation. Tune N: what happens at 5? At 30?
Your hard disk schedules read/write requests with SCAN β literally the elevator algorithm. Ride-sharing apps decide which car takes which rider. Hospitals triage patients; support queues answer tickets. Any time requests arrive over time and one server must choose an order, this is the game β and βwhich rule is best?β always depends on which metric you care about.