Question
I need to write a program in C to solve text based mazes. The usage of the program is: mopsolver [-hdsp] [-i INFILE] [-o OUTFILE]
I need to write a program in C to solve text based mazes. The usage of the program is:
mopsolver [-hdsp] [-i INFILE] [-o OUTFILE] where the options are:
-h print this help message stdout and exit
-d display the maze after reading (Default: off)
-s print shortest solution steps (Default: off)
-p print an optimal path (Default: off)
-i INFILE read maze from INFILE (Default: stdin)
-o OUTFILE write all output to OUTFILE (Default: stdout)
The entrance for the maze will always be (0,0) and the exit will always be (N-1, M-1) where n is the number of rows and m is the number of columns. We want to move from the top left of the maze to the bottom right. The format of the maze is one or zero seperated by a single space and each line ends with a newline right after the last digit, where 0 is an empty space and 1 is a wall. We can assume all rows contain the same number of elements. The data can come from standard input or a user specified file. An example of a maze would like like:
0 1 1 1
0 0 0 1
1 1 0 1
1 1 0 0
When given this input we must determine if it is solvable and be able to print out the solution. An example of the printed output would be:
|--------|
+ * * * |
| +++* |
| .* + * |
| . * ++|
|--------|
Where the + signs indicate the solution, . represents an open space, and * represents a blocked location.
We should put our code in a file called mopsolver.c
Please read the prompt carefully and be sure to include ways to handle each command line argument, this assignment is due soon and I could use whatever help I can get.
Thanks.
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