Enum chess_engine::Move [−][src]
Expand description
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
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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
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
impl RefUnwindSafe for Move
impl UnwindSafe for Move
Blanket Implementations
Mutably borrows from an owned value. Read more