Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions