Card of the Week Contest #386: Finite State Machine