B C D E F G H I L M N P R S U W

B

Battleship - class Battleship.
Details of the current game
Battleship() - Constructor for class Battleship
Initialize the game.
BattleshipDisplay - class BattleshipDisplay.
Class for the GUI of Battleship.
BattleshipDisplay() - Constructor for class BattleshipDisplay
 
bat - Variable in class BattleshipDisplay
The game that is being displayed
body - Variable in class Ship
Location of the body parts : an array 0..length-1

C

col - Variable in class Location
The column coordinate
col() - Method in class Location
 
comp - Variable in class Battleship
Computer's ship board
compStat() - Method in class Battleship
 

D

detail() - Method in class Ship
 

E

equal(Location) - Method in class Location
Tests if two objects refer to the same hole

F

finish - Variable in class BattleshipDisplay
Variable is set to true when user finishes
fleet - Variable in class ShipBoard
All the ships on this ship board

G

GuessBoard - class GuessBoard.
Records all the guesses and their results of a player
GuessBoard() - Constructor for class GuessBoard
Initializes the arrays to the maximum size (100)
getFleetStat() - Method in class ShipBoard
Get the status of all ships on this Shipboard
guess - Variable in class GuessBoard
An array holding all locations guessed so far
guess(Location) - Method in class Ship
Carries out opponent's guess.
guessStatus(Location) - Method in class Battleship
Get the results of user's guess.

H

hit - Variable in class Ship
Indices of the body parts destroyed
hit(int) - Method in class Ship
Marks body part i, as hit
hitNumber - Variable in class Ship
Number of body parts destroyed
hitShip(Location, int) - Method in class ShipBoard
Check if the specified ship is hit in a location

I

init() - Method in class BattleshipDisplay
Initialize the applet.
isClash(Ship) - Method in class Ship
Checks if two ships are in the same hole
isDestroyed() - Method in class ShipBoard
Test if all ships on this Shipboard are sunk
isNew(Location) - Method in class GuessBoard
 
isSunk() - Method in class Ship
 

L

Location - class Location.
Represents the holes on the 10 x 10 board
Location(int, int) - Constructor for class Location
Creates an object with specified row and column coordinates
Location() - Constructor for class Location
Default constructor
length - Variable in class Ship
Number of holes this ship occupies
length() - Method in class Ship
 
locPart(int) - Method in class Ship
Get Location of specified body part

M

markGuess(Location, boolean) - Method in class GuessBoard
Marks the result of a guess
mouseClicked(MouseEvent) - Method in class BattleshipDisplay
Responds to mouse clicks.
mouseEntered(MouseEvent) - Method in class BattleshipDisplay
 
mouseExited(MouseEvent) - Method in class BattleshipDisplay
 
mousePressed(MouseEvent) - Method in class BattleshipDisplay
 
mouseReleased(MouseEvent) - Method in class BattleshipDisplay
 

N

name - Variable in class Ship
Name of the ship
numGuess - Variable in class GuessBoard
Number of guesses so far
numGuesses() - Method in class GuessBoard
 
numHit() - Method in class Ship
 
numUserGuess() - Method in class Battleship
 

P

paint(Graphics) - Method in class BattleshipDisplay
Method to paint on the applet.

R

result - Variable in class GuessBoard
Results of all guesses so far.
row - Variable in class Location
The row coordinate
row() - Method in class Location
 

S

Ship - class Ship.
Details of a ship and its status on the board
Ship(String, int, Location, int) - Constructor for class Ship
Creates a ship, and places it in a specified place.
ShipBoard - class ShipBoard.
Records all the ships of a player
ShipBoard(Ship[], int) - Constructor for class ShipBoard
Builds a Shipboard containing specified ships
ShipBoard() - Constructor for class ShipBoard
Builds a standard ship board containing five ships in the order : PatrolBoat,Destroyer,Submarine,BattleShip,Carrier.
size - Variable in class ShipBoard
The number of ships on this ship board
stat - Variable in class BattleshipDisplay
The status to display after the user's guess

U

user - Variable in class Battleship
User's guess board
userGuess(Location) - Method in class Battleship
Carry out the user's guess, by modifying the shipBoard and guessBoard

W

wasHit(Location) - Method in class GuessBoard
Tests whether a location was guessed and hit
win - Variable in class Battleship
Status of the game : true when user has won
win() - Method in class Battleship
 

B C D E F G H I L M N P R S U W