can anybody have idea about maze traversal in c++ language #

Recommended Answers

What specifically about it?

Jump to Post

All 8 Replies

Get an idea of a starting point and the destination point.
Once at starting point you can navigate north/south etc to a new location, if the new location is not the destination use recursive call of the function until destination reached. As something cool would be to print out visited paths and print out the path from source to destination ;)

If the maze has an entrance and exit just keep going left and you'll get out.

If the maze has an entrance and exit just keep going left and you'll get out.

I beleive your reffering to the left-hand rule... Implementing it is a little bit more involved. There's a condition that all of the walls need to be attached to one another. You put your left hand on a wall, and don't ever take it off, and walk. Since all of the walls are simply connected, you are guerenteed to explore all of the sides of the walls, and you must find the exit if it exists.

Can anyone provide the code for maze traversal.

No. We dont just give code. show us what code you have and what is wron with it and we can help you with that.

I'll start you off

  1. Can I go right?
  2. If so, go right (call itself, go back to 1).
  3. If I can't go right, then can I go straight or left?
  4. If possible, go straight first, otherwise go left.
  5. Otherwise, go back.
Be a part of the DaniWeb community

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