Module app

Class Player<M extends Move<P>,P extends Piece>

java.lang.Object
app.core.interactor.Player<M,P>
Direct Known Subclasses:
DumbPlayer

public class Player<M extends Move<P>,P extends Piece> extends Object
Player exposed to external controllers such as UI, abstracts out player number and underlying game.

Note that player is not a spectator and does not receive updates from game.

Override update method to implement custom behavior

  • Field Details

  • Constructor Details

    • Player

      public Player()
  • Method Details

    • getPieces

      public final List<P> getPieces()
      Returns all pieces that belong to this player
    • getAllPieces

      public final List<P> getAllPieces()
      Returns all pieces in the game
    • getLegalMoves

      public final List<M> getLegalMoves()
      Returns list of available moves
    • getLegalMoves

      public final List<M> getLegalMoves(P piece)
      Returns list of available moves with given piece
    • makeMove

      public final List<P> makeMove(M move)
      Makes a move
    • getID

      public final int getID()
      Returns in-game id of this player