Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

More Books

Students also viewed these Databases questions

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago