[−][src]Enum chess_engine::Move
A move that can be applied to a board. When applied to a board, the board assumes that the move is being applied for the current turn's player.
Variants
If the current player is white, move the king to the C1 square, and the kingside rook to the D1 square. If the current player is black, however, move the king to the C8 square, and the kingside rook to the D8 square.
Castling can only be performed if
- The king has not moved at all since the game began
- The respective rook (kingside or queenside) has also not moved
- The square adjacent to the king on the respective side is not threatened by an enemy piece
If all of these conditions are satisfied, castling is a legal move
If the current player is white, move the king to the G1 square, and the kingside rook to the F1 square. If the current player is black, however, move the king to the G8 square, and the kingside rook to the F8 square.
Move a piece from one square to another. This can allow the player to capture another piece, by simply moving a piece to the position of an enemy piece.
Additionally, this can be used to en-passant capture, even though the en-passant square itself does not contain any capturable pieces.
En-passant captures MUST be performed with a pawn, upon an enemy pawn that has just surpassed it by move two squares. An en-passant capture must also be performed the turn immediately after the enemy pawn surpasses the allied pawn. After the one turn a player has to en-passant capture, the en-passant square is forgotten and can no longer be used.
When played by another player, it awards victory to the other.
Implementations
impl Move[src]
pub fn parse(repr: String) -> Result<Self, String>[src]
Try to parse a Move from a string.
Possible valid formats include:
"resign""resigns""castle queenside""O-O-O"(correct notation)"o-o-o"(incorrect notation, but will accept)"0-0-0"(incorrect notation, but will accept)"castle kingside""O-O"(correct notation)"o-o"(incorrect notation, but will accept)"0-0"(incorrect notation, but will accept)"e2e4""e2 e4""e2 to e4"
Parsing a move such as "knight to e4" or "Qxe4" will NOT work.
Trait Implementations
impl Clone for Move[src]
fn clone(&self) -> Move[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for Move[src]
impl Debug for Move[src]
impl Display for Move[src]
impl Eq for Move[src]
impl Ord for Move[src]
fn cmp(&self, other: &Move) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<Move> for Move[src]
impl PartialOrd<Move> for Move[src]
fn partial_cmp(&self, other: &Move) -> Option<Ordering>[src]
fn lt(&self, other: &Move) -> bool[src]
fn le(&self, other: &Move) -> bool[src]
fn gt(&self, other: &Move) -> bool[src]
fn ge(&self, other: &Move) -> bool[src]
impl StructuralEq for Move[src]
impl StructuralPartialEq for Move[src]
impl TryFrom<String> for Move[src]
Try to parse a Move from a string.
Possible valid formats include:
"resign""resigns""castle queenside""O-O-O"(correct notation)"o-o-o"(incorrect notation, but will accept)"0-0-0"(incorrect notation, but will accept)"castle kingside""O-O"(correct notation)"o-o"(incorrect notation, but will accept)"0-0"(incorrect notation, but will accept)"e2e4""e2 e4""e2 to e4"
Parsing a move such as "knight to e4" or "Qxe4" will NOT work.
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,