Question
C programing. Maze Traversal: The following grid is an array representation of a maze. The # symbol represents the walls of the maze, and the
C programing.
Maze Traversal: The following grid is an array representation of a maze.
The # symbol represents the walls of the maze, and the period (.) represents squares in the possible path through the maze. S is the starting location (Start) and E is the ending location (Exit)
There is a simple algorithm for walking through a maze that guarantees finding the exit (if there is an exit). If there is no exit, you will arrive at the starting location again. Place your hand on the wall to your right and begin walking forward. Never remove you 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 will arrive at the exit of the maze. There may be shorter path than the one you have taken, but with this algorithm, you are guaranteed to find your way out of the maze.
Write a program that will get you out of a maze similar to the above pictured maze. Your program must read the maze from a file. Organize your program for easy debugging and understanding using functions, arrays and other features of the C programming language we have learned so far to accomplish the task.
Print out the maze after each step has been taken and mark each current position with the letter x.
Test your program for the case where there is an exit and for the case where this is no exit (in which case you will end up back at the starting location)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started