pub struct View<'a> { /* private fields */ }Expand description
What one seat may legally see of a round
The wrapped Round is private, and these accessors are the whitelist:
the opponent’s hand and the stock order are structurally unreachable.
Implementations§
Source§impl<'a> View<'a>
impl<'a> View<'a>
Sourcepub const fn game_scores(&self) -> [u16; 2]
pub const fn game_scores(&self) -> [u16; 2]
The running game totals, this seat’s first: [mine, theirs]
Note the order: seat-relative, unlike Table::scores, which is
indexed by Player. Both totals sit on the scoreboard in plain
sight, so they are part of the legal whitelist. [0, 0] for a
standalone round played outside a Game; the
target to win is
rules().game_target.
Sourcepub const fn knock_limit(&self) -> u8
pub const fn knock_limit(&self) -> u8
The knock limit in effect
Sourcepub fn discard_pile(&self) -> &'a [Card]
pub fn discard_pile(&self) -> &'a [Card]
The discard pile, oldest first — the last card is the top
Sourcepub fn stock_len(&self) -> usize
pub fn stock_len(&self) -> usize
How many cards remain in the stock — the order is never visible
Sourcepub fn spread(&self) -> impl Iterator<Item = Meld> + 'a
pub fn spread(&self) -> impl Iterator<Item = Meld> + 'a
The knocker’s spread, extended by any layoffs so far
Empty before a knock. Enumeration order gives the meld indices that
Layoff::meld addresses.
Sourcepub const fn taken_discard(&self) -> Option<Card>
pub const fn taken_discard(&self) -> Option<Card>
The card this seat took from the pile this turn, which may not be shed until the next turn
Sourcepub const fn can_take_discard(&self) -> bool
pub const fn can_take_discard(&self) -> bool
Whether taking the top of the discard pile is available
True at the upcard offer and on a normal draw, false on the forced stock draw after both players pass the upcard.
Sourcepub const fn opponent_known(&self) -> Hand
pub const fn opponent_known(&self) -> Hand
Cards known to be in the opponent’s hand: taken from the pile and not yet shed or laid off
Sourcepub const fn opponent_shed(&self) -> Hand
pub const fn opponent_shed(&self) -> Hand
Every card the opponent has discarded, whether or not it is still in the pile
Sourcepub const fn opponent_passed(&self) -> Hand
pub const fn opponent_passed(&self) -> Hand
Upcards the opponent declined during the upcard phase
Sourcepub const fn opponent_hand_len(&self) -> usize
pub const fn opponent_hand_len(&self) -> usize
How many cards the opponent holds — 10, or 11 mid-turn
Sourcepub fn unseen(&self) -> Hand
pub fn unseen(&self) -> Hand
The cards this seat cannot locate: the whole deck minus its own hand, the discard pile, the opponent’s known cards, and the spread
Exactly the cards a determinizing bot must distribute between the
stock and the hidden part of the opponent’s hand. Until a knock
reveals the spread,
unseen().len() == stock_len() + opponent_hand_len() - opponent_known().len(); afterwards the spread also counts as seen.
Sourcepub fn best_melds(&self) -> Melds
pub fn best_melds(&self) -> Melds
A deadwood-minimizing arrangement of this seat’s hand
Auto Trait Implementations§
impl<'a> Freeze for View<'a>
impl<'a> RefUnwindSafe for View<'a>
impl<'a> Send for View<'a>
impl<'a> Sync for View<'a>
impl<'a> Unpin for View<'a>
impl<'a> UnsafeUnpin for View<'a>
impl<'a> UnwindSafe for View<'a>
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
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>
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>
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