Class LudoToken

java.lang.Object
edu.ntnu.idi.idatt.model.token.LudoToken

public class LudoToken extends Object
LudoToken.

Represents a single game piece (token) in a Ludo game. Each token has a unique ID (within its player's set of tokens), a LudoToken.TokenStatus indicating its current state (e.g., in the start area, on the track, or finished), and a reference to the Tile it currently occupies (if any).

See Also:
  • Constructor Details

    • LudoToken

      public LudoToken(int tokenId)
      Constructs a LudoToken with the given ID. Initially, the token's status is set to LudoToken.TokenStatus.NOT_RELEASED and its current tile is null.
      Parameters:
      tokenId - The unique identifier for this token (typically 1-4 for Ludo).
  • Method Details

    • getTokenId

      public int getTokenId()
      Gets the unique ID of this token.
      Returns:
      The token ID.
    • getStatus

      public LudoToken.TokenStatus getStatus()
      Gets the current status of this token.
      Returns:
      The LudoToken.TokenStatus of the token.
    • getCurrentTile

      public Tile getCurrentTile()
      Gets the tile this token currently occupies.
      Returns:
      The current Tile, or null if the token is not on a tile (e.g., not released).
    • setStatus

      public void setStatus(LudoToken.TokenStatus status)
      Sets the status of this token.
      Parameters:
      status - The new LudoToken.TokenStatus for the token.
    • setCurrentTile

      public void setCurrentTile(Tile currentTile)
      Sets the current tile for this token.
      Parameters:
      currentTile - The new Tile the token occupies.