My Paper Writer » Essay Blog » Computer Science Essays Help » A C program Assignment 6

A C program Assignment 6

Assignment 6


Use recursion to identify all the points on the paths in a maze.


A text file called map_6.txt is available on Black Board. When you open and view this file in notepad or some other text editor, you should see something similar to the figure below.


The location of the Xs indicates the paths in a maze. Everything else is off the path. Start by creating symbolic constants for the height and width of the map (#define), which is 78 by 21 respectively. Declare a double-dimensioned array called “map” which will hold information about where the paths are. The size of the map will be defined by the width and height constants.

Write a function Read_Map to open the map_6.txt file and populate the map array with the number 1 at each row and column where the X appears and 0 other wise. Write another function DisplayMap todisplay the map on the screen. Represent all 0s as the character with the ASCII code 176, and all the 1s as a blank space. You should end up with a figure similar to the one below (without the borders)


Write a function FindEntry, to locate the starting row for the first column of the maze (first non zero element). Write a function FindPath to mark all the empty paths in the maze through recursion. Use the output from the FindEntry function as the starting point for the recursion.

The DisplayMap function should be modified to display a dot (ASCII 249) where the map entry is 2. Your program should Read the map, call the DisplayMap function to show the map with the empty path, call FindPath function and to mark all the points on the path, and then call DisplayMap function again to show the final map.

Extra Credit (+10): Add the borders around the image.


Last Updated on October 31, 2019

Don`t copy text!