Struct alcibiades::utils::ZobristArrays [] [src]

pub struct ZobristArrays {
    pub to_move: u64,
    pub pieces: [[[u64; 64]; 6]; 2],
    pub castling_rights: [u64; 16],
    pub enpassant_file: [u64; 16],
    pub halfmove_clock: [u64; 100],
}

Tables for calculating Zobrist hashes.

Zobrist hashing is a technique to transform a board position into a number of a fixed length, with an equal distribution over all possible numbers, invented by Albert Zobrist. The key property of this method is that two similar positions generate entirely different hash numbers.

Fields

The constant with which the hash value should be XOR-ed when the side to move changes.

Constants with which the hash value should be XOR-ed when a piece of given color on a given square appears/disappears.

Constants with which the hash value should be XOR-ed, for the old and the new castling rights on each move.

Constants with which the hash value should be XOR-ed, for the old and the new en-passant file on each move (a value between 0 and 7). Indexes between 8 and 15 point to zeroes, and are for convenience and memory safety.

Constants with which the hash value should be XOR-ed to reflect the number of half-moves played without capturing a piece or advancing a pawn.

Methods

impl ZobristArrays
[src]

Returns a reference to an initialized ZobristArrays object.

The object is created only during the first call. All next calls will return a reference to the same object. This is done in a thread-safe manner.