Milestone #1: Due Monday Feb. 25, 2002 10:00 AM.
Milestone #2: Due Monday Mar. 11, 2002 10:0 AM.
This programming project is designed to make use of linear recursive structures. It also serves as an example of how to write Graphical User Interface (GUI) programs using the Model-View-Controller (MVC) pattern.
You are to write a Java GUI application that allows you to play the game of "Hangman." In case you've forgotten, that's the game where there's a hidden word or phase and the player attempts to guess it one letter (character) at a time. Every correct guess results in that letter being exposed and every incorrect guess results in a body materializing part by part on a gallows. The game is won when all the letters of the answer have been guessed before a complete body is drawn hanging on the gallows.
Click here to run a demo of the Hangman project!
You are required to implement the program in accordance with the following design specifications.
At the highest level, the total Hangman game design uses a Model-View-Controller design pattern to decouple the internal workings of the game from the GUI. We will be giving you the system design but that will not be a future trend.
First, go read about the MVC pattern here.
The underlining data model should consist of the following linear recursive structures.
The above data models are encapsulated into a single class that represents the operational model of the Hangman game, called (duh) HangmanGame. This class can initialize the game, allow guesses of characters, show what characters in the answer have been correctly guessed, draw onto a supplied graphics surface the body parts associated with incorrect guesses, and finally to indicate whether the game has been won or lost.
Nothing in the model should contain any explicit references to the GUI and vice versa. Instead, communication from the model to the view uses two interfaces, ILoseAdapter and IWonAdapter.
The GUI should have the following features:
As the model object is unaware of the GUI (view), so the view object should not know anything about the model that it is displaying. All communication from the view to the model is through 2 interfaces: IPaintAdapter and IGameControlAdapter.
Anonymous inner classes will be used extensively to connect the view (HangmanFrame) to its GUI components (buttons, textfields, labels, etc.);
The controller's job is to
As in the view, anonymous inner classes will be used to instantiate the 4 interface adapters.
The full documentation for the project can be found here.
You will use a number of design patterns in this project. Here are links for more information about them:
JavaResources site on www.exciton.cs.rice.edu
The project is broken up into two milestones. Each milestone is to be submitted electronically. The complete milestone set should contain the following:
Milestone #1: due Monday Feb. 25, 2002, at 10:00 AM (50% of project grade)- Implementation of IWord and IBody, their subclasses and their supporting classes (see lab 04). Write your own client to test your system. The test client need not be a GUI application. You are free to reuse/modify the code we provide you, implement your own design using your own classes, as long as you adhere to the general program requirements.
The functionality requirement for this milestone is the "Checklist" at the bottom of the bodyparts package web page.
To turn in Milestone 1: Log on to an owlnet workstation and type:
Milestone #2: due Monday Mar. 11, 2002, at 10:00 PM (50% of project grade)- Implementation of a GUI view to control the model. This will include creating the controller and thus will result in a fully functional game. You will be given some sample GUI code and are free to implement your own design using your own classes, as long as you adhere to the general program requirements.
The functionality requirement for this milestone is the "Checklist" at the bottom of the view and controller packages web page.
To turn in Milestone 2: Log on to an owlnet workstation and type: