Hi all,

Have a question regarding an assignment. In a previous assignment we had to implement a program that allows us to enter a system of connected caves within an underground labyrinth. How this is implemented shouldn't matter for this next assignment though.

In this assignment, we have to use recursion with a depth first search to search an existing labyrinth for a random cavern. This is done by inserting an actor into the labyrinth at the entrance. We have to search the entire labyrinth using a depth first search. When we find the random cavern, the actor retraces it's steps to the entrance. To eliminate the problem of dead ends and infinite circles, the actor marks each cavern as it passes through.

The only possible directions to move are North, East, South and West. We are supposed to check the caverns in that order as well. I have a function called BeginSearch that clears all marked caverns, inserts the actor, and calls the DoSearch function. The recursive calls are supposed to be within the DoSearch function.

I can't figure out if I'm supposed to use a while loop. I also can't figure out the exact layout of the if/else statements.

Any help on the format of this would be appreciated,


You may wanna post you've tried thus far.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.