(Gaming) Consider the system of caves that Project 9 in Chapter 1 describes. Suppose that you can enter this system through only one cave and exit the system only through a different cave. Now imagine that you wake up in a cave somewhere within this system of caves. A sign indicates that an exit exists within five caves from your present location. Design an algorithm that searches through the caves for the exit. Hint: As you visit each cave, mark it and place it on a stack. If you have visited all the caves connected to the current cave, but have not found an exit, pop the cave off the stack.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here