recursion maze backtracking program?

Need help getting started.

I need to use backtracking to find and print the path through the maze and find the gold nugget (*).

The maze is represented by a two-d array (11by11). The border is surrounded by X's and the path is represented by 'O'. We start at [1,1]

I really need help on the recursion function.
Last edited on
I think this should go to the beginners section.
And read this : http://www.cplusplus.com/forum/beginner/1/
Read the following post regarding using recursion to solve mazes:
http://www.cplusplus.com/forum/general/76307/
This is what I have so far. I tried the recursive function in words:
1
2
3
4
5
6
7
8
9
10
11
12
//code in words

//bool Solve (board){
//if(no more choices)  //basecase
//return (board is good)
//For (all avalible choices)
//try choice a;
//if (solve(a)) return true;
//else
//undo choice a;
//return false;
//} 


I just don't know how I would do this in code or if it will even work. I am still writing the main function to open the txt file containing the maze.

also here is a pic of the assignment: http://i49.tinypic.com/357ndyb.jpg
Last edited on
Topic archived. No new replies allowed.