Module pabi::chess::core

source ·
Expand description

Chess primitives commonly used within crate::chess.

Structs§

  • Track the ability to castle each side (kingside is often referred to as O-O or h-side castle, queenside – O-O-O or a-side castle). When the king moves, player loses ability to castle. When the rook moves, player loses ability to castle to the side from which the rook moved.
  • Represents any kind of a legal chess move. A move is the only way to mutate crate::chess::position::Position and change the board state. Moves are not sorted according to their potential “value” by the move generator. The move representation has one-to-one correspondence with the UCI move representation. The moves can also be indexed and fed as an input to the Neural Network evaluators that would be able assess their potential without evaluating post-states.
  • Represents a specific piece owned by a player.
  • Iterates over squares in the order from A1 to H8, from left to right, from bottom to the top.

Enums§

  • A standard game of chess is played between two players: White (having the advantage of the first turn) and Black.
  • Directions on the board from a perspective of White player.
  • Represents a column (vertical row) of the chessboard. In chess notation, it is normally represented with a lowercase letter.
  • Standard chess pieces types for one player.
  • A pawn can be promoted to a queen, rook, bishop or a knight.
  • Represents a horizontal row of the chessboard. In chess notation, it is represented with a number. The implementation assumes zero-based values (i.e. rank 1 would be 0).
  • Board squares: from left to right, from bottom to the top (Little-Endian Rank-File Mapping):

Constants§

Type Aliases§

  • Moves are stored on stack to avoid memory allocations and improve performance. This is important for performance reasons and also prevents unnecessary copying that would occur if the moves would be stored in std::Vec with unknown capacity.