Move

open class Move

Represents a single player's move on the board. It does not store information about the origin position, as its primary purpose is move representation. Its string representation is the full algebraic notation of the move as used in the UCI protocol (e.g., "e2e4", "a7a8q"). It is immutable.

This class leverages bitwise operations for efficient storage and manipulation.

Since

1.0.0-beta.1

Author

lunalobos

Properties

Link copied to clipboard
val origin: Int

The zero-based index (0-63) of the move's origin square.

Link copied to clipboard

The ordinal value of the promotion piece, or -1 if no promotion occurs. The ordinal corresponds to the Piece enum.

Link copied to clipboard
val target: Int

The zero-based index (0-63) of the move's target square.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int

Generates a 16-bit hash code based on the move's origin, target, and promotion piece.

Link copied to clipboard
fun origin(): Square

Returns the origin square of the move as a Square enum constant.

Link copied to clipboard

Returns the promotion piece of the move as a Piece enum constant. Returns Piece.EMPTY if no promotion occurs.

Link copied to clipboard
fun target(): Square

Returns the target square of the move as a Square enum constant.

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

Returns the move in standard UCI notation (e.g., "e2e4", "a7a8q" for promotion).