pub struct Chess { /* private fields */ }Expand description
A Standard Chess game.
TODO: Add a timer for each player.
Implementations
sourceimpl 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
sourceimpl PartialEq<Chess> for Chess
impl PartialEq<Chess> for Chess
impl Eq for Chess
impl StructuralEq for Chess
impl StructuralPartialEq for Chess
Auto Trait Implementations
impl RefUnwindSafe for Chess
impl Send for Chess
impl Sync for Chess
impl Unpin for Chess
impl UnwindSafe for Chess
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more