pub struct Chess { /* private fields */ }Expand description
A Standard Chess game.
TODO: Add a timer for each player.
Implementations§
Source§impl Chess
impl Chess
Sourcepub fn history(&self) -> Vec<String>
pub fn history(&self) -> Vec<String>
Get the history of the game.
The Vec contains a FEN-string.
Sourcepub fn play(&mut self, from: Square, to: Square)
pub fn play(&mut self, from: Square, to: Square)
Base function to call when a user click on the screen.
Sourcepub fn offer_draw(&mut self)
pub fn offer_draw(&mut self)
The current player offer a draw.
The offer is cancel when the player play.
Sourcepub fn accept_draw(&mut self)
pub fn accept_draw(&mut self)
Accept the draw. Assumes that a draw is offered.
Sourcepub fn can_declare_draw(&self) -> bool
pub fn can_declare_draw(&self) -> bool
Verify if a player can legally declare a draw by 3-fold repetition or 50-move rule.
Sourcepub fn declare_draw(&mut self)
pub fn declare_draw(&mut self)
Declare a draw by 3-fold repetition or 50-move rule. Assumes that a draw can be declare.
Trait Implementations§
impl Eq for Chess
impl StructuralPartialEq for Chess
Auto Trait Implementations§
impl Freeze for Chess
impl RefUnwindSafe for Chess
impl Send for Chess
impl Sync for Chess
impl Unpin for Chess
impl UnwindSafe for Chess
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more