Class GameState

java.lang.Object
student.micro.battleship.GameState
Direct Known Subclasses:
TestableGameState

public class GameState extends Object
Represents the state of a game of "Battleship", including both players' boards.
  • Constructor Details

    • GameState

      public GameState()
      Create a new game state, with two empty boards.
  • Method Details

    • getMyBoard

      public Board getMyBoard()
      Get my board from the game state.
      Returns:
      My board.
    • getOpponentsBoard

      public Board getOpponentsBoard()
      Get my opponent's board from the game state.
      Returns:
      My opponent's board.
    • getRound

      public int getRound()
      Get this game's current round number (the number of shots fired by both players so far).
      Returns:
      This game's round number.
    • toString

      public String toString()
      Overrides:
      toString in class Object