Struct backgammon::Game
source · pub struct Game {
pub rules: Rules,
pub dices: Dices,
pub who_plays: Player,
pub board: Board,
pub cube: Cube,
/* private fields */
}
Expand description
Represents a Backgammon game
Fields§
§rules: Rules
rules of the game
dices: Dices
last dice pair rolled
who_plays: Player
whose turn is it?
board: Board
board for player 0 and 1
cube: Cube
cube value and owner
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Game
impl<'de> Deserialize<'de> for Game
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl GameRules for Game
impl GameRules for Game
Implements SetRules for Game
source§fn with_beaver(self) -> Self
fn with_beaver(self) -> Self
When offered the cube, allow to re-double but keep it
source§fn with_raccoon(self) -> Self
fn with_raccoon(self) -> Self
If a player plays “beaver”, the other may double again, letting the opponent keep the cube
source§fn with_murphy(self, limit: u8) -> Self
fn with_murphy(self, limit: u8) -> Self
If both players roll the same opening number, the dice is doubled, remaining in the middle
of the board
source§fn with_jacoby(self) -> Self
fn with_jacoby(self) -> Self
Gammon and Backgammon only count for double or triple values if the cube has already been
offered
source§fn with_holland(self) -> Self
fn with_holland(self) -> Self
Permits to double after Crawford game only if both players have rolled at least twice
Auto Trait Implementations§
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
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