pub struct Scorecard { /* private fields */ }Expand description
One player’s card: every box value plus the Yahtzee-bonus count.
This is the record a paper card would hold. Legality and valuation
are delegated to State, so the card and the solver can never
disagree on the rules.
Implementations§
Source§impl Scorecard
impl Scorecard
Sourcepub const fn get(self, category: Category) -> Option<u8>
pub const fn get(self, category: Category) -> Option<u8>
The value written in category, or None while open.
Sourcepub fn upper_subtotal(self) -> u8
pub fn upper_subtotal(self) -> u8
The upper-section subtotal, uncapped (at most 105).
Sourcepub fn upper_bonus(self) -> u8
pub fn upper_bonus(self) -> u8
The upper-section bonus: 35 once the subtotal reaches 63.
Sourcepub const fn yahtzee_bonuses(self) -> u8
pub const fn yahtzee_bonuses(self) -> u8
How many 100-point Yahtzee bonuses have been earned.
Sourcepub fn legal_categories(self, dice: Dice) -> Categories
pub fn legal_categories(self, dice: Dice) -> Categories
The categories dice may legally be scored in; see
State::legal_categories.
Sourcepub fn score(
&mut self,
category: Category,
dice: Dice,
) -> Result<ScoreDelta, GameError>
pub fn score( &mut self, category: Category, dice: Dice, ) -> Result<ScoreDelta, GameError>
Writes dice into category, updating bonuses.
§Errors
GameError::IllegalCategory if the box is filled or the joker
rule forces a different one; the card is left unchanged.
Trait Implementations§
impl Copy for Scorecard
impl Eq for Scorecard
impl StructuralPartialEq for Scorecard
Auto Trait Implementations§
impl Freeze for Scorecard
impl RefUnwindSafe for Scorecard
impl Send for Scorecard
impl Sync for Scorecard
impl Unpin for Scorecard
impl UnsafeUnpin for Scorecard
impl UnwindSafe for Scorecard
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