Struct chess_engine::Position [−][src]
pub struct Position { /* fields omitted */ }
Implementations
Return the starting position for a given color’s king.
Return the starting position for a given color’s queen.
Create a Position
from its respective row or column number.
The row and column numbers can be any of 0, 1, 2, 3, 4, 5, 6, or 7.
Examples:
A1 = Position::new(0, 0)
A8 = Position::new(7, 0)
H1 = Position::new(0, 7)
H8 = Position::new(7, 7)
Parse a position from PGN. This simply just supports positions like
e4
and D8
.
Is this position a valid spot on the board?
Is this position NOT a valid spot on the board?
Get the row number of the position. This can be any of 0, 1, 2, 3, 4, 5, 6, or 7.
Is this position diagonal to another position?
Is this position orthogonal to another position?
Is this position adjacent to another position?
Adjacent positions have either:
- A diagonal distance of one from each other
- An orthogonal distance of one from each other
Is this position beneath another position on the board? Pieces “beneath” other pieces on the board have lower ranks.
So, for example, A7 is below A8.
Is this position above another position on the board? Pieces “above” other pieces on the board have higher ranks.
So, for example, A8 is above A8.
Is this position left of another position on the board? Pieces “left of” other pieces on the board have a lower lexigraphical column character.
So, for example, A8 is left of B8.
Is this position right of another position on the board? Pieces “right of” other pieces on the board have a higher lexigraphical column character.
So, for example, B8 is right of A8.
Get the position directly below this position.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Get the position directly above this position.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Get the next square upwards from a respective player’s pawn.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Get the next square backwards from a respective player’s pawn.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Get the position directly left of this position.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Get the position directly right of this position.
IMPORTANT NOTE: This will NOT check for positions
off of the board! You could easily get an invalid
position if you do not check with the is_on_board
method!
Is this pawn on the starting rank for the respective player?
Is this the starting position of the kingside rook?
Is this the starting position of the queenside rook?
Get the list of positions from this position to another position, moving diagonally.
This does not include the from
position, and includes the to
position.
Get the list of positions from this position to another position, moving orthogonally.
This does not include the from
position, and includes the to
position.
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
Auto Trait Implementations
impl RefUnwindSafe for Position
impl UnwindSafe for Position
Blanket Implementations
Mutably borrows from an owned value. Read more