Finite-state machines can be improved in terms of having different layers or hierarchies. The principles are the same, but states are able to have their own internal finite-state machine, making them more flexible and scalable.
Improving FSMs: hierarchical finite-state machines
Getting ready
This recipe is based on top of the previous recipe, so it is important that we first grasp and understand how the finite-state machine recipe works.
How to do it...
We will create a state that is capable of holding internal states, in order to develop multilevel hierarchical state...