Module org.example

Class King

java.lang.Object
cz.cvut.fel.pjv.model.Pieces.Piece
cz.cvut.fel.pjv.model.Pieces.King
All Implemented Interfaces:
java.io.Serializable

public class King
extends Piece
Class representation of the king piece.
See Also:
Serialized Form
  • Constructor Details

    • King

      public King​(boolean white)
      Create king piece
      Parameters:
      white -
  • Method Details

    • setLongCastlingMove

      public void setLongCastlingMove​(boolean longCastlingMove)
    • setShortCastlingMove

      public void setShortCastlingMove​(boolean shortCastlingMove)
    • isLongCastlingMove

      public boolean isLongCastlingMove()
    • isShortCastlingMove

      public boolean isShortCastlingMove()
    • setMoved

      public void setMoved​(boolean moved)
    • isMoved

      public boolean isMoved()
    • canMove

      public boolean canMove​(Board board, Spot start, Spot end) throws java.lang.Exception
      Methode to validate if the move is possible.
      Specified by:
      canMove in class Piece
      Parameters:
      board -
      start -
      end -
      Returns:
      Throws:
      java.lang.Exception
    • getPieceSymbol

      public java.lang.String getPieceSymbol()
      Method to get a symbol of the piece for print on board.
      Specified by:
      getPieceSymbol in class Piece
      Returns:
    • toString

      public java.lang.String toString()
      Method to get a symbol of the piece for print on console board.
      Overrides:
      toString in class java.lang.Object
      Returns: