Package edu.ntnu.idi.idatt.model.player
Class LadderGamePlayer
java.lang.Object
edu.ntnu.idi.idatt.model.player.Player
edu.ntnu.idi.idatt.model.player.LadderGamePlayer
LadderGamePlayer.
Represents a player specifically in a Ladder Game. This class extends the general
Player
class and adds functionality relevant to ladder games, primarily tracking
the player's current LadderGameTile
on the board.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLadderGamePlayer
(String name, String colorHex, PlayerTokenType playerTokenType, boolean isBot) Constructs a newLadderGamePlayer
. -
Method Summary
Modifier and TypeMethodDescriptionReturns theLadderGameTile
the player is currently on.void
placeOnTile
(Tile tile) Places the player on the specifiedTile
.Methods inherited from class edu.ntnu.idi.idatt.model.player.Player
getColorHex, getName, getPlayerTokenType, isBot, setBot, setColorHex, setName, setPlayerTokenType
-
Constructor Details
-
LadderGamePlayer
public LadderGamePlayer(String name, String colorHex, PlayerTokenType playerTokenType, boolean isBot) Constructs a newLadderGamePlayer
.- Parameters:
name
- The name of the player.colorHex
- The hexadecimal string representation of the player's color.playerTokenType
- ThePlayerTokenType
chosen by the player.isBot
- A boolean indicating whether this player is a bot (AI-controlled).
-
-
Method Details
-
getCurrentTile
Returns theLadderGameTile
the player is currently on.- Returns:
- The current
LadderGameTile
of the player, ornull
if not yet placed.
-
placeOnTile
Places the player on the specifiedTile
. The tile is validated to ensure it is aLadderGameTile
and not null.- Parameters:
tile
- TheTile
(must be aLadderGameTile
) to place the player on.- Throws:
IllegalArgumentException
- if the provided tile is null or not an instance ofLadderGameTile
.
-