Struct pleco::piece_move::BitMove
[−]
[src]
pub struct BitMove { /* fields omitted */ }
Represents a singular move.
A [BitMove] consists of 16 bits, all of which to include a source square, destination square, and special move-flags to differentiate types of moves.
A BitMove should never be created directly, but rather instigated with a [PreMoveInfo]. This is because the bits are in a special order, and manually creating moves risks creating an invalid move.
Methods
impl BitMove
[src]
fn new(input: u16) -> BitMove
[src]
Creates a new BitMove from raw bits.
Safety
Using this method cannot gaurntee that the move is legal. The input bits must be encoding a legal move, or else there is Undefined Behavior if the resulting BitMove is used.
fn init(info: PreMoveInfo) -> BitMove
[src]
Creates a BitMove from a [PreMoveInfo].
fn null() -> Self
[src]
Creates a Null Move.
Safety
A Null move is never a valid move to play. Using a Null move should onl be used for search and evaluation purposes.
fn is_null(&self) -> bool
[src]
Returns if a [BitMove] is a Null Move.
See [BitMove::null()] for more information on Null moves.
fn is_capture(&self) -> bool
[src]
Returns if a [BitMove] captures an opponent's piece.
fn is_quiet_move(&self) -> bool
[src]
Returns if a [BitMove] is a Quiet Move, meaning it is not any of the following: a capture, promotion, castle, or double pawn push.
fn is_promo(&self) -> bool
[src]
Returns if a [BitMove] is a promotion.
fn get_dest(&self) -> SQ
[src]
Returns the destination of a [BitMove].
fn get_src(&self) -> SQ
[src]
Returns the source square of a [BitMove].
fn is_castle(&self) -> bool
[src]
Returns if a [BitMove] is a castle.
fn is_king_castle(&self) -> bool
[src]
Returns if a [BitMove] is a Castle && it is a KingSide Castle.
fn is_queen_castle(&self) -> bool
[src]
Returns if a [BitMove] is a Castle && it is a QueenSide Castle.
fn is_en_passant(&self) -> bool
[src]
Returns if a [BitMove] is an enpassant capture.
fn is_double_push(&self) -> (bool, u8)
[src]
Returns if a [BitMove] is a double push, and if so returns the Destination square as well.
fn dest_row(&self) -> u8
[src]
fn dest_col(&self) -> u8
[src]
fn src_row(&self) -> u8
[src]
fn src_col(&self) -> u8
[src]
fn promo_piece(&self) -> Piece
[src]
Returns the Promotion Piece of a [BitMove].
Safety
Method should only be used if the [BitMove] is a promotion. Otherwise, Undefined Behavior may result.
fn move_type(&self) -> MoveType
[src]
Returns the [MoveType] of a [BitMove].
fn stringify(&self) -> String
[src]
Returns a String representation of a [BitMove]
Format goes "Source Square, Destination Square, (Promo Piece)". Moving a Queen from A1 to B8 will stringify to "a1b8". If there is a pawn promotion involved, the piece promoted to will be appended to the end of the string, alike "a7a8q" in the case of a queen promotion
fn get_raw(&self) -> u16
[src]
Returns the raw number represenation of the move.
Trait Implementations
impl Copy for BitMove
[src]
impl Clone for BitMove
[src]
fn clone(&self) -> BitMove
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for BitMove
[src]
fn eq(&self, __arg_0: &BitMove) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BitMove) -> bool
[src]
This method tests for !=
.