Class BaseBoard

java.lang.Object
edu.ntnu.idi.idatt.model.board.BaseBoard
All Implemented Interfaces:
Board
Direct Known Subclasses:
LadderGameBoard, LudoGameBoard

public abstract class BaseBoard extends Object implements Board
BaseBoard class

Abstract class implementing common functionality for board game boards. This class provides the base implementation for both Chutes and Ladders and Ludo boards.

  • Field Details

  • Constructor Details

    • BaseBoard

      protected BaseBoard(String name, String description, String background)
      Constructor for BaseBoard.
      Parameters:
      name - The name of the board
      description - The description of the board
      background - The background of the board
  • Method Details

    • getName

      public String getName()
      Gets the name of the board.
      Specified by:
      getName in interface Board
      Returns:
      the name of the board
    • getDescription

      public String getDescription()
      Gets the description of the board.
      Specified by:
      getDescription in interface Board
      Returns:
      the description of the board
    • getBackground

      public String getBackground()
      Gets the background of the board.
      Specified by:
      getBackground in interface Board
      Returns:
      the background of the board
    • getTile

      public Tile getTile(int tileId)
      Gets a tile by its ID.
      Specified by:
      getTile in interface Board
      Parameters:
      tileId - the ID of the tile to get
      Returns:
      the tile with the given ID
    • getTiles

      public List<Tile> getTiles()
      Gets all tiles on the board.
      Specified by:
      getTiles in interface Board
      Returns:
      a list of all tiles
    • getTileCount

      public int getTileCount()
      Gets the total number of tiles on the board excluding the starting tile, which normally is outside of the board, with the id 0.
      Specified by:
      getTileCount in interface Board
      Returns:
      the number of tiles
    • setName

      public void setName(String name)
      Sets the name of the board.
      Specified by:
      setName in interface Board
      Parameters:
      name - the name to set
    • setDescription

      public void setDescription(String description)
      Sets the description of the board.
      Specified by:
      setDescription in interface Board
      Parameters:
      description - the description to set
    • setBackground

      public void setBackground(String background)
      Sets the background of the board.
      Specified by:
      setBackground in interface Board
      Parameters:
      background - the background to set
    • addTile

      public void addTile(Tile tile)
      Adds a tile to the board.
      Specified by:
      addTile in interface Board
      Parameters:
      tile - the tile to add