Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A maze can be represented with a two-dimensional array in which nonzero entries

ID: 3554764 • Letter: A

Question

A maze can be represented with a two-dimensional array in which nonzero entries are walls and zero entries are passages. When printing a maze, nonzero entries could be printed as X's, and zero entries as spaces. As a path is being traced through the maze, it could be represented with 0's. For example, a 30*20 maze would look like this:

**********************************

00**                  ***                 *

* 0** **********      ********     *

*000** ** *******             *    *

* **0** ** **       * **   ***     *

****0**       ** ** *    *       *    *

**000**0******* ** **   ***     *

*00****0**    *** ** **           *

*0*****0**     *** ** **           *

*0000000**   *** ** **    ******

*************   *** ** **        ***

**   *    *    **           ** ****    **

**   *    *    **           **    **    **

**                               ****     **

*****      *******             ***    **

*             ****    ******    ***    **

*    **********   *****       ***    **

*    *            **   *****    ***     **

****    ***          *****             **

**********************************

Write a program that will read in such an array, and repeatedly prints it so the user can select the direction in which to move next. The user

Explanation / Answer

The name does not describe any specific algorithm for generating mazes, but rather simply identifies the class of maze, where some passages weave over or under other passages. It