Question: Create the maze Get a pointer to the start. Make another pointer for a Cell Make a stack Push the start on the stack Draw

 Create the maze Get a pointer to the start. Make another

Create the maze Get a pointer to the start. Make another pointer for a Cell Make a stack Push the start on the stack Draw the maze Start the two counters (total steps, steps in path) While the stack is not empty Get a pointer to the cell on top of the stack (current cell) If it' s the end, were done Update counters Update symbol to X Break out of loop Update the current cell's symbol to o Draw the maze Get a pointer to a neighbouring cell If the neighbour exists Update counters Update current cell's symbol to o Push the new cell on the stack If there are no valid neighbours, we backtrack Update counters Set symbol to . Pop the cell off the stack Make the program sleep a so it prints nicely (I did 250ms) Print out the counters Draw the maze one final tie Delete things Create the maze Get a pointer to the start. Make another pointer for a Cell Make a stack Push the start on the stack Draw the maze Start the two counters (total steps, steps in path) While the stack is not empty Get a pointer to the cell on top of the stack (current cell) If it' s the end, were done Update counters Update symbol to X Break out of loop Update the current cell's symbol to o Draw the maze Get a pointer to a neighbouring cell If the neighbour exists Update counters Update current cell's symbol to o Push the new cell on the stack If there are no valid neighbours, we backtrack Update counters Set symbol to . Pop the cell off the stack Make the program sleep a so it prints nicely (I did 250ms) Print out the counters Draw the maze one final tie Delete things

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!