Struct shakmaty::Setup

source ·
pub struct Setup {
    pub board: Board,
    pub promoted: Bitboard,
    pub pockets: Option<ByColor<ByRole<u8>>>,
    pub turn: Color,
    pub castling_rights: Bitboard,
    pub ep_square: Option<Square>,
    pub remaining_checks: Option<ByColor<RemainingChecks>>,
    pub halfmoves: u32,
    pub fullmoves: NonZeroU32,
}
Expand description

A not necessarily legal position.

Fields§

§board: Board

Piece positions on the board.

§promoted: Bitboard

Positions of tracked promoted pieces. Used only for Crazyhouse.

§pockets: Option<ByColor<ByRole<u8>>>

Pockets in chess variants like Crazyhouse.

§turn: Color

Side to move.

§castling_rights: Bitboard

Castling rights in terms of corresponding rook positions.

Examples

use shakmaty::{Bitboard, Setup};

let setup = Setup::default();
let rooks = setup.castling_rights;
// 1 . . . . . . 1
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// 1 . . . . . . 1

assert_eq!(rooks, Bitboard::CORNERS);
§ep_square: Option<Square>

En passant target square. Valid target squares are on the third or sixth rank.

§remaining_checks: Option<ByColor<RemainingChecks>>

Remaining checks in chess variants like Three-Check.

§halfmoves: u32

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

Examples

use shakmaty::Setup;

let setup = Setup::default();
assert_eq!(setup.halfmoves, 0);
§fullmoves: NonZeroU32

Current move number.

Starts at 1 and is increased after every black move.

Examples

use shakmaty::Setup;

let setup = Setup::default();
assert_eq!(setup.fullmoves.get(), 1);

Implementations§

Plain, empty board. No pieces. White to play.

Default board setup.

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.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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.