Module app

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

java.lang.Object
app.utils.pieceplayer.InteractivePiece<M,P>
Direct Known Subclasses:
LogicalPiece

public abstract class InteractivePiece<M extends Move<P>,P extends Piece> extends Object
Interface for moving single piece, to be used with external controllers such as UI.

Override update method to implement custom behavior

  • Field Details

  • Constructor Details

    • InteractivePiece

      public InteractivePiece()
  • Method Details

    • getPiece

      public final P getPiece()
      Returns:
      Controlled game piece
    • getLegalMoves

      public final List<M> getLegalMoves()
      Returns:
      List of moves this piece can make
    • makeMove

      public final void makeMove(M move)
      Make a move with this piece
    • update

      public void update(M move)
      update is called when state of a piece changes
      Parameters:
      move - move that caused the change
    • update

      public void update()
      update is called when state of a piece changes