Hello I'm working on my final C programming project which is a maze runner and I need major help! below is the list of specs and directions for the maze runner program. any help is appreciated. thank you in advance!
The competition maze consists of a 16x16 grid of "cells". At each grid point there is a "post" (the '+' in my sample maze), and each post wil have at least one wall attached to it except the post in the center of the maze, which will have no walls attached. The walls span from one post to another, and there is a border of walls completely arouund the outside of the maze (mice cannot escape the playing field).
The mouse starts in the "start cell", in the lower left (South West corner) facing North. The start cell will have 3 walls: West, South, and East. The mouse's goal is the "center square", which consists of 4 cells at the center of the maze. There is only one entrance to the center square. The mouse knows nothing else about the configuration of the maze when it starts other than its location (cell 0:0), and the location of the center square.
In the real competition, the fastest run from the start cell to the center square is a mouse's "run time". Mice may make as many runs from the start to the center as they want within their 10 minutes in the maze. Mice who do not find the center are ranked according to how many unique cells (cells visited the first time count as unique cells; visiting a cell again does not add to their score). Mice that "crash" into walls may be removed from the maze, but must start again in the start cell if they wish to continue competing (a 30 second penalty is added to the fastest run time for mice that renenter the maze after being removed).
For our simulator, we will not be concerned about time, only navigation through the maze, finding a path to the center, and counting the cells and unique cells visited. In our simulator, the West to East direction will be the direction of increasing X coordinates; and the South to North direction will be the direction of increasing Y coordinates.
The Details
We will build the simulator at one of 4 Levels. Your grade for the project will be determined by the highest Level features your program implements (and that work) as shown on the Gradesheet. Iwould reccomend that you begin at Level 0, and work your way up as time allows. As described below, I will provide you with a Display module which will implement the on-screen and other features as detemrined by the Level. The user of the program can quit at any time with the 'q' command.
Level 0: Drive the Mouse
At Level 0, the maze is predetermined by the Display (from the file maze.dat) and visible to the user. The mouse has no intelligence; it cannot decide how to moved on its own. The mouse is directly controlled by the user with the following commands:
* a -- turn left
* s -- turn around
* d -- turn right
* w -- move forward one cell
(NOTE: I have changed the spec from its previous draft. The turn commands only turn the mouse; they do not move the mouse forward. I found this more natural control of the mouse).
At Level 0, the simulator keeps track of the X and Y coordiantes of the mouse as it moves. The simulator may or may not test for "crashes" into walls (my demo allows the mouse to cheat and move through walls), but it must keep the mouse withing the bounds of the maze.
Level 1: The Mouse Discovers
At Level 1, the Display only shows a "template" maze; with only the outside borders, the posts, and the start cell walls visible (from the file maze.template). However, the Display does keep track of the full configuration of the maze from the file maze.dat and provides functions for the simulator to access cell walls for a given coordinate and to draw walls on the screen at a given coordinate.
The user at Level 1 has the same movement commands as in Level 0, as well as the additional commands:
* r -- move one cell as a right wall hugger
* l -- move one cell as a left wall hugger
* m -- show the full maze (cheat)
to let the mouse discover the maze as either a left or right wall hugger, on e step at a time. In addition, Level 1 provides a "cheat" command to reveal the full configuration of walls in the maze. The simulator will keep track of the mouse's position in the maze as in Level 0, and also adds a count of how many cells the mouse has visited since leaving the start square (including revisted cells). In addition, the user has a "Mouse Cam" at LEVEL 1, displayed under the control of the simulator using a function in the Display. The Mouse Cam shows the mouse's view of the walls on its left, front and right sides.
At Level 1, the simulator should also detect crashes into walls (hopefully only occuring when the mouse is driver by the user), and allows the user to restart at the start square.
I recommend that you implement and test ALL features at Level 0 before proceding on to Level 1.
Level 2: The Mouse Explores
At Level 2, the Display again shows only the template maze (from the file maze.template), but does NOT keep track of the configuration of the walls in the maze. It is up to the simulator to declare and maintain its own hidden maze. You may use my maze.dat file to initialize your maze, or come up with a method of your own. (Be sure to submit any data files needed to configure your maze).
The user may use any of the commands at Level 0 or 1 at Level 2, with one additional command provided:
* n -- hide the unknown maze (uncheat)
This command allows the user to "peak" at the maze using the 'm' command from Level 1, and then hide the unknown walls again using the 'n' command. As in Level 0 and 1, the position, cell count, and Mouse Cam are displayed in Level 2. In addition, the simulator should show a count of "unique" cells, i.e. cells counted only the first time the mouse visits. Level 2 also include the crash detection from Level 1.
I recommend that you implement and test ALL features at Level 1 before proceding on to Level 2.
Level 3: Da Frills
For a small additional reward, Level 3 allows the programmer to add whatever "Frills" they can imagine and implement. All of the commands and display features of Level 2 must be present to claim this reward. In addition, one more command is provided:
* [sp] -- mouse's choice to move
This command moves the mouse one cell in a direction determined by any "solving algorithm" you choose (may be random, may be more sophisticated).
here are all the prototype functions for this project:
Code:
/* File: display.h
*/
/* NOTE: this file is under construction */
/* This file contains the prototypes for useful funcitons in the display.o
library */
void init_display(int level);
/* This function initializes the display environment and clears the screen
and draws the template maze from the local file maze.template. The
parameter, level, determines the level of difficulty (see the spec).
For Level 0 and 1 it also initializes the maze from the local file
maze.dat.
*/
void show_mouse(int dir, int row, int col);
/* This function shows the mouse at the row and col position headed in
the direction dir. Available at all levels.
*/
void write_message(char str[], int line);
/* This function writes the given message at one of the lines (0 to 10)
on the bottom of the screen. The string is truncated at 64 characters.
Available at all levels.
*/
void clear_screen(void);
/* This function clears the screen and shuts down the display environment
Available at all levels.
*/
void show_position(int y, int x);
/* This functions displays the position under the X and Y on the right
of the screen. Available at all levels.
*/
void show_cells(int cells);
/* This function displays the number of cells explored under CELLS on the
right of the screen. Available at Level 1 and higher.
*/
void show_unique_cells(int cells);
/* This function displays the number of unique cells explored under
UNIQUE CELLS on the right of the screen. Available at Level 2 or higher.
*/
void mouse_cam(int left, int front, int right);
/* This functions displays the mouse view of left, front and side walls
under MOUSE CAM on the right side of the screen. Available at all
levels.
*/
void lvl0_get_walls(int y, int x, int *North, int *East, int *West, int *South);
/* This function indirectly returns the walls (1 for present, 0 of absent)
in the cell y, x from the internal maze. Avaliable only at Level 0
or 1.
*/
void put_walls(int y, int x, int North, int East, int West, int South);
/* This function shows the given North, East, West and South walls
(1 for present, 0 for absent) for the cell y, x on the screen.
Avaliable only at Level 1 or higher.
*/