9/21/09
Project 3: Game
Dhanalaxmi Kulkarni, Ye Fan
Game World: Design Document
The Game World created has a game board (Action Panel) as well as a control panel which has buttons that do specific tasks, and state panel that contains a timer that keeps time of the game & change button that changes layout of Control Panel. In addition to the previous Observer pattern and Command Pattern three more patterns are used in this project. The composite pattern used for creation of all the containers( called "CPContainer") in the project such as Control Panel, State Panel , Action Panel as well as Board. The class CPContainer implements Fcomponent interface and has the list of CPcomponents created by class CPLeaf also implementing same CPcomponent interface. We also use the Strategy design pattern for the control panel. The addition of Change Button in the game, allows control panel to flip its layout In between Flow Layout and Border Lay out. We created two customized layout managers for these two implementing Layout Manager Interface. The method for changing layout is written in the CompositeFcomponent class that all container classes inherited from. The third pattern Null Object Manager is for the panels, which don't change their layout behavior with the Change Button action.
We added one more button to the control Panel for "Save" option. Save Button in the control panel, if clicked saves the current state of the program into an XML file. save() in the action panel checks for all the replay, pause, undo status and stores current positional and command status of ball, paddle and bricks into the XML file. When user opens the program again, it gets the message in a window asking if the user wants to restore its game back.
The program also includes a Print Button that prints the tree structure of composite pattern.
Main References: Wikipedia, www.java.sun.com