Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

Students also viewed these Databases questions

Question

6. Describe to a manager the different types of distance learning.

Answered: 1 week ago

Question

1. Explain how new technologies are influencing training.

Answered: 1 week ago