Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MY QUESTION IS 8.17 C++ PROGRAM 8.16's SOLUTION CAN BE REACHED FROM CHEGG SOLUTIONS HOW TO PROGRAM C++ 8TH EDITION 8.16 (Maze Traversal) The grid

image text in transcribed

MY QUESTION IS 8.17 C++ PROGRAM 8.16's SOLUTION CAN BE REACHED FROM CHEGG SOLUTIONS HOW TO PROGRAM C++ 8TH EDITION

8.16 (Maze Traversal) The grid of hashes (#) and dots (.) in Fig. 8.22 is a two-dimensional array representation of a maze. In the two-dimensional array, the hashes represent the walls of the maze and the dots represent squares in the possible paths through the maze. Moves can be made only to a location in the array that contains a dot. There is a simple algorithm for walking through a maze that guarantees finding the exit (assuming that there is an exit). If there is not an exit, you'll arrive at the starting location again. Place your right hand on the wall to your right and begin walking forward. Never remove your 372 Chapter 8 Pointers hand from the wall. If the maze turns to the right, you follow the wall to the right. As long as you do not remove your hand from the wall, eventually you'll arrive at the exit of the maze. There may be a shorter path than t follow the algorithm. he one you've taken, but you are guaranteed to get out of the maze if you g. 8.22 Two-dimensional array representation of a maze Write recursive function mazeTraverse to walk through the maze. The function should receive arguments that include a 12-by-12 character array representing the maze and the starting location of the maze. As mazeTraverse attempts to locate the exit from the maze, it should place the character X in each square in the path. The function should display the maze after each move, so the user can watch as the maze is solved. 8.17 (Generating Mazes Randomly) Write a function mazeGenerator that randomly produces a maze. The function should tak pointers to the int variables that represent the row and column of the maze's entry point. Try function mazeTraverse from Exercise 8.16, using several randomly generated mazes. e as arguments a two-dimensional 12-by-12 character array and

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions