Assignment #4
Due: Fri, March 2 (end of day)
Objective
To gain practice in analysis tasks -- identifying participating objects,
associations, attributes, and creating a class diagram to represent them.
Task
I've presented a system description, a use case diagram, and some use case
descriptions for a proposed system. Your task is to indentify objects,
associations, and important attributes and behaviors, and create an
analysis object model.
System Description
The proposed system is an online Battleship game, to be played on a web
gaming site (e.g. like Pogo.com). This is a 2-player game, so a player
starting a game will be placed into a room with another player as an
opponent. Game play will proceed over the network, according to the usual
Battleship rules.
Each player's window will show two 10x10 grids -- one with the player's
own ships, and one that records their guesses (shots at the opponent's
ships).
If you are not familiar with standard Battleship rules,
see here
Use Case Diagram
Use Case Descriptions
Use Case |
Start Game |
Actors |
Player |
Entry Conditions |
- The player is logged into the gaming site
- The player has already clicked the Battleship link
from the list of available games and is now on the start page for
Battleship
|
Main Flow |
- Player clicks the main "Start Game" button on the page
- The system checks to see if any rooms have been created with only one
player so far. If so, this player is added to it as the second
player
- If there were no rooms waiting for a second player, a new room is
created instead, and this player is added to it
- A game window loads, showing the two game boards, one for the player's
own ships and one for tracking guesses at the opponent's board
- If only one player is in the room, pop-up a message window reading,
"Waiting for second player to join"
- Game will be ready to begin once two players are in the room
|
Variations |
- Instead of the "Start Game" button, the player can begin by clicking
a "Private Game" button
- Player is prompted to enter a name for the room, which will act
as a password
- Another player can join this room by clicking the "Private Game"
button and entering the same password
- Rest of the flow is the same as 4-6 above
|
Exit conditions |
-
The player is now in a Battleship game room, ready to begin a
game
|
Use Case |
Place Ships |
Actors |
Player |
Entry Conditions |
- The player has joined a game room
|
Main Flow |
- Player is prompted by the system to place ships by dragging ship icons
over the board and dropping them into position. The prompt also indicates
that a right-click will rotate the ship's alignment from horizontal to
vertical (or vice versa)
- The player clicks a ship with the left mouse button, and drags it to
their board
- The player drops it in a location, by letting go of the
mouse button
- If the player right-clicks, the alignment changes (from horizontal to
vertical at first, or from vertical to horizontal when appropriate)
- Player can perform steps 2-4 with any ship throughout ship
placement
- Player does this process for each of the 5 ships. The ships (and
their lengths) are: (Carrier-5, Battleship-4, Cruiser-3, Submarine-3,
Destroyer-2)
- Once all ships are in the desired positions on the board, the player
clicks the "Finished" button
|
Variations |
- If a ship is dropped at an invalid position (partly off the board, or
overlapping another ship), the ship icon immediately snaps back to its
previous position (before the current attempt to drag and drop it)
- If a player's opponent closes the room before the process is complete,
they can still finish placing their own ships, after which a message pops
up: "Waiting for second player to join"
|
Exit conditions |
- All 5 of the player's ships are placed in valid locations on the
board
|
Use Case |
Take Turn |
Actors |
Initiated by AttackingPlayer,
Communicates also with DefendingPlayer |
Entry Conditions |
- All ships have been placed on the board for both players
- It is the AttackingPlayer's turn
- There are remaining ships on the board that haven't been sunk
|
Main Flow |
- A player makes their move by clicking on the board that represents the
guesses at the opponent's ships. Attacking player clicks on the
square of the desired guess
- The system reports whether the guess is a "Hit" or a "Miss"
- The gameboard display is adjusted appropriately, with a fire icon
in the selected square for a hit, and a water icon for a miss
- The DefendingPlayer's home gameboard is also updated, with the
appropriate icon. If it's a hit, a fire graphic overlaps their ship
(which appears on their own board)
|
Variations |
- If the move was a hit that sunk a ship, both players are notified that
a ship has been sunk. The identity of the sunk ship is not given to the
AttackingPlayer -- only the information that a ship was sunk. (The
DefendingPlayer knows which ship, because it appears on their own
board)
- If the move was a hit that sunk the last ship of the opponent,
a message is displayed to both players indicating that the
AttackingPlayer won the game. In this case, both players are given the
option of clicking a button to start a new game.
|
Exit conditions |
- The game board has been updated with the results of the move
|
Task Details
- Identify participating objects, and use these to create your analysis
object model.
- Remember, you are analyzing the application domain, not designing the
solution yet -- so your model should not be implementation specific.
- Indicate whether each object is an entity, boundary, or control
object.
- You should have at least two examples of each type of object included
in your model. (You'll probably have more)
- Create a UML class diagram to represent the object types that you have
identified.
- Identify and include any appropriate associations between
classes/objects on your model
- Name associations where appropriate.
- Leave out names if the association is already clear
- Include role names where appropriate (again, leave out if already
clear)
- Identify and include multiplicities for each association, where
appropriate
- Identify any important attributes and operations for your object
types, and include them on the diagram
- You don't need to include all member data and member functions that
you would create in a code solution. Again, this is the problem
domain!
- Include attributes and operations that are important to understanding
the problem
Submitting
You will submit this one electronically, since the due date is not on a
class day. Put your work into a document of one of the following formats:
- Rich Text File
- MS Word Document
- PDF
Your file should be set up so that it will print onto standard
size paper (8 1/2 x 11). It can print on multiple pages, but it
should print as-is, without having to reformat the file in any way.
Your document should include a header with your name and section number.
Document contents: Any written answers you wish to include
(explanations of your choices, identification of entity, boundary, control
objects, etc). And your class diagram, pasted in so that it fits within
the printable boundaries.
Filename should be one of the following (depending on document type):
E-mail this file to me (myers@cs.fsu.edu) by the due
date. Your e-mail subject should be HW4-SUBMIT. Include your name
and section in the e-mail body. Please only submit ONCE, unless you make
a mistake and need to correct it (before the due date) -- and minimize
this. Only the last submission will be graded.
Your submission e-mail needs to come either from your CS account
(preferred) or your garnet/mailer account.