Project 2: Implementing new Maze generation algorithms


To Deliver: 

  1. subversion repository: release 3.0, 
  2. uploded code to web-cat, 
  3. email to grader, answering questions 1 and 2, grader: Md Atiqur Rahman <mrahman@email.wm.edu> (Section 1), Jianhua Sun <jsun01@email.wm.edu> (Section 2).

To Download: (nothing new, you already downloaded all necessary files for homework 3) 

Due date for submission:    October 4, at noon (12.00 PM)

Drop out date:                     October 8, at 5 AM (EARLY MORNING)


Motivation

There are many different ways to generate a Maze, for a nice summary click here and read the section on Perfect Maze Creation Algorithms.


Falstad's code comes with one method that includes rooms that is implemented in MazeBuilder.java. In a previous CS301 class, students added a randomized version of Prim's algorithm that you find in MazeBuilderPrim.java. Still, we would like to have more alternatives to generate a maze. For this project, you are tasked to extend it by yet another algorithm, namely a randomized version of Eller's algorithm ( see section "Perfect Maze Creation Algorithm" here). If you are not familiar with Eller's algorithm, I would recommend this blog, this description. As with most basic algorithms, there is a place on the web with sample code like the one here. Before you go ahead and copy code from elsewhere, please recognize that the time that is necessary to understand, adjust, and debug other people's code is mostly likely about the same than implementing the algorithm yourself (and we are not talking about copyright issues here yet). To get a solid implementation, you cannot avoid the necessity to properly understand the algorithm.


What to learn from this project:

- Using inheritance to share code across classes that solve the same problem in different ways

- Exercising a test-driven approach when extending an existing code base 

- Implementing an existing algorithm in Java

- Exercising code reading abilities



Design decision


The most straightforward design is to implement your new algorithm in a subclass of the existing MazeBuilder class just like the MazeBuilderPrim class. Since inheritance allows us to formulate generic solutions in a superclass and then have subclasses for more specific cases, let's just add yet another algorithm by adding a MazeBuilderEller class that inherits from MazeBuilder.


You can add further methods and classes as you deem necessary. You can change classes and methods as well. 

Of course, modifying an existing code base comes with the risk to introduce many subtle errors. A suite of Junit test cases can help you do regression testing so see if your changes broke anything. 

If you have not done it yet for homework 3, you need to create or refine a junit test class MazeBuilderTest.java that exercises all functionality of MazeBuilder.java to check that the computed maze has all properties of a correct maze and that the provided solution encoded in the dists array is correct. Copy and adjust your MazeBuilderTest.java into a new test class MazeBuilderEllerTest.java to test your new MazeBuilderEller class.


To do list:



Grading:


You will receive points for: