FSM
This is making use of the finite state machines and there are three states - UP , DOWN , HALT and using recursive calls within each state to call the other states this is compiled in python and two objects are made to check the shortest path in every possible path i.e , initially either up or down