State machines are so common that there are tools devoted to creating them by drawing circles and arts. There are simulators that will recognize your state machine ...
Imagine a robot with an all-around bump sensor. The response to the bump sensor activating depends on the previous state of the robot. If it had been going forward, a bump will send it backwards and ...