Can you please provide some pseudo code to display the path of a maze?
<p>I am trying to write an algoritim to find and display the path in a maze.</p>

<p>The maze outline is read from an input file and stored in a 2D array. </p>

<p>I need to start the maze at point (1,1) and find any path through the maze. </p>

<p>I have a findpath()  method which I am able to find the exit with what i have written but after finding the exit I need to display the path i took to get there by popping the stack(this I am currently unable to do and is what I need assistance with). Upon finding the goal the stack should be popped to completion and will contain only the path taken to find the goal. (at this point i will just change the value inside those rooms but i know how to do that)</p>

<p>Please review where my pushes are occurring and provide some guidance as to what order things should be pushed and popped off so that the above criteria is met. </p>

<p>Any assistance is greatly appreciated. Thank you. </p>

<p>here is the current output: The o was originally an empty space but when detected as goal it was changed</p>

<pre><code>********************
*     *            *
** ** ***** ** *****
*  *  *      * *   *
*  *    *    * * * *
*       *        * *
*************  **  *
*                  O
********************
</code></pre>

<hr>

<p>Code:</p>

<pre><code> public void findPath() {  
    Room start = rooms[1][1];
    push(start);
    while(!isEmpty()) { 
        current = pop();
        System.out.println("The value stored in current is" + current.getValue()+ "");
        if (current == null) 
            System.out.println("current is null");
        //This is finding the goal the walls will contain a * 
        else if(current.getValue() == ' ' &amp;&amp; current.getRight() == null || current.getValue() == ' ' &amp;&amp; current.getLeft() == null || current.getValue() == ' ' &amp;&amp; current.getUp() == null || current.getValue() == ' ' &amp;&amp; current.getRight() == null){
            current.setValue('O');
            for(int i = 0; i &lt; tos; i++ ){
                pop();
            }

        System.out.println(" I found the end here is the path:" + current.getPrevious().getValue()+ " jjj");
        } else if(current.getBlocked() == false &amp;&amp; current.getVisited() == false) {
            System.out.println("pushing currents neighbors left, right....etc" +  "current is at" + current.getCord());
            current.setVisited(true);
            if(current.getRight() != null){
                current.getRight().setPrevious(current);
                push(current.getRight());
                System.out.println("Inside push 1" +current.getRight().getCord());
            } else {
                System.out.println("Inside push right is null");
            }
            if(current.getLeft() != null) {
                current.getLeft().setPrevious(current);
                push(current.getLeft());
                System.out.println("Inside push 2 " + current.getLeft().getCord());
            } else {
                System.out.println("Inside push left is null");
            }
            if(current.getUp() != null)  {
                current.getUp().setPrevious(current);
                push(current.getUp());
                System.out.println("Inside push 3" + current.getUp().getCord());
            } else {
                System.out.println("Inside push up is null");
            }
            if(current.getDown() != null) {
                current.getDown().setPrevious(current);
                push(current.getDown());
                System.out.println("inside push 4" + current.getDown().getCord());
            }
        } else {
            System.out.println("Inside push down is null");
        }
    }
    for(int i = 0; i &lt; rows ; i++) {
        for(int j = 0; j &lt; columns ; j++) {
            System.out.print(rooms[i][j].getValue());
        }   
    System.out.println();
    }
}
</code></pre>
