title: Saving coordinates of path in recursive maze solver?
body: <p>I have a recursive maze solver algorithm that can successfully work its way through the maze. The only problem is that I can not find a way to save the shortest path between the starting point and the ending point. How would I save the coordinates of the shortest path?</p>
  
  <p>This is the recursive function</p>
  
  <pre><code>void Solve_Maze(int coorx,int coory) {
      if((coorx&gt;=0)&amp;&amp;(coorx&lt;l)&amp;&amp;(coory&gt;=0)&amp;&amp;(coory&lt;w)) {
          if((Map[coorx][coory]==Start)||(Map[coorx][coory]==path)) {
              Map[coorx][coory]=visited;
              Solve_Maze(coorx+1,coory);
              Solve_Maze(coorx-1,coory);
              Solve_Maze(coorx,coory+1);
              Solve_Maze(coorx,coory-1);
          }else if(Map[coorx][coory]==End) {
              delete Map;
              Solved=true;
          }
      }
  }
  </code></pre>
  
  <p>After adding a vector to store the coordinates I got this output</p>
  
  <pre><code>(1,2)
  (2,2)
  (3,2)
  (4,2)
  (5,2)
  (6,2)
  (7,2)
  (8,2)
  (9,2)
  (7,3)
  (7,4)
  (7,5)
  (7,6)
  (8,6)
  (8,7)
  (9,7)
  (10,7)
  </code></pre>
  
  <p>It stores all of the coordinates but it even stores the coordinates of the path we do not want to take ((7,2)(8,2)(9,2) and then back to (7,3)). Is there a way that I can store just store the shortest path?</p>