All Implemented Interfaces:
Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
TicTacToeBoard

public abstract class GameBoard extends AreaEntity
  • Field Details

    • board

      protected BoardToken[][] board
    • active

      protected boolean active
    • players

      protected List<String> players
    • tokenTypes

      protected List<String> tokenTypes
    • currentPlayerIndex

      protected int currentPlayerIndex
    • npc

      protected SpeakerNPC npc
  • Constructor Details

    • GameBoard

      public GameBoard()
      creates a new GameBoard
    • GameBoard

      public GameBoard(int width, int height)
      creates a new GameBoard
      Parameters:
      width - width of the board
      height - height of the board
  • Method Details

    • setNPC

      public void setNPC(SpeakerNPC npc)
      sets the NPC who manages this game
      Parameters:
      npc - SpeakerNPC
    • isGameActive

      public boolean isGameActive()
      is the game active?
      Returns:
      active
    • getPlayers

      public List<String> getPlayers()
      gets a list of player names participating in this game
      Returns:
      list of player names
    • getCurrentPlayer

      public String getCurrentPlayer()
      gets the name of the player who is doing the current turn.
      Returns:
      name of player
    • getCurrentTokenType

      public Object getCurrentTokenType()
      gets the name of the token type for the current turn
      Returns:
      name of token type
    • getNPCName

      public String getNPCName()
      gets the name of the NPC
      Returns:
      name of NPC
    • areEmptyFieldsLeft

      public boolean areEmptyFieldsLeft()
      checks whether there are empty spots left
      Returns:
      true iff there are empty spots.
    • nextTurn

      protected void nextTurn()
      moves to the next turn (next player)
    • onTokenMoved

      public void onTokenMoved(Player player, BoardToken token)
      handling of moved token
      Parameters:
      player - player moving the toke
      token - moved token
    • startGame

      protected void startGame()
    • endGame

      protected void endGame()
    • timeOut

      public void timeOut()
    • getTokenAt

      public BoardToken getTokenAt(int xIndex, int yIndex)
      returns the token at the specified index
      Parameters:
      xIndex - target x-index
      yIndex - target y-index
      Returns:
      token or null
    • generateRPClass

      public static void generateRPClass()
      generates the RP class