Write a function that accepts an 8 by 8 array of characters that represents a maze. Each position can contain either an X or a blank. Starting at position (0,1), list any path through the maze to get to location (7, 7). Only horizontal and vertical moves are allowed. If no path exists, write a message indicating there is no path.

Moves can be made only to locations that contain a blank. If an X is encountered, that path is blocked and another must be chosen. Use recursion.

Addition specifications: The two dimensional array will be stored in a file. The filename will be passed as a command line parameter to main(). Instead of spaces, the letter O will indicate an open position. The only loop allowed in the program is the one to read in the maze from the file. The recursive function, find_path(), may only call itself and printf(). Hints: To avoid an infinite recursion, when you first come to a location in the maze, you should mark it with an 'X'. Just because you must print them out starting at (0,1), does not mean that your recursion must start there.

XOXXXXXX
XOXXXXXX
XOOOOXXX
XXXXOXXX
XXXXOOXX
XXXXXOXX
XXXXXOOO
XXXXXXXO
[ssdavis@lect1 p9]$ maze.out maze1.txt
(0, 1)
(1, 1)
(2, 1)
(2, 2)
(2, 3)
(2, 4)
(3, 4)
(4, 4)
(4, 5)
(5, 5)
(6, 5)
(6, 6)
(6, 7)
(7, 7)
[ssdavis@lect1 p9]$ cat maze2.txt
XOXOOOOO
OXOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
[ssdavis@lect1 p9]$ maze.out maze2.txt
No path was found.
[ssdavis@lect1 p9]$ cat maze3.txt
XOOOOOOO
OXXXXXXO
OOOOOOOO
XOXOXXXX
XOXOXOOO
XOXOXOXO
XOXOXOXO
XOXOOOXO
[ssdavis@lect1 p9]$ maze.out maze3.txt
(0, 1)
(0, 2)
(0, 3)
(0, 4)
(0, 5)
(0, 6)
(0, 7)
(1, 7)
(2, 7)
(2, 6)
(2, 5)
(2, 4)
(2, 3)
(3, 3)
(4, 3)
(5, 3)
(6, 3)
(7, 3)
(7, 4)
(7, 5)
(6, 5)
(5, 5)
(4, 5)
(4, 6)
(4, 7)
(5, 7)
(6, 7)
(7, 7)
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.