public int Move() { moveCount++; Leaf now = st.Peek(); Leaf next = now.GetNextLeaf(); if (next != null) { next.Cross = false; st.Push(next); //System.Diagnostics.Debug.WriteLine(moveCount + ":" + now.Name + " -> " + next.Name); if (next == marsh.goal && marsh.isComplete()) { return(1); } } else { next = st.Pop(); //System.Diagnostics.Debug.WriteLine(moveCount + ":" + now.Name + " back"); if (st.Count == 0) { return(-1); } } return(0); }