Module app
Package app.chess

Class ChessPiece

java.lang.Object
app.chess.ChessPiece
All Implemented Interfaces:
Piece

public final class ChessPiece extends Object implements Piece
Information about ChessPiece that is exposed to the users of chess package
  • Field Details

  • Constructor Details

  • Method Details

    • getPosition

      public Field getPosition()
      Specified by:
      getPosition in interface Piece
      Returns:
      position this piece is located at
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface Piece
      Returns:
      true if piece is still in game, false otherwise
    • getPlayer

      public int getPlayer()
      Specified by:
      getPlayer in interface Piece
      Returns:
      id of player that can play with this piece
    • getKind

      public ChessPieceKind getKind()
      Returns:
      kind of the piece - pawn, rook, etc.
    • getColor

      public ChessPieceColor getColor()
      Returns:
      color of the piece - black or white
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • unwrap

      Unwraps stored AbstractChessPiece for internal chess usage
      Returns:
      underlying chess piece
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object