A B C D E F G H I N O P R S W

A

AircraftCarrier - Class in <Unnamed>
 
AircraftCarrier() - Constructor for class AircraftCarrier
 

B

Barge - Class in <Unnamed>
 
Barge() - Constructor for class Barge
 
BoardPoint - Class in <Unnamed>
A BoardPoint is a class that corresponds to a point on the game board.
BoardPoint() - Constructor for class BoardPoint
 

C

canPlace(Ship) - Method in class Grid
Returns true if the given Ship can be legally placed on the board, false otherwise.
Cruiser - Class in <Unnamed>
 
Cruiser() - Constructor for class Cruiser
 

D

Destroyer - Class in <Unnamed>
 
Destroyer() - Constructor for class Destroyer
 

E

EAST - Static variable in interface Ship
 
explainIllegalPlacement(Ship) - Method in class Grid
Returns a textual explanation for why a given Ship cannot legally be placed on the board.

F

FileLoader - Class in <Unnamed>
FileLoader reconstitutes the state of a saved game from a text file.
FileLoader() - Constructor for class FileLoader
 
FileSaver - Class in <Unnamed>
FileSaver writes the state of a game to a file.
FileSaver() - Constructor for class FileSaver
 
fromCoordinates(int, int) - Static method in class BoardPoint
Factory method that returns a reference to a newly-allocated BoardPoint that corresponds to given column and row numbers.
fromString(String) - Static method in class BoardPoint
Factory method that returns a reference to a newly-allocated BoardPoint that corresponds to a given column and row designation.

G

Game - Class in <Unnamed>
Game manages the game -- creating Player and Grid objects, and interacting with the human player at each turn.
Game(Player, Player) - Constructor for class Game
Constructs a new Game with the given Players.
getCharForPoint(BoardPoint) - Method in class AircraftCarrier
 
getCharForPoint(BoardPoint) - Method in class Barge
 
getCharForPoint(BoardPoint) - Method in class Cruiser
 
getCharForPoint(BoardPoint) - Method in class Destroyer
 
getCharForPoint(BoardPoint) - Method in interface Ship
Returns the character to display for a given BoardPoint.
getExtent() - Method in class AircraftCarrier
 
getExtent() - Method in class Barge
 
getExtent() - Method in class Cruiser
 
getExtent() - Method in class Destroyer
 
getExtent() - Method in interface Ship
Returns a newly-allocated array of BoardPoints, one for each BoardPoint this Ship occupies.
getFacing() - Method in class AircraftCarrier
 
getFacing() - Method in class Barge
 
getFacing() - Method in class Cruiser
 
getFacing() - Method in class Destroyer
 
getFacing() - Method in interface Ship
Returns the direction this Ship is facing.
getLastStruck() - Method in class Grid
Returns a reference to the Ship hit by the last strike, or null if the last strike missed all ships.
getLiveShips() - Method in class Grid
Returns a newly-allocated array of references to the ships on this grid that have not yet been destroyed.
getMove(int) - Method in class Game
Use getMove when saving games.
getMoveCount() - Method in class Game
Use getMoveCount when saving games.
getName() - Method in class AircraftCarrier
Returns "aircraft carrier."
getName() - Method in class Barge
Returns "barge."
getName() - Method in class Cruiser
Returns "cruiser."
getName() - Method in class Destroyer
Returns "destroyer."
getName() - Method in interface Ship
Returns a human-readable name for this Ship, such as "aircraft carrier."
getNextMove() - Method in class HumanPlayer
This method will prompt the user until she enters a string corresponding to a BoardPoint; after she does that, it will return a BoardPoint for that String.
getNextMove() - Method in class NaiveCPUPlayer
 
getNextMove() - Method in interface Player
Gets the next move this Player wants to execute.
getNextMove() - Method in class SmarterCPUPlayer
 
getNumRows() - Method in class Grid
Returns the number of rows in this Grid.
getOrigin() - Method in class AircraftCarrier
 
getOrigin() - Method in class Barge
 
getOrigin() - Method in class Cruiser
 
getOrigin() - Method in class Destroyer
 
getOrigin() - Method in interface Ship
Returns the origin point for this Ship.
getSunkenShips() - Method in class Grid
Returns a newly-allocated array of references to the ships on this grid that have been destroyed.
getWinner() - Method in class Game
 
getX() - Method in class BoardPoint
Returns the column number of this BoardPoint, numbered from 0-9 inclusive.
getY() - Method in class BoardPoint
Returns the row number of this BoardPoint, numbered from 0-9 inclusive.
Grid - Class in <Unnamed>
This class models a game board.
Grid() - Constructor for class Grid
 

H

HumanPlayer - Class in <Unnamed>
HumanPlayer is a Player controlled by a human user sitting at the console.
HumanPlayer() - Constructor for class HumanPlayer
 

I

isDestroyed() - Method in class AircraftCarrier
 
isDestroyed() - Method in class Barge
 
isDestroyed() - Method in class Cruiser
 
isDestroyed() - Method in class Destroyer
 
isDestroyed() - Method in interface Ship
Returns true if this Ship is destroyed, false otherwise.
isGameOver() - Method in class Game
 
isHuman() - Method in class HumanPlayer
 
isHuman() - Method in class NaiveCPUPlayer
 
isHuman() - Method in interface Player
Returns true if this Player is human.
isHuman() - Method in class SmarterCPUPlayer
 
isValid(String) - Static method in class BoardPoint
Returns true if the string given represents a valid board coordinate.

N

NaiveCPUPlayer - Class in <Unnamed>
NaiveCPUPlayer is a computer-controlled Player that uses the simplest possible strategy: at each turn, it suggests a randomly-selected BoardPoint to attack.
NaiveCPUPlayer() - Constructor for class NaiveCPUPlayer
 
NORTH - Static variable in interface Ship
 

O

occupies(BoardPoint) - Method in class AircraftCarrier
 
occupies(BoardPoint) - Method in class Barge
 
occupies(BoardPoint) - Method in class Cruiser
 
occupies(BoardPoint) - Method in class Destroyer
 
occupies(BoardPoint) - Method in interface Ship
Returns true if this Ship occupies the given space, false otherwise.

P

place(Ship) - Method in class Grid
Places a given Ship on the board.
placeOneShip() - Method in class HumanPlayer
This method will prompt the user to place a ship, as per the project writeup.
placeOneShip() - Method in class NaiveCPUPlayer
This method will randomly place one ship.
placeOneShip() - Method in interface Player
Returns a Ship object with the origin and facing direction specified by this Player
placeOneShip() - Method in class SmarterCPUPlayer
This method will randomly place one ship.
placeShipsForPlayer(Player) - Method in class Game
Repeatedly asks this Player to place ships until all five of this Player's ships are on the board in legal locations.
Player - Interface in <Unnamed>
Player represents a player in the naval vessel game -- either a human or CPU-controlled player.
playOneTurn() - Method in class Game
Does the following: The program prints a status report to the screen.

R

readGameFile(String) - Method in class FileLoader
Reconstitutes the state of the game from a file, updating the Grid objects for the CPU and human players as needed.
reconstituteMove(int) - Method in class Game
Executes a move without involving a Player.
registerStrike(BoardPoint) - Method in class AircraftCarrier
 
registerStrike(BoardPoint) - Method in class Barge
 
registerStrike(BoardPoint) - Method in class Cruiser
 
registerStrike(BoardPoint) - Method in class Destroyer
 
registerStrike(BoardPoint) - Method in class Grid
Registers a strike on this grid.
registerStrike(BoardPoint) - Method in interface Ship
Registers the result of a strike at the given point; records the strike and possibly destroys the ship.

S

saveGameFile(String) - Method in class FileSaver
Saves the state of the game to a file, reading from the Grid objects for the CPU and human players and the Game object as needed.
setBoard(Grid) - Method in class HumanPlayer
 
setBoard(Grid) - Method in class NaiveCPUPlayer
 
setBoard(Grid) - Method in interface Player
Sets the board for this Player to the given Grid.
setBoard(Grid) - Method in class SmarterCPUPlayer
 
setCPUPlayerBoard(Grid) - Method in class FileLoader
Sets the Grid for the CPU player.
setCPUPlayerBoard(Grid) - Method in class FileSaver
Sets the Grid for the CPU player.
setFacing(int) - Method in class AircraftCarrier
 
setFacing(int) - Method in class Barge
 
setFacing(int) - Method in class Cruiser
 
setFacing(int) - Method in class Destroyer
 
setFacing(int) - Method in interface Ship
Sets the direction this ship is facing.
setGame(Game) - Method in class FileLoader
Sets the Game to reconstitute moves into.
setGame(Game) - Method in class FileSaver
Sets the Game to reconstitute moves into.
setHumanPlayerBoard(Grid) - Method in class FileLoader
Sets the Grid for the human player.
setHumanPlayerBoard(Grid) - Method in class FileSaver
Sets the Grid for the human player.
setMove(int, BoardPoint) - Method in class Game
Use setMove when loading games, to set up the move state for the ith move in this Game.
setOrigin(BoardPoint) - Method in class AircraftCarrier
 
setOrigin(BoardPoint) - Method in class Barge
 
setOrigin(BoardPoint) - Method in class Cruiser
 
setOrigin(BoardPoint) - Method in class Destroyer
 
setOrigin(BoardPoint) - Method in interface Ship
Sets the origin of this ship as a BoardPoint.
setPlayerView() - Method in class Grid
Sets this Grid to "player view mode." In player view mode, the positions of ships and the results of strikes are shown.
setResultsView() - Method in class Grid
Sets this Grid to "results view mode." In results view mode, only the results of strikes are shown.
Ship - Interface in <Unnamed>
Ship is an interface that all of your ship classes must implement.
SmarterCPUPlayer - Class in <Unnamed>
SmarterCPUPlayer is a computer-controlled Player that uses a "smarter" strategy to choose which point to strike.
SmarterCPUPlayer() - Constructor for class SmarterCPUPlayer
 
SOUTH - Static variable in interface Ship
 
stringForRow(int) - Method in class Grid
Returns a textual representation of the given row.

W

WEST - Static variable in interface Ship
 

A B C D E F G H I N O P R S W