← The arcade

Machines · difficulty 2 of 3

Traffic light state machine 🚦

Cycle a UK traffic light: red, red+amber, green, amber, back to red. Print the first 6 states, then the state after 25 ticks from red.

This one is part of Pro. Plenty of arcade challenges are free to play right now.

Skills: dicts, if/else, loops

Open the arcade