pub struct Chess { /* private fields */ }
Expand description

A standard Chess position.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

Set up a playable Position. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Piece positions on the board.

Positions of tracked promoted pieces. Used only for Crazyhouse.

Pockets in chess variants like Crazyhouse.

Side to move.

Castling paths and unmoved rooks.

Unconditionally gets the en passant target square after a double pawn push, even if no en passant capture is actually possible. Read more

Remaining checks in Three-Check.

Number of half-moves since the last capture or pawn move. Read more

Move number. Starts at 1 and is increased after every black move.

Converts the position to the current Setup.

Plays a move. It is the callers responsibility to ensure the move is legal. Read more

Generates all legal moves.

Generates legal castling moves.

Generates en passant moves.

Generate promotion moves.

Generates a subset of legal moves: All piece moves and drops of type role to the square to, excluding castling moves. Read more

Tests if a side has insufficient winning material. Read more

Checks if the game is over due to a special variant end condition. Read more

Tests special variant winning, losing and drawing conditions.

Generates capture moves.

Tests if a move is irreversible. Read more

Attacks that a king on square would have to deal with.

Squares occupied by the side to move.

Squares occupied with the given piece type by the side to move.

Squares occupied by the opponent of the side to move.

Squares occupied with the given piece type by the opponent of the side to move. Read more

Tests a move for legality.

The en passant square, if it is the target of a pseudo-legal en passant move. Read more

The en passant square, if it really is the target of a legal en passant move. Read more

The en passant square.

Bitboard of pieces giving check.

Tests if the king is in check.

Tests for checkmate.

Tests for stalemate.

Tests if the game is over due to checkmate, stalemate, insufficient material or variant end. Read more

The outcome of the game, or None if the game is not over.

Plays a move. Read more

Swap turns. This is sometimes called “playing a null move”. Read more

Computes the Zobrist hash of the position from scratch. Hash includes the position, except halfmove clock and fullmove number. Read more

Prepares an incremental update of the Zobrist hash before playing move m in self. Returns a new intermediate Zobrist hash, or None if incremental updating is not supported. Read more

Finalizes an incremental update of the Zobrist hash after playing move m in self. Returns the new Zobrist hash, or None if incremental updating is not supported. Read more

Equivalent to comparing Position::into_setup(EnPassantMode::Legal).

Positions with different CastlingMode may be equivalent. En passant squares are considered only if there is a legal en passant capture.

Example

use shakmaty::{CastlingMode, Chess, fen::Fen};

let fen: Fen = "r1bqkbnr/ppp2Qpp/2np4/4p3/2B1P3/8/PPPP1PPP/RNB1K1NR b KQkq - 0 4".parse()?;
let position: Chess = fen.clone().into_position(CastlingMode::Standard)?;
let position_960: Chess = fen.into_position(CastlingMode::Chess960)?;
assert_eq!(position, position_960);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.