05-830, User Interface Software, Spring, 1998.
Battleship Game Benchmark Description
Ann Sluzhevsky
Introduction
This is a simple interface for playing the Battleship game. It features
direct manipulation, simple animation and simple sound.
The interface allows the user to play the Battleship game with the computer
as the opponent. All user actions and commands are issued with the help
of a mouse. This is a rather simple game similar to Minesweeper on MS Windows
or Macintosh. (I was only able to find some non-commercial Java implementations
of Battleship on the WWW).
This benchmark was chosen for several reasons. It features direct manipulation
by allowinng the user to drag and drop ships onto the playfield. The drag
and drop feature must have a constraint of being able to "snap" the
ship on the grid of the field. The user should not just be able to place
the ship starting in the middle of a cell. This constraint is representative
of many other direct manipulation interfaces, such as the "Snap to
Grid" options on drawing packages such as ClarisDraw.
Other features are animation and sound. When a ship is hit, the user
sees the cell explode and when a ship is drowned there is a bigger explosion.
These explosions are accompanied by sound..
Description
Rules of the Game
There are 2 players in this game: the user and the computer.
The
goal of the game is to sink all your opponent's ships before your opponent
sinks yours. There are two playfields displayed. Each playfield is 10x10
cells. The user's fields the one on the left and the computer's is the
one on the right. Each player has five ships, each of which occupies a
certain number of squares on the playfield:
- Destroyer (2 squares)
- Submarine (3 squares)
- Cruiser (3 squares)
- BattleShip (4 squares)
- Aircraft Carrier (5 squares)
- At the start of the game, the user places the ships onto the playfield.
The user starts the game by making the first move. The user and the computer
take turns shooting at each other's ships. The user shoots by clicking
one of the squares on the right-hand playfield which haven't been already
tried. If a ship is hit, an explosion is displayed. To sink a ship, the
user must score a hit on each of the squares occupied by the ship. If you
lose, the locations of the enemy ships are displayed.
Computer's Strategy
- The computer places the ships using a random number, but such
that
no ships overlap or go out of bound.
- When there are no ships which have been hit (but yet unsunk) the computer
picks cells to try randomly
- When there is a ship which has been hit, the computer should "finish
off" the ship
by trying the cells around the hit cell in 4 directions.
Interface Features
- The ships are located on a tool bar, on the left.
- The ships can be displayed either vertically or horizontally, depending
on the selections of (vertical/horizontal) radio buttons.
- To the right of the toolbar, there are 2 playfield areas. Both are
10x10 grids. The user's field is the one the left.
- The user places ships on the field by dragging them onto the field.
The ships "snap" into the grid, matching the leftmost or
topmost cell to the front of the ship. In the case where the ships closest
cell will place the end of the ship out of bounds, the ship is shifted
to the left or to the top. The same shifting is applied when there is a ship
overlapping. No overlapping is allowed.
- The user can also change the location of the
ship, by dragging them again.
- When the user takes the ship our the horizontal view, that ship will
no longer be available in the vertical view.
- The user has to place all the ships on the field, before being able
to start playing. The user starts the game by making the first move.
- The user makes a move, by clicking the cell of his choice on the enemy
field. Once the user, makes the first move, he/she can no longer move the
ships around on the field.
- The cells on both playfields are marked according to their status:
- Untouched
- Guessed, but missed a ship
- Hit
- Shot down (part of drowned ship)
- When a computer's ship is hit, there is an explosion in that cell
and
a sound. When a computer's ship is drowned, there is a different animation
and sound.
- The way the cells are marked to distinquish their status is up to the
implementation. It could include either coloring them a different color,
or displaying a picture of a mine in a cell.
- When the game is over, a message of the outcome is displayed.
- If the users looses, the enemies ships are displayed
- At all times, he user has an option to restart the game and to exit
out of the game. Exiting and restarting is acheived by clicking on appropriate
buttons
Prototype Drawing
This an example of what the game looks like at the start of the game.