matthewp / robot

🤖 A functional, immutable Finite State Machine library

Home Page:https://thisrobot.life

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deadly traffic light

hypeJunction opened this issue · comments

let machine = createMachine({

So I was looking at that example and was lost for a minute. A traffic light goes from green to yellow to red to yellow to green. In your example it just loops.

Is this a cultural thing? In the U.S. traffic lights do not go from red to yellow to green.

Woah. I have learnt something new today. From a pedestrian perspective seems quite dangerous that there is no warning that cars are about to run over you, but then again US has no pedestrians, so I suppose it's cultural. https://m.youtube.com/watch?v=bznLyIHX7nA

We have a separate pedestrian light that usually counts down from 10 when it is about to turn red. There's even an example of such a crosswalk here: https://thisrobot.life/guides/nested-states.html (though without the countdown)