Class Piece

java.lang.Object
com.chess.backend.gamemodel.Piece

public class Piece extends Object
Represents a piece.
  • Constructor Details

    • Piece

      public Piece(PieceType pieceType, Player player, boolean clockwise)
  • Method Details

    • getAllowedFullMoves

      public HashSet<Move> getAllowedFullMoves(Chessboard chessboard)
      Returns all allowed moves of the piece. The moves for each pieceType are composed of several abstract moves.
      Parameters:
      chessboard - Chessboard
      Returns:
      A HashSet of all allowed moves of the piece in this individual game context.
    • getAllowedMoves

      public ArrayList<Square> getAllowedMoves(Chessboard chessboard)
      Converts AllowedFullMoves to an array of Squares representing only the destination of the move.
      Parameters:
      chessboard - Chessboard
      Returns:
      ArrayList of possible Squares to move to.
    • getColor

      public Color getColor()
    • getSymbol

      public String getSymbol()
    • getPosition

      public Position getPosition()
    • toString

      public String toString()
      Overrides:
      toString in class Object