Move

data class Move(val from: Square, val to: Square, val promotionPieceType: PieceType? = null, val isCapture: Boolean = false, val isCastlingKingside: Boolean = false, val isCastlingQueenside: Boolean = false, val isEnPassantCapture: Boolean = false)

Represents a chess move, including source and destination squares, optional promotion, and special move flags.

Constructors

Link copied to clipboard
constructor(from: Square, to: Square, promotionChar: Char?)

Secondary constructor for moves with promotion specified as a character.

constructor(from: String, to: String, promotionPieceType: PieceType? = null)

Secondary constructor for moves specified by string coordinates.

constructor(from: Square, to: Square, promotionPieceType: PieceType? = null, isCapture: Boolean = false, isCastlingKingside: Boolean = false, isCastlingQueenside: Boolean = false, isEnPassantCapture: Boolean = false)

Properties

Link copied to clipboard

The starting square of the move.

Link copied to clipboard
val isCapture: Boolean = false

True if the move is a capture.

Link copied to clipboard

True if the move is kingside castling.

Link copied to clipboard

True if the move is queenside castling.

Link copied to clipboard

True if the move is an en passant capture.

Link copied to clipboard

The piece type to promote to, if applicable.

Link copied to clipboard
val to: Square

The destination square of the move.

Functions

Link copied to clipboard
open override fun toString(): String

Returns a string representation of the move in coordinate notation, including promotion if applicable.

Link copied to clipboard
fun toUci(): String

Returns the move in UCI (Universal Chess Interface) notation.