[−][src]Struct pleco::core::piece_move::BitMove
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]
pub const FLAG_QUIET: u16
[src]
pub const FLAG_DOUBLE_PAWN: u16
[src]
pub const FLAG_KING_CASTLE: u16
[src]
pub const FLAG_QUEEN_CASTLE: u16
[src]
pub const FLAG_CAPTURE: u16
[src]
pub const FLAG_EP: u16
[src]
pub const ILLEGAL_FLAG_1: u16
[src]
pub const ILLEGAL_FLAG_2: u16
[src]
pub const FLAG_PROMO_N: u16
[src]
pub const FLAG_PROMO_B: u16
[src]
pub const FLAG_PROMO_R: u16
[src]
pub const FLAG_PROMO_Q: u16
[src]
pub const FLAG_PROMO_CAP_N: u16
[src]
pub const FLAG_PROMO_CAP_B: u16
[src]
pub const FLAG_PROMO_CAP_R: u16
[src]
pub const FLAG_PROMO_CAP_Q: u16
[src]
pub const fn new(input: u16) -> BitMove
[src]
Creates a new BitMove from raw bits.
Safety
Using this method cannot guarantee 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.
pub const fn make_quiet(src: SQ, dst: SQ) -> BitMove
[src]
Makes a quiet BitMove
from a source and destination square.
pub const fn make_pawn_push(src: SQ, dst: SQ) -> BitMove
[src]
Makes a pawn-push BitMove
from a source and destination square.
pub const fn make_capture(src: SQ, dst: SQ) -> BitMove
[src]
Makes a non-enpassant capturing BitMove
from a source and destination square.
pub const fn make_ep_capture(src: SQ, dst: SQ) -> BitMove
[src]
Makes an enpassant BitMove
from a source and destination square.
pub const fn make(flag_bits: u16, src: SQ, dst: SQ) -> BitMove
[src]
Creates a BitMove
from a source and destination square, as well as the current
flag.
pub fn init(info: PreMoveInfo) -> BitMove
[src]
Creates a BitMove from a PreMoveInfo
.
pub const 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.
pub const fn is_null(self) -> bool
[src]
Returns if a BitMove
is a Null Move.
See BitMove::null()
for more information on Null moves.
pub const fn is_capture(self) -> bool
[src]
Returns if a BitMove
captures an opponent's piece.
pub const 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.
pub const fn is_promo(self) -> bool
[src]
Returns if a BitMove
is a promotion.
pub const fn get_dest(self) -> SQ
[src]
Returns the destination of a BitMove
.
pub const fn get_dest_u8(self) -> u8
[src]
Returns the destination of a BitMove
.
pub const fn get_src(self) -> SQ
[src]
Returns the source square of a BitMove
.
pub const fn get_src_u8(self) -> u8
[src]
Returns the source square of a BitMove
.
pub const fn is_castle(self) -> bool
[src]
Returns if a BitMove
is a castle.
pub const fn is_king_castle(self) -> bool
[src]
Returns if a BitMove
is a Castle && it is a KingSide Castle.
pub const fn is_queen_castle(self) -> bool
[src]
Returns if a BitMove
is a Castle && it is a QueenSide Castle.
pub const fn is_en_passant(self) -> bool
[src]
Returns if a BitMove
is an enpassant capture.
pub 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.
pub fn dest_row(self) -> Rank
[src]
Returns the Rank
(otherwise known as row) that the destination square of a BitMove
lies on.
pub fn dest_col(self) -> File
[src]
Returns the File
(otherwise known as column) that the destination square of a BitMove
lies on.
pub fn src_row(self) -> Rank
[src]
Returns the Rank
(otherwise known as row) that the from-square of a BitMove
lies on.
pub fn src_col(self) -> File
[src]
Returns the File
(otherwise known as column) that the from-square of a BitMove
lies on.
pub fn promo_piece(self) -> PieceType
[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.
pub fn move_type(self) -> MoveType
[src]
Returns the MoveType
of a BitMove
.
pub 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.
pub const fn get_raw(self) -> u16
[src]
Returns the raw number representation of the move.
pub fn incorrect_flag(self) -> bool
[src]
Returns if the move has an incorrect flag inside, and therefore is invalid.
pub const fn flag(self) -> u16
[src]
Returns the 4 bit flag of the BitMove
.
pub const fn is_okay(self) -> bool
[src]
Returns if the move is within bounds, ala the to and from squares are not equal.
pub const fn from_to(self) -> u16
[src]
Returns only from "from" and "to" squares of the move.
Trait Implementations
impl Eq for BitMove
[src]
impl Copy for BitMove
[src]
impl Clone for BitMove
[src]
fn clone(&self) -> BitMove
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<BitMove> for BitMove
[src]
impl Display for BitMove
[src]
impl Debug for BitMove
[src]
impl FromIterator<BitMove> for MoveList
[src]
fn from_iter<T: IntoIterator<Item = BitMove>>(iter: T) -> Self
[src]
impl FromIterator<BitMove> for ScoringMoveList
[src]
fn from_iter<T: IntoIterator<Item = BitMove>>(iter: T) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,