Vous êtes sur la page 1sur 2

John Coffelt

CST 338

Design Document
Overview:

Name: LitterScoop Game

The basic premise behind the game is that the player must clean the litterbox before their cat returns.
The game will play similarly to minesweeper, except the player must find all the cat’s “treasures” before
they run out of turns. This is different from minesweeper in the sense that the player does not need to
reveal all tiles, only those that contain the treasures.

Other than that, the rules will be nearly identical to minesweeper. The game board is a two-dimensional
grid. Each square of the grid is covered by a button. Each turn, the player clicks on one of the buttons on
the grid to reveal the underlying square. Game squares are either empty, contain a treasure, or will
contain the number of treasures in the adjacent squares. For example: if a square contains the number
“2”, the player knows that there are 2 treasures contained in the 8 squares that surround the square
they clicked on. If the none of the 8 surrounding squares contain a treasure, the square is empty. When
an empty square is revealed, all squares connected to that square are also revealed until a non-empty
square is reached. A square is considered connected if they either border another square or there is a
path of empty squares connecting the two squares.

The game will end when either the player runs out of turns or all treasures are revealed. The GUI will
display the game board as well as indicators for how many turns the player has left and how many
treasures are still hidden.

GUI rough mockup:


John Coffelt
CST 338

The game code will use the MVC design pattern. It will consist of a main class, and then 6 additional
classes:

Main Class:

Sets up the model, view, and controller object instances.

View:

Handles all GUI interactions and setup. The Tiles in the game will consist of JButtons that lay on top of
JLabels that will contain the gameboard information. This will be achieved by a 2d array of JButtons and
one of JLabels. When the player clicks on a button, the game will trigger an event handled by the
controller. The button will be hidden revealing the gameboard tile underneath. If the gameboard tile is
empty, the view will receive a list of other connected empty tiles to reveal.

Controller:

Handles events from the view object and controls all interactions between the view object and the
model object. The controller object will also start and trigger the end of the game for both the model
and view.

Model:

Handles all internal game functions. Keeps track of the number of turns the player has used, the number
of treasures that remain hidden, and all of the internal mechanics of the game board. Creates and
interacts with the LitterScoop Game Framework object. Responsible for starting the game on the
mechanical side.

LitterScoopGameFramework:

Manipulates the LitterBox (the name of the game board) for the purposes of the LitterScoop game.
Handles all game functions that require interaction with the gameboard. Handles placing the treasure
on the gameboard and determining which tiles to reveal after a player turn.

LitterBox:

Represents a the 2d grid of LitterTiles (a single square on the game board). Handles all of the functions
for manipulating the group of LitterTiles, including determining what the number each tile should
display (based on what the properties of the surrounding tiles are).

LitterTile:

Represents a single square on the game board. Contains all of the properties and methods related to a
single square. This includes what the tile will display, whether it is hidden on the game board, and
whether it contains treasure.

Vous aimerez peut-être aussi