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]
fn invalid() -> MoveDigest
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.
fn move_type(&self) -> MoveType
Returns the move type.
fn orig_square(&self) -> Square
Returns the origin square of the played piece.
fn dest_square(&self) -> Square
Returns the destination square for the played piece.
fn aux_data(&self) -> usize
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]
impl Clone for MoveDigest
[src]
fn clone(&self) -> MoveDigest
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for MoveDigest
[src]
impl PartialEq for MoveDigest
[src]
fn eq(&self, __arg_0: &MoveDigest) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MoveDigest) -> bool
This method tests for !=
.