Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c program :You are now allowed to use the following in additional to the techniques of the previous chapters: pointers pointer operators pass by reference

c program :You are now allowed to use the following in additional to the techniques of the previous chapters: pointers pointer operators pass by reference simulation const qualifiers sizeof operator function pointer

character handling library string handling library string conversion functions additional input/output functions from getchar() fgets() putchar() puts() sprintf() sscanf()

Q1: (Recursive Maze Traversal) The following grid is a double-subscripted array representation of a maze.

The # symbols represent the walls of the maze, and the periods (.) represent squares in the possible paths through the maze. Theres a simple algorithm for walking through a maze that guarantees finding the exit (assuming theres an exit). If theres not an exit, youll arrive at the starting location again. Place your right hand on the wall to your right and begin walking forward. Never remove your 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 youll arrive at the exit of the maze. There may be a shorter path than the one you have taken, but youre guaranteed to get out of the maze. Declare and initialize a 2-D array of characters using the maze given above. Write a recursive function mazeTraverse to walk through the maze. The function should receive as arguments a 15-by-15 character array representing the maze and the starting location of the maze. You may use a 15x16 maze if you want to initialize the 2-D array using strings instead of individual characters. You may pass additional parameters to your recursive function call if needed. As mazeTraverse attempts to locate the exit from the maze, it should place the character '.' in each square in the path that it steps on to show the progress. The function should display the maze after each move, so the user can watch as the maze is solved.

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions