Question: C Programming- Maze Game: The layout of the maze is given below. + suggests a block or wall that cannot pass. . is a passable

C Programming- Maze Game: The layout of the maze is given below. + suggests a block or wall that cannot pass. . is a passable tile. * is your start/current location and E is the exit/goal.

#include #include int main(){ FILE *fptr; char ch; int i = 0, j = 0; fptr = fopen("---input your own directory of file here---", "r"); if (fptr == NULL) { printf("Cannot open file "); exit(0); } while ((ch = fgetc(fptr)) != EOF) { if (ch == ' ') continue; if (ch == ' '){ j=0; i++; continue; } if (ch == '*'){ x = i; y = j; } maze[i][j++] = ch; } fclose(fptr); return 0; }

a. Read the maze layout from the text file and put it into a 2D array.

C Programming- Maze Game: The layout of the maze is given below.

b. Write a function to print the maze.

c. Write a function that accepts a direction {u,d,l,r} and moves the asterisk 1 tile toward that direction. The function should alert the user with invalid move if it runs into a wall and the asterisk should stay still. The function should also tell the user when the exit is reached.

d. Write a loop to prompt the user to input a direction at each step until the exit/goal is reached.

C C Programming- Maze C C Programing. Maze Trav Hw3pdf ? ? ?? Secure ! https://blackboard.gwu.edu/bbcswebdav/pid?8644884-dt-content-rid-32446401-2/courses/35188-201801/Hw3.pdf points) write te a Tunctron + a R ^ qx 4/24/2018 10:43 AM O Type here to search D e C C Programming- Maze C C Programing. Maze Trav Hw3pdf ? ? ?? Secure ! https://blackboard.gwu.edu/bbcswebdav/pid?8644884-dt-content-rid-32446401-2/courses/35188-201801/Hw3.pdf points) write te a Tunctron + a R ^ qx 4/24/2018 10:43 AM O Type here to search D e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!