Class AbstractMultiplayerPlayer

java.lang.Object
com.codingame.gameengine.core.AbstractPlayer
com.codingame.gameengine.core.AbstractMultiplayerPlayer

public abstract class AbstractMultiplayerPlayer extends AbstractPlayer
The representation of a player's AI during the game's execution.
  • Constructor Details

    • AbstractMultiplayerPlayer

      public AbstractMultiplayerPlayer()
  • Method Details

    • getColorToken

      public final int getColorToken()
      Returns an integer that will be converted into the player's real color by the viewer.
      Returns:
      the player's color token.
    • isActive

      public final boolean isActive()
      Returns true is the player is still active in the game (can be executed).
      Returns:
      true is the player is active.
    • getIndex

      public final int getIndex()
      Get player index from 0 (included) to number of players (excluded).
      Returns:
      the player index.
    • getScore

      public final int getScore()
      Get current score.
      Returns:
      current player score
    • setScore

      public final void setScore(int score)
      Set current score. This is used to rank the players at the end of the game.
      Parameters:
      score - current player score
    • deactivate

      public final void deactivate()
      Deactivate a player. The player can't play after this and is no longer in the list of active players.
    • deactivate

      public final void deactivate(String reason)
      Deactivate a player and adds a tooltip with the reason. The player can't play after this and is no longer in the list of active players.
      Parameters:
      reason - Message to display in the tooltip.