Maze project

profilen_thanmek
maze_runner.pdf

Project 3

Maze Runner

Due: 10th October 2017

Overview

In this project we will revisit the logic of maze solving from earlier in the course, this time providing an actual C implementation to solve the problem. In the course of this project, you will get more practice with all of the fundamental programmatic structures of C as well as experience using external library code. Finally, you will need to create your �rst real `.h' �le so that your code can be interfaced with externally.

Submission Instructions

Submit only the .c and .h �les that you created along with your Make�le, but do not zip them!

Additionally, be sure your make�le produces an executable called �maze_runner� so that my test script can run it.

Technical Description and Instructions

In this project, you will not write a full program. I have already written most of a program to solve randomly generated mazes. The parts that I have written generate the maze and provide functions through which the maze can be interacted with. Additionally, the parts that I have written rely on calling some functions that will solve the maze. Implementing those functions is your job!

Your Two Files

You must create two �les for this project: �runner.c� and �runner.h�. Runner �.h� should expose two functions to the rest of the program called runner_solve() and runner_init(). The �rst function will utilize the maze library functions I've provided to solve a maze1. The second function simply performs any setup necessary for the runner_solve() function to run. These two functions should be implemented in the �runner.c� �le.

You may create as many helper functions as necessary to support your runner_solve() function2. Likewise, you may use any reasonable algorithm to actually solve the maze. Your runner must leave behind a trail of `breadcrumbs' as it moves through the maze (see ?? for details).

Program Output

Program output is actually handled for you on this one! The maze_runner.c �le I've provided for you will call print_maze() for you to show both the unsolved maze and the maze after your runner has �nished.

However, you must accurately show the path that was taken by your algorithm to solve the maze. This is done by using the maze_set_char() function as your `runner' moves through the maze. When the runner crosses an empty square, it should leave a '.' behind. When it crosses a '.', it should leave an 'o' behind.

1Descriptions of these maze library functions are in the comments of the mazelib.h �le provided. 2My implementation has around �ve.

1

When an 'o' is crossed, an 'O'3 should result. Finally, when an 'O' is crossed, an '@' should be left in its place.

Things to Remember and Helpful Hints:

Make sure you read all of the comments in the �mazelib.h� header �le! These comments will tell you all you need to know about interacting with the maze.

Grading Speci�cation

For your submission to receive a grade of `pass', it must ful�ll the following criteria:

� It must be submitted correctly.

� I must be able to compile your program simply by invoking �make� in a directory containing your code and Make�le.

� The program must compile with no warnings or errors.

� The program should run with no errors and output a legally solved version of the generated maze.

3Capital 'o', not a zero!

2