Introduction
BFS
,fscanf
: [-d]
-d,-d
Requirement
EE20084 Coursework 2016
Page | 1
EE20084: C Programming Coursework 2016
S.R. Pennock B. W. Metcalfe
Introduction
This programming coursework is designed to allow you to develop your C programing
skills. The main objective of the coursework is to write a program that should solve a
maze puzzle, as described below. There are a number of extensions possible that will
allow you to gain additional marks. There are two all day laboratory sessions for this
unit, and you are expected to split your work into two distinct tasks as described below.
Automated tests will be used on your code to assess a mark and so it is very important
that you ensure that your code complies with the syntax and file formats described in
this document.
The Challenge
Your program should perform. the following tasks:
1. Read a maze from a file.
2. Work out a route from the start point to the end point of the maze.
3. If selected by the user, display the maze on the screen.
4. Write the solution to the maze to a file.
You may extend the work in any way that you wish, so long as it is obvious and does
not interfere with completion of the automated tests: Your code could print out a
message pointing out the extension.
Formats and syntax
The files read and written by your software are described here. Your software should
be as tolerant as possible of format errors in the input files and as precise as possible
in the format of the output files.
The Maze File
1) The file that describes the maze is a text file. The file contains whitespace (space,
tab or newline) separated integers. The first three lines of the file contain two
integers each.
2) The first line gives the number of rows and columns (in that order) in the maze.
3) The second line gives the start location for the maze solver as a row number
followed by a column number. These values are zero based and location (0,0) in
the maze is the top left.
4) The third line gives the end location for the maze solver in the same format as the
start point.
EE20084 Coursework 2016
Page | 2
5) All subsequent lines (one for each row as stated in the first line) contain a set of
integers (one for each column stated in the first line). The integer is a sum of
variables that indicate the presence or absence of a wall:
If the location has a wall above it the variable has 8 added to it.
If the location has a wall to the left of it the variable has 4 added to it.
If the location has a wall below it the variable has 2 added to it.
If the location has a wall to the right of it the variable has 1 added to it.
Here is an example of the contents of a maze file:
5 4
2 2
4 0
14 9 12 9
14 2 3 5
13 12 8 3
5 5 6 9
6 2 11 7
This is the maze it describes:
Column
Row
0
1
2
3
0
1
2
Start
3
4
End
The Solution file
Your program should output a text file with two lines:
The first line should be the number of moves required to get from the start
location to the end location.
EE20084 Coursework 2016
Page | 3
The second line should be a list of moves that will trace a path from the start
position to the end position without going through any walls. Each move is
represented by a single letter U, D, L or R for Up, Down, Left or Right
respectively.
Here is an example of the contents of a solution file for the maze given earlier:
4
LDDL
Program syntax
Your program should conform. to the following syntax so that it can be auto-tested:
ExecutableName [-d] MazeFileName SolutionFileName
Where:
ExecutableName is the name of your compiled program (perhaps
“my_great_solver.exe”),
“-d” text is present if the maze is to be displayed. The [ ] around the “-d”
means that is it optional. Your program must work whether it is there or not.
MazeFileName is the name of the maze file that should be read.
SolutionFileName is the name of the file in which the solution should be
stored.
Workplan
Lab 1: I/O
During the first laboratory session you should attempt to create the I/O framework for
your program. At the end of this session you should have a program that is able to read
and write files and display the maze correctly. You should include in your program, a
dummy solver function that produces a dummy solution for the I/O framework to
output. The first lab session is also an opportunity to discuss how your solver will work.
Tutorial Sessions
There is a tutorial session each Monday at 14:15. In the tutorial sessions up to week 8
there will be stand-alone tasks designed to help you understand the lectures. The tutorial
sessions from week 9 to 11 in are left clear for you to do exploratory work on your
solver.
Lab 2: The Solver
In the second laboratory session you should try to implement the solver algorithm itself.
EE20084 Coursework 2016
Page | 4
Assessment
There are three assessments for the coursework in this unit:
1. Design Document: A maze solver design document should be submitted via
Moodle by 4pm on the 21 st of November. This document should describe
your design for your maze solver. It does not need to describe the I/O
framework but it should include:
A description of the format in which data will be passed to and from the
main solver function and the syntax of the function call itself. A
description of how your solver will solve the maze.
A description of every function you plan to implement as a part of your
solver, and how this is to be tested.
A description of every data structure, array and enumerated variable you
plan to implement as a part of your solver.
2. Maze solver program: A maze solver program executable for the automated
test mark. This is due in via Moodle by 4pm on the 9 th of January 2017. You
will need to submit an executable (.exe) file that will be auto tested and a zip
file of your code (.h and .c files only). Do NOT submit your whole project
directory (marks will be deducted if you do this). The source code is to allow
recompilation of your code if needed. Make sure that your program runs as
expected on the computers in the undergraduate labs.
3. Final Report: A report covering the description of how the finished code
operates, documentation of the code, and the testing used on components of
the code and on the complete code should also be submitted via Moodle by
4pm on the 9 th of January 2017.
Opportunities for feedback
Various opportunities for feedback exist during the unit. There are tutorial sessions and
laboratory sessions where you can gain feedback from lecturers and demonstrators. In
addition the will be feedback on the maze solver design document that you submit via
Moodle.
Labs/tutorials: At the end of the lab/tutorial session, consider whether you have
successfully completed the tasks for that session or not:
Struggling: “The code didn’t work and I don’t know why”.
Basic: “The code compiled and sort of worked”.
Advanced: “I was able to spot out algorithmic and syntax errors before
compilation. I tested the code in detail and it always works the way that it
should”.
Software: We will provide feedback on software submitted (both the executable and
the source code)
EE20084 Coursework 2016
Page | 5
Marking
1. Design Document: This should cover the analysis of the problem, the outline
code structure you are proposing and an outline of the testing to be used. 20%
of the marks will be awarded for this.
2. The Maze Solver Code. This will run through a set of automated tests on your
submission the results will form. part of your marks. The automated tests will
be run on the executable you submit. The source code will be recompiled if
need be, for example if the source code and executable do not match. Source
code will be inspected for good readability, commenting and coding standards
according to the EE20084 coding standards document (available on Moodle).
40% of the marks will be awarded for this.
3. Final Report will be assessed on how well the code and its use are explained,
how well the testing strategies are explained and recorded and how well the
document is presented. 40% of the marks will be awarded for this.