Design Check

Danah Beard
acct: dmb
date: 3/3/98

Classes:

GameController
This class controls the flow of control of the game and tells the appropriate people what to do. This class will also deal with all of the user input/output. In addition, this class will check to see if we have won or lost. It will contain a grid and a level.
Grid
This is a 2D grid of squares and mines. This class will create its elements. The grid will contain all of the mines and squares and be able to return a specific element. Randomization will occur in this class.
Square
This class has a number attached to it. When uncovered, the square's number will appear. If the number is zero, all of its neighbors will be uncovered too (using recursion!). When it is flagged, it will change the cover to "f" so that the user knows. One will have to unflag it before they can uncover it. The square will also know how to do checking.
Mine
This is a class that knows that it is a mine so that the controller can know if things work and whatnot. This too is flagged. It has the same type of flagging system as the square.
Level
There will be multiple subclasses of level so that the user can select what level she is on.

Flow of Control:

First, the game is created. The game instantiates a grid which determines the number of mines and places them randomly throughout the board using a for loop. It fills in all other spaces with squares. After this, the game prompts the user for input and the user says that she wants to uncover an element. Given that element, the game tells the grid who passes the information to a specific square or mine. That specific element does its appropriate action. The process starts over. This continues until the game recognizes that the game is won or lost when it informs the user of such and exits from the program. [For extra credit, I will try to allow the user to play multiple games at once!]


TA Feedback:

Check plus.