Struct alcibiades::MoveDigest [] [src]

pub struct MoveDigest(_);

Encodes the minimum needed information that unambiguously describes a move.

MoveDigest is a u16 number. It is laid out the following way:

  15                                                           0
 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
 | Move  |    Origin square      |   Destination square  | Aux   |
 | type  |       6 bits          |        6 bits         | data  |
 | 2 bits|   |   |   |   |   |   |   |   |   |   |   |   | 2 bits|
 |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

There are 4 "move type"s: 0) en-passant capture; 1) pawn promotion; 2) castling; 3) normal move. "Aux data" encodes the type of the promoted piece if the move type is pawn promotion, otherwise it is zero.

Methods

impl MoveDigest
[src]

Creates an invalid move digest instance.

The returned instance contains 0. This is sometimes useful in places where any move is required but no is available.

Returns the move type.

Returns the origin square of the played piece.

Returns the destination square for the played piece.

Returns a value between 0 and 3 representing the auxiliary data.

When the move type is pawn promotion, "aux data" encodes the promoted piece type. For all other move types "aux data" is zero.

Trait Implementations

impl Debug for MoveDigest
[src]

Formats the value using the given formatter.

impl Clone for MoveDigest
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for MoveDigest
[src]

impl PartialEq for MoveDigest
[src]

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

This method tests for !=.

impl Eq for MoveDigest
[src]