pub struct Board { /* private fields */ }Expand description
A struct that represents a chess board The board is represented by bitboards of each piece (color and type)
Implementations§
Source§impl Board
impl Board
Sourcepub fn is_ocupied(&self, pos: &Position) -> bool
pub fn is_ocupied(&self, pos: &Position) -> bool
Sourcepub fn set_piece(
&mut self,
piece: Piece,
pos: &Position,
) -> Result<(), PositionOccupiedError>
pub fn set_piece( &mut self, piece: Piece, pos: &Position, ) -> Result<(), PositionOccupiedError>
Sourcepub fn delete_piece(
&mut self,
pos: &Position,
) -> Result<Piece, PositionEmptyError>
pub fn delete_piece( &mut self, pos: &Position, ) -> Result<Piece, PositionEmptyError>
Sourcepub fn move_piece(
&mut self,
from: &Position,
to: &Position,
) -> Result<(), PositionEmptyError>
pub fn move_piece( &mut self, from: &Position, to: &Position, ) -> Result<(), PositionEmptyError>
Sourcepub fn is_attacked(&self, pos: Position, color: Color) -> bool
pub fn is_attacked(&self, pos: Position, color: Color) -> bool
Sourcepub fn can_move(
&self,
start_pos: &Position,
end_pos: &Position,
) -> Result<bool, PositionEmptyError>
pub fn can_move( &self, start_pos: &Position, end_pos: &Position, ) -> Result<bool, PositionEmptyError>
Sourcepub fn is_attacking(
&self,
start_pos: &Position,
end_pos: &Position,
) -> Result<bool, PositionEmptyError>
pub fn is_attacking( &self, start_pos: &Position, end_pos: &Position, ) -> Result<bool, PositionEmptyError>
Checks if a piece of a postion is attacking a position The function does not check if the move is legal It only checks if the piece is attacking the position according to its movement rules
§Arguments
start_pos: The position of the piece to moveend_pos: The position of the piece to capture
§Returns
Ok(bool): Whether the piece is attacking the positionErr(PositionEmptyError): If the start position is empty
Sourcepub fn piece_between(
&self,
from: &Position,
to: &Position,
) -> Result<bool, PositionBetweenError>
pub fn piece_between( &self, from: &Position, to: &Position, ) -> Result<bool, PositionBetweenError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Board
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnsafeUnpin for Board
impl UnwindSafe for Board
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more