AA2024 Sem2 Assignment1
AA2024 Sem2 Assignment1
COSC 1285/2123
Assignment 1: Implementing and Evaluating
Data Structures for Maze Generation
Please read all the following information before attempting your assignment.
This is an individual assignment. You may not collude with any other person (or people)
and plagiarise their work. Everyone is expected to present the results of their own thinking
and writing. Never copy another student’s work (even if they “explain it to you first”)
and never give your written work to others. Keep any conversation high-level and never
show your solution to others. Never copy from the Web or any other resource or use
Generative AI like ChatGPT to generate solutions or the report. Remember you are
meant to develop the solution by yourself - assessment is designed to encourage everyone
to learn, and you are not doing yourself any favours by taking shortcuts. Suspected cases
of collusion or plagiarism will be dealt with according to RMIT Academic integrity policy.
In the submission (your PDF file for the report of Task B) you will be required to certify
that the submitted solution represents your own work only by including the following
statement:
I certify that this is all my own original work. If I took any parts from
elsewhere, then they were non-essential parts of the assignment, and they
are clearly attributed in my submission. I will show I agree to this honor
code by typing “Yes”:
Clarification to Specifications
Please periodically check the assignment FAQ for further clarifications about specifica-
tions. In addition, the lecturer will go through different aspects of the assignment each
week, so even if you cannot make it to the lectorials, be sure to check the course material
page on Canvas to see if there are additional notes posted.
1 Overview
In this assignment, you will implement a number of well-established data structures
for developing a maze generation program and evaluate their performance to determine
what would be the best data structure in different situations. This assignment aims to
help crystallise the analytical parts of the course and familiarise you with certain data
structures, how implementation decisions can have an influence on running times, and
how to empirically evaluate different possible design choices (in this case, data structures).
2 Learning Outcomes
This assessment relates to 3 learning outcomes of the course which are:
• CLO 2: Compare, contrast, and apply key data structures: trees, lists, stacks,
queues, hash tables and graph representations;
• CLO 4: Theoretically compare and analyse the time complexities of algorithms and
data structures; and
• CLO 5: Implement, empirically compare, and apply fundamental algorithms and
data structures to real-world problems.
3 Background
A maze is typically a 2D grid of cells and walls, an entrance and an exit. The aim is
to find a path from the entrance to the exit. See Figure 1 for an example. There are
strategies and algorithms to solve a maze, i.e., find such a solution path given a maze.
There are also strategies and algorithms to generate a maze; in this assignment, we will
focus on generation of mazes, however, the implementation for maze generation is already
provided in the Python skeleton (detailed in Section 4) and you will need to only focus
on data structures that represent mazes in our maze generation scenario.
We are focused on perfect mazes, where there is always a path from entrance to exit
(by the virtue that in a perfect maze, there is always a path from a cell in the maze to
any other cell in the maze). In addition, in this assignment, we focus on 2D, square cell
mazes, i.e., each cell has 4 sides. There is no standard way to reference the cells, hence
we adopted the convention issued in Figure 1, with (0,0) denoting the bottom left cell,
and columns increase as we travel to the right of the maze (page), and rows increases as
we travel up the maze (page). In order to specify the entrances and exits, we have added
one row above, and one row below the maze, and one column to the left, and one column
to the right of the maze. This means the row below the maze is referenced as -1, the row
above by 5 (if we have 5 rows in the maze), the additional column to the left of the maze
by -1, and the column to the right by 5 (if we have 5 columns in the maze). This allows
us to still be able to use the original indexing, i.e., (0,0) refers to the bottom left cell of
the maze, but still able to reference the location of entrances and exits.
4 Assessment details
The assignment is broken up into a number of tasks, to help you progressively complete
the project.
2
Figure 1: Sample 5 by 5
maze. The entrances are il-
lustrated as arrows pointing
towards the maze, and ex-
its are illustrated as arrows
pointing away from the maze.
The cells of the maze are in-
dexed from 0, and the row
and column indices are drawn
outside the maze. Note that
the bottom left cell is (0,0),
and top right cell is (4,4).
This follows the convention
that matplotlib follows (we
use that for visualisation).
Note the entrances are spec-
ified as (0,-1) and (-1,1) and
exits as (5,4) and (3,5).
You are required to implement the maze abstract data type using the following data
structures:
3
Figure 2: Sample graphs with 4 vertices and 4 edges.
Example Consider the two graphs depicted in Figure 2. The edge list representation of
these graphs are:
e1 e2 e3 e4 e1 e2 e3 e4
A 1 1 0 0 A 1 1 0 0
MG1 : B 1 0 1 0 MG2 : B 0 0 1 1
C 0 0 1 1 C 1 0 1 0
D 0 1 0 1 D 0 1 0 1
For the above two data structures, you must program your own implementation, and not
use libraries, e.g., networkx or numpy. Have a look at our implementations using a 2D
array for an initial idea about how to possibly go about it. In the provided code, we make
use of a limited number of packages. Apart from these cases in the provided skeleton
code and built-in data types such as lists, dictionaries and arrays, this can be considered
as an invalid implementation and attract 0 marks for that data structure. If in doubt,
please ask first!
Code Framework
We provide Python skeleton code (see Table 1) to help you get started and ensure we
have consistent interfacing to run correctness testing. Table 1 also lists the files that you
really need to modify/implement (in the description column). You need to complete the
implementation of edgeListGraph.py and incidenceMatGraph.py. We have provided the
code to construct and provide functionality of a maze in the graphMaze file. It is mostly
generic, but does assume a certain way of implementing the maze using the two graph
data structures. If that does not align with your approach, please feel free to modify
4
file description
mazeTester.py Code that reads a configuration file then exe-
cutes the generation using specified data struc-
ture. No need to modify this file.
maze/maze.py Abstract class for mazes. All implementations
of a maze should implement the Maze class. No
need to modify this file.
maze/util.py Coordinates class, and other utlity classes and
methods. No need to modify this file.
maze/graph.py Abstract class for graphs. All graph implemen-
tations should implement the Graph class. No
need to modify this file.
maze/arrayMaze.py 2D array data structure implementation of a
maze. No need to modify this file.
maze/graphMaze.py Graph based data structure implementations of
a maze. Modify if need to.
maze/edgeListGraph.py Code that implements an adjacent list (for
maze). Complete the implementation.
maze/incMatGraph.py Code that implements an adjacent matrix (for
maze). Complete the implementation.
maze/maze viz.py Modified code used to visualise generated mazes
using matplotlib. No need to modify this file.
generation/mazeGenerator.py Abstract class for maze generators. No need to
modify this file.
generation/recurBackGenerator.py Implementation of the recursive backtracking
maze generator. No need to modify this file.
README.txt Please read this first, it mentions how to run the
code. No need to modify this file.
it, but please ensure the same functionality is still maintained and that you are able to
generate mazes.
Please note that the first time you run this implementation, the two provided configu-
ration files will use the array data structure as the representation of the maze. If you
modify and use one of the configuration files intended for graphs, you may encounter
errors because the graph implementations are currently incomplete. Don’t be alarmed by
these errors as once the graph implementation is finalised, the program should be able to
correctly output the graphs.
Note that for Task A, part of the assessment will be based on automated testing, which
will feed a number of configuration files into your (completed) implementation of the
provided Python skeleton. We will then check if the generated mazes are correct, e.g.,
whether they are perfect, have correct entrances and exits, didn’t go into infinite loops
etc. We would like you to do some testing about this - if you look at the code, there
5
is a method to test if the generated maze is perfect which is not implemented. This
implementation won’t be part of your assessment, but it might be useful to consider
how to implement it and perform checks yourself as part of practicing code evaluation.
Remember a perfect maze is one where any cell in the maze can reach any other cell, or
another way to put it, there exists a path between any pair of cells in the maze. If you
implement something to evaluate perfect mazes, please refrain from submitting it as part
of your final code submission.
Notes
• If you correctly implement the “Implement me!” parts of the provided skeleton, you
do not need to do anything else to get the correct output formatting. mazeTester.py
will handle this.
• We will run your implementation on the university’s core teaching servers, e.g.,
titan.csit.rmit.edu.au, jupiter.csit.rmit.edu.au, and saturn.csit.rmit.edu.au.
If you develop on your own machines, please ensure your code compiles and runs
on these machines. Discovering at the last minute that your code does not compile
on these machines is something you would want to avoid. If your code does not
run on these machines, we unfortunately do not have the resources to debug each
one and cannot award marks for testing. Please note this carefully, this is a firm
requirement.
• All submissions should be compiled with no warnings on Python 3.6.8 when com-
piling the files specified in Table 1 - this is the default Python3 version on the Core
teaching servers. Please ensure your code runs on the core teaching servers and
with this version of Python. Please note this carefully, this is a firm requirement.
Theoretical Analysis
At first, you are to conduct a theoretical analysis of the performance. Given the height
h and width w (in terms of number of rows and columns) of the generated maze, report
the best case and worse case running time estimate in terms of the exact asymptotic
complexity (Θ) of each of your graph implementations when executing updateWall() and
neighbours(). You will also need to provide an example scenario and explanation on the
best case and worse case running time estimates. This will help you when explaining
your empirical analysis results. Put the results in the follow format of a table:
6
Theoretical Analysis
Operations Best Case Worse Case
updateWall() [asymptotic complexity] [asymptotic complexity]
[example and explanation] [example and explanation]
Empirical Analysis
Typically, you may use real usage data to evaluate your data structures. However, for this
assignment, you will write configuration file generators to enable testing over different
scenarios of interest. There are many possibilities, hence to help you we suggest you
consider the following factors.
Data Generation When generating different maze dimensions, you may want to write
some configuration file generators (or generator directly within a copy of mazeTester.py).
Due to the randomness of the data, you may wish to generate several datasets with the
same parameters settings and take the average across a number of runs.
Note, you may be generating and evaluating a significant number of datasets, hence we
advise you to get started on this part relatively early.
5 Report Structure
As a guide, the report could contain the following sections:
• Data and Experimental Setup Explanation: Describe your data and experimental
setup. Briefly explain the parameter configurations used in your experiments, e.g.,
the range of maze dimensions. Provide insight into why you selected such range.
You can use a paragraph or even a high-level pseudo code or figure. Also describe
which approach(es) you decide to use for measuring the timing results.
7
• Evaluation of Data Structures: Analyze, compare, and discuss the results obtained
from evaluating the data structures using the generated data. Explain why you
observed these results. Consider using the known theoretical time complexities of
each data structure’s operations to support your analysis.
Please make sure to include your name and student ID as well as the statement on the
first page of this document in your report.
6 Submission
The final submission will consist of three parts:
1. Your Python source code of your implementations. This must include all files, in-
cluding the provided skeleton as well as any extra files you have created. Your source
code should be placed into the same structure as the supplied skeleton code, and
the root directory/folder should be named as Assign1-<your student number>.
Specifically, if your student number is s12345, when unzip Assign1-s12345.zip
is executed then all the source code files should be in directory Assign1-s12345.
We use automated testing and compilation, and the testing script will expect this
structure, so if is different, the script may not be able to compile your code. So
please make sure not to change the structure.
2. Your written report for part B in PDF format, called “assign1.pdf”. Place this
pdf within the Python source file directory/folder.
The final folder (consisting the source code, report and dataGen subfolder) should be
zipped up and named as Assign1-<your student number>.zip. E.g., if your student
numbers is s12345, then your submission file should be called Assign1-s12345.zip, and
when we unzip that zip file, then all the submission files should be in the folder Assign1-
s12345.
Note: submission of the report and code will be done via Canvas. We will
provide details regarding Task C closer to the submission deadline.
7 Assessment
The project will be marked out of 20.
The assessment in this project will be broken down into three parts. The following criteria
will be considered when allocating marks.
8
Implementation (6/20):
While the emphasis of this project is not on programming, we would like you to maintain
decent coding design, readability and commenting, hence commenting and coding style
will make up a portion of your marks. For a detailed breakdown of the implementation
marks, please refer to the rubric available via Canvas.
Report (12/20):
The marking sheet in Appendix A outlines the criteria that will be used to guide the
marking of your evaluation report1 . Use the criteria and the suggested report structure
(Section 4) to inform you of how to write the report.
Late Submission Penalty: Late submissions will incur a 10% penalty on the total
marks of the corresponding assessment task per day or part of day late, i.e, 2 marks per
day. Submissions that are late by 5 days or more are not accepted and will be awarded
zero, unless special consideration has been granted. Granted Special Considerations with
new due date set after the results have been released (typically 2 weeks after the dead-
line) will automatically result in an equivalent assessment in the form of a practical test,
assessing the same knowledge and skills of the assignment (location and time to be ar-
ranged by the coordinator). Please ensure your submission is correct (all files are there,
compiles etc), re-submissions after the due date and time will be considered as late sub-
missions. To avoid submitting late, make sure to complete and submit your assignments
a bit ahead of the deadline, as the core teaching servers and Canvas can sometimes be
slow. We strongly advice you submit at least one hour before the deadline. Late
submissions due to slow processing of Canvas or slow Internet will not be looked upon
favourly, even if it is a few minutes late. Slow processing of Canvas or slow Internet
will require documentation and evidence submission attempts was made at least one hour
before the deadline.
9
• Provided a reference list of the publication details so your reader can locate the
source if necessary. This includes material taken from Internet sites. If you do not
acknowledge the sources of your material, you may be accused of plagiarism because
you have passed off the work and ideas of another person without appropriate
referencing, as if they were your own.
For further information on our policies and procedures, please refer to the following:
https://www.rmit.edu.au/students/student-essentials/rights-and-responsibilities/
academic-integrity.
9 Getting Help
There are multiple venues to get help. There are weekly consultation hours (see Canvas
for time and location details). In addition, you are encouraged to discuss any issues you
have with your Tutor. We will also be posting common questions on the Assignment 1
FAQ section on Canvas and we encourage you to check and participate in the Ed Forum
discussion forum. However, please refrain from posting solutions, particularly as this
assignment is focused on algorithmic and data structure design.
10
A Marking Guide for the Report
Design of Evaluation Analysis of Results Report Clarity
(Maximum = 2 marks) (Maximum = 8 marks) (Maximum = 2 marks)
2 marks 8 marks 2 marks
Data generation is well Analysis is thorough and demon- Very clear, well struc-
designed, systematic and strates understanding and critical tured and accessible re-
well explained. All analysis. Well-reasoned explana- port, an undergraduate
suggested scenarios, data tions and comparisons are provided student can pick up the
structures and a for all the data structures, scenar- report and understand
reasonable range of size of ios and different input sizes of the it with no difficulty.
the maze were evaluated. mazes. All analysis, comparisons
Each type of test was run and conclusions are supported by
over a number of runs and empirical evidence and theoretical
results were averaged. complexities. Well reasoned recom-
mendations are given.
11