Naive implementation of depth first walk of the state space