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_margin(&self) -> i32
pub const fn game_margin(&self) -> i32
This seat’s lead in the game score: its running total minus the opponent’s, in points
Positive when ahead in the game, negative when behind. Always zero
for a standalone round played outside a Game,
which has no scoreboard. The game score is public — both players
see it — so it is part of the legal whitelist. The target to win
is rules().game_target.
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