Assignment 12: Final Project
Learn to implement graph algorithms.
Design a complete application with graphics and animation.
Instructions
The names of the classes must be exactly the same as specified. This allows us to run several of your rpogram without special setup steps.
Make sure you follow the style guidelines that WebCAT enforces. For now the most important ones are: using spaces instead of tabs, indenting by 4 characters, following the naming conventions (data type names start with a capital letter, names of fields and methods start with a lower case letter), and having spaces before curly braces.
You will submit this project twice. The preliminary submission will be used for the project reviews. It will give us the opportunity to critique your design and give you suggestions for improvement or changes. This submission is due on April 9th, so we can do the code reviews on April 10th.
The final submission is due at the end of the day on Tuesday, April 15th, the last day of classes.
You may submit as many times as you wish. Be aware of the fact that close to the deadline the WebCAT system may slow down to handle many submissions - so try to finish early.
As with each homework you will also submit your log file named pair-user1-user2.txt where you replace user1 and user2 with the usernames of the two partners.
On top of both files you will have five lines of comments as follows:
// Final project |
// partner1-last-name partner1-first-name |
// partner1-username |
// partner2-last-name partner2-first-name |
// partner2-username |
(In the text file you do not need the two slashes)
There will be a separate submission for the two parts.
The two submissions will be organized as follows:
Submission HW12Preview: The log file and the preliminary solution to the Final Project using the tester library or JUnit for the tests. It must compile and run. The name of the class that represents the maze game should be MazeGame and it should include a main method that runs the game:
public static void main(String[] argv) {
MazeGame mg = new MazeGame(... possible arguments, if needed);
mr.run();
}
Additionally, add a plain text document that explains how far you have progressed - what works, what does not, and how can we run your program. Combine all into one .zip file
Submission HW12Final:
The log file
The code for the final solution to the Final Project using the tester library or JUnit for the tests.
The Design Document
The User’s Guide
The colors folder and the jptdraw folder, if you are using the jpt and the interactions from Lab12.
Download the properly formatted and partially tested versions from here: jptdraw and colors.
The final project should name the class that represents the maze game MazeGame.
This class should include a main method that runs the game, with the actual run statement commented outas follows:
public static void main(String[] argv) {
MazeGame mg = new MazeGame(... possible arguments, if needed);
// uncomment the next line to run the game
// mr.run();
}
All items should be combined into one .zip file
When grading, the test points lost for parts that cannot be tested will be added back to your final score.
Due Dates:
Preliminary submission: Wednesday, April 9th, 11:59 pm.
Final submission: Wednesday, April 16th, 11:59 pm.
Maze Project
Your job is to design the program that finds a path in a rectangular maze of any size, and also designs new mazes. Here are two examples of mazes:
The program should have the following features:
Display the maze graphically and animate the search for the path.
Allow the user to choose one of two algorithms for finding the path: Breadth-First Search or Depth-First Search.
Provide an option for designing a new random maze.
Optionally, allow the user to traverse the maze manually - using the keys to select the next move, preventing illegal moves and notifying the user of completion of the game.
You may choose to show the walls without the paths, you may choose to allow the user to view same maze several times in a row, you may allow the user to start a new maze without restarting the program.
You may also keep the score of wrong moves - either for the automatic traversal, or for manual one - and maybe keep statistics on which one of the two algorithms had fewer steps for each maze.
Project Components
You should start your project by designing the structure of the classes you may need and how they relate to each other.
You should use the javalib library for drawing of the maze, and design the animation as steps in the algorithm to be performed on each tick of the clock, or in response to a key (for example the space key.
You can use the JPT library for the design of the user interactions - the selection of the algorithm the origin and the destination, or choosing to design a new maze, but this can also be easily done using the javalib library.
You should probably implement the algorithm in a separate class.
Of course, you need to test everything.
Once you have an idea how your program will be structured, draw a class diagram. Include the class diagram with your first submission.
You will also need to write a user’s guide that tells the user how to control your program and what to expect. It would help to include this with your first submission, but is not required. It is required with the final submission.
Of course, documentation is required for the entire project. Javadoc style is preferred, but if you do not use it, you should still include not only purpose statements for all methods, but also comments that explain the meaning of every field in every class, with the exception of teh Examples class. In Examples class you may have a common comment for several fields that are sample data of the same type.
Optionally, you may add sound effects to your animation.