back to projects page

Project 5

Maze Counter

Concepts Covered: Recursion, Problem Solving

Due: Friday, April 18 at midnight

Files you need: maze0, maze1, maze2, maze3, maze4, maze5

Turn in: Maze.java, MazeTester.java, MazeCounter.java, Documentation (in javadoc format)

Background: Consider the following 5x5 2-Dimensional binary array.

                            0 0 1 0 1
			    1 0 0 1 1
			    1 1 0 1 1
			    1 1 0 1 1
			    1 1 0 0 0

You can think of it as a maze, where you can travel the path of zeros from the top left hand corner to the bottom right hand corner. The path can only go up, down, left and right - not diagonal. In this project you will first write a program that determines if an NxN maze has a path, and then you will attempt to write a program that counts the number of NxN mazes that have paths through them.

Notice that this problem begs for a recursive solution. We can see that a maze has a path from cell (a,b) of the maze to cell (N-1, N-1) of the maze if and only if (a,b) is 0 AND there is a path from (a-1, b) to (N-1, N-1) OR there is a path from (a, b+1) to (N-1, N-1) OR there is a path from (a+1, b) to (N-1, N-1) OR there is a path from (a, b-1) to (N-1, N-1). If you make (a,b) (0,0) then this solution will determine if there is a path from (0,0) to (N-1, N-1).

Requirements: This project is divided into two distinct parts - the first part will account for 80% of your grade, the second part will account for 25% (note that 105% is possible on this project).

Grading: The grading for the first part will be based on pass/fail test cases - some of which will be the cases provided above, and some of which will be others that we create. There will be 5 of them worth 10 points each. If your solution is not recursive, you will not earn any of these points. The other 30% will be documentation, README, and following directions (at 10% each respectively).

The grading for the second part will be on the accuracy of the numbers - if you hardcode the numbers provided above into your program in any way, you will get a 0 on the entire project (so don't try it). Make sure you include in your README file the values for 5 and above (so we don't have to wait for your program to finish running if it looks like it will take awhile).

Hints: (Given in class)