Maze Following Robot Logic

hi..

The simplest maze solution algorithm is in fact the recursive solution but it does require you to do some research into recursive techniques, its a lot simpler than brute force since you do bot need to store mapping and then use vast conditional analysis to determine where you have been .

If you look at the solution based on orthogonal movements only and use a senario similiar to..

  1. you are in a room (A), it has doors beyond any door could be the exit.

  2. Set up rules such as
    Left door first

  3. Go through Left door .. you are in a room(B) it has doors any door could be the exit

4 Set up rules such as
Left door first

So at 3. above you are recursively calling 1. - its not a jump to 1 its a recursive call, otherwise you have lost the info that you went from ( room A) originally

Keep recursively calling after using Left door until you exit or get to a room that has no left door, if there is no left door then this route will not work, so return through one room and apply your next rule in door selection .. then recursively continue till no doors

You will eventually find the exit door .. This is not the most elegant recursive solution but it works

you will find a more detailed academic discussion https://www.cs.bu.edu/teaching/alg/maze/ written by a good friend of mine..

hope it helps