Home Reference Source Demo Test

References

battleship

summary
public

C Board

Main class that controls basic operations of battleship.

public

C Game

Controller class for the board to auto-play a game.

public

C Moves

Data storage class for each move (attack) in the game.

public

C Ship

The Ship class contains key ship properties:

  • shipType
  • positions (array of row, column indexes) of tiles that the ship is placed on
  • hits (1-D boolean array) indicating if the index in positions has been hit
  • sunk (boolean) true if all positions have been hit
public

C Tile

A Tile is an object of the board representing:

  • the position,
  • the ship object (if any), and
  • if this object has been attacked
public

C Utils

Utility static class (mostly) containing common validation functions

public
public
public
public
public
public
Directories