Traffic light with pedestrian crossing
Red, green, amber — plus the button that actually does something. A narrated state machine everyone has met.
A traffic light is the state machine you meet every day: it is always in exactly one state, and it only moves along fixed transitions.
Red
Red. Cars stopped. The machine will happily stay here forever until a timer — or a pedestrian — says otherwise.
Red + Amber
Red plus amber together is the get-ready state. It exists purely so drivers can prepare — a state whose whole job is politeness.
Green
Green, and traffic flows. Notice the machine has no memory of how it got here — a state is a complete description of now.
Amber
Amber means the decision has already been made: stopping is coming. Three seconds to wind down.
Pedestrian WALK
And here is the interesting one. Press the button at the crossing and the machine takes a different transition entirely — the walk state holds every car while the green man lights up.
Watch it explain itself
Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.