Package edu.ntnu.idi.idatt.model.board
Class BaseBoard
java.lang.Object
edu.ntnu.idi.idatt.model.board.BaseBoard
- All Implemented Interfaces:
Board
- Direct Known Subclasses:
LadderGameBoard
,LudoGameBoard
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a tile to the board.Gets the background of the board.Gets the description of the board.getName()
Gets the name of the board.getTile
(int tileId) Gets a tile by its ID.int
Gets the total number of tiles on the board excluding the starting tile, which normally is outside of the board, with the id 0.getTiles()
Gets all tiles on the board.void
setBackground
(String background) Sets the background of the board.void
setDescription
(String description) Sets the description of the board.void
Sets the name of the board.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.ntnu.idi.idatt.model.board.Board
createTiles
-
Field Details
-
name
-
description
-
tiles
-
background
-
-
Constructor Details
-
BaseBoard
Constructor for BaseBoard.- Parameters:
name
- The name of the boarddescription
- The description of the boardbackground
- The background of the board
-
-
Method Details
-
getName
Gets the name of the board. -
getDescription
Gets the description of the board.- Specified by:
getDescription
in interfaceBoard
- Returns:
- the description of the board
-
getBackground
Gets the background of the board.- Specified by:
getBackground
in interfaceBoard
- Returns:
- the background of the board
-
getTile
Gets a tile by its ID. -
getTiles
Gets all tiles on the board. -
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 interfaceBoard
- Returns:
- the number of tiles
-
setName
Sets the name of the board. -
setDescription
Sets the description of the board.- Specified by:
setDescription
in interfaceBoard
- Parameters:
description
- the description to set
-
setBackground
Sets the background of the board.- Specified by:
setBackground
in interfaceBoard
- Parameters:
background
- the background to set
-
addTile
Adds a tile to the board.
-