You are here:

C++/maze algorithm

Advertisement


Question
Hi,
I was taken an experiment that is the solution of maze problem, but I cannot solve it.I can find only one solution in the maze with my algorithm, but I must find all possible paths in maze.Also, your sites' Java part provides a solution for maze but only one path.
Please help me.Can you give me an algorithm for it or source code?Thank you very much.

Answer
Hello John. I'm happy to help but I cannot say why you are finding only one solution without seeing your code. I can guess that it would be pretty easy to change your code to find all solutions. I suspect that you are using some kind of recursive search algorithm with backtracking. The trick would be to not stop the recursion after the first solution.

Please post your code. If the maze data is in some kind of file, post that too. If you are worried about others seeing your code, make a new private question or send it to zlatko.c.help at gmail.com

Best regards
Zlatko

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

I can answer questions about C / C++ programming, software design, algorithms, and interprocess communication. I have access to Microsoft Visual Studio and gcc as my development platforms.

Experience

I have been developing software professionally for UNIX and Microsoft Windows since 1991.

Education/Credentials
I have a Bachelor of Applied Science in Computer Engineering from the University of Waterloo located in Waterloo, Ontario, Canada.

©2012 About.com, a part of The New York Times Company. All rights reserved.