Question: Please Answer in C Suppose you are stuck in a maze of rooms and each room has one door. Now, you want to determine if

Please Answer in C

Please Answer in C Suppose you are stuck in a maze of

Suppose you are stuck in a maze of rooms and each room has one door. Now, you want to determine if there is an exit from the room that you are currently at or is it a infinite loop. You found a map that you decided to simplify using a 2D array (figure:1) and trace your options. To do so you jolted down the following steps: (a) Create a 2D array, "maze, of n x m size. Populate it as shown in figure:1 and print it. (b) Take the users position and determine if you can get out of the maze or if you are stuck in a loop. If you can get out print the index number of that room. (Hint: Mark the rooms you already visited.] Sample Output 01: You got out at maze ze[0][4] Sample Input 02: Starting point maze[4][0] Sample Output 02: You are stuck in a loop!! I, 4 1 1 31 2 4) 2 31 2 1 31 1 1 1 31 3 31 2 1 1 1 1 4 4131 31 413 41 31 2 2 2 2 31 1 m Figure 1: Maze [1 means Right, 2 meas Left, 3 means Up and 4 means Down]

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!