pub struct Pieces { /* private fields */ }
Expand description
Implementations§
Source§impl Pieces
impl Pieces
Sourcepub fn standard_board() -> Self
pub fn standard_board() -> Self
Create a board with standard piece positions.
Sourcepub fn chess960_board(idx_ordering: impl FnOnce() -> [usize; 8]) -> Self
pub fn chess960_board(idx_ordering: impl FnOnce() -> [usize; 8]) -> Self
Create a board with a randomized back row.
This is known as the 960, or Fischer, variant setup.
Sourcepub fn get_piece(&self, x: f32, y: f32) -> Option<usize>
pub fn get_piece(&self, x: f32, y: f32) -> Option<usize>
Get a piece’s index within inner, if it exists.
pub fn get(&self, index: usize) -> Option<&Piece>
pub fn get_mut(&mut self, index: usize) -> Option<&mut Piece>
pub fn inner_ref(&self) -> &[Piece]
pub fn inner_mut(&mut self) -> &mut Vec<Piece>
Sourcepub fn travel(&mut self, idx: usize, x: f32, y: f32) -> usize
pub fn travel(&mut self, idx: usize, x: f32, y: f32) -> usize
Move the piece at idx to x, y.
§Warnings
This may shuffle piece indices! Returns the piece’s new index.
pub fn travelable( &self, piece: &Piece, x: f32, y: f32, kind: TravelKind, ) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pieces
impl RefUnwindSafe for Pieces
impl Send for Pieces
impl Sync for Pieces
impl Unpin for Pieces
impl UnwindSafe for Pieces
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