Hullo. My latest assignment in computar class has me trying to create a maze solver. Now it is not necessary for the computer to solve for the shortest path, however there are delicious extra marks if it does. I've already figured out how to solve the maze - using the recursive backtracking technique. I know a breadth search is used to find the shortest path in a maze solving problem. However I am having great trouble in trying to implement this algorithm (recursively).

Now, this isn't done in the C programming language, its suppose to be done in Java. But the syntax is so similar you can post C code and I'll be able to tell what it is.

Here's what I have so far (this is the recursive method).

The maze is broken up into 'nodes'

Maze: (S is start X is exit * is path and B is border)
BBBBBBB
B****BB
X***SBB
BBBBBBB

Nodes:
'0' '1' '2' '3' '4' '5' '6'
'7' '8' '9' '10' '11' '12' '13'
'14' '15' '16' '17' '18' '19' '20'
'21' '22' '23' '24' '25' '26' '27'

Now you start at S and place that node into an array specifically meant to hold nodes. Then you look up, down, left, and right for any 'path' symbols. If there is path symbol, place it in a que array. Then recursively call the method turning the recently discovered que into the new node. Continue until exit is found. I've tried doing this but it doesn't work. It will find the exit, but it is not the shortest path. Is there something I'm missing from the algorithm? I'm having some trouble understanding the algorithm, this is what I've got out of it so far.