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 other hands and the pre-exchange passes are structurally
unreachable.
Implementations§
Source§impl<'a> View<'a>
impl<'a> View<'a>
Sourcepub const fn game_scores(&self) -> [u16; 4]
pub const fn game_scores(&self) -> [u16; 4]
The running game totals, clockwise from this seat:
[mine, my left, across, my right]
Note the order: seat-relative, unlike Table::scores, which is
indexed by Seat. All totals sit on the scoreboard in plain
sight, so they are part of the legal whitelist. [0; 4] for a
standalone round played outside a Game; the losing
threshold is rules().game_target.
Sourcepub const fn direction(&self) -> PassDirection
pub const fn direction(&self) -> PassDirection
The pass direction of the round
Sourcepub const fn current_trick(&self) -> Option<Trick>
pub const fn current_trick(&self) -> Option<Trick>
The trick in progress; Some exactly during Phase::Playing
Sourcepub fn hearts_broken(&self) -> bool
pub fn hearts_broken(&self) -> bool
Whether a heart has been played, allowing hearts to be led
Sourcepub fn legal_plays(&self) -> Hand
pub fn legal_plays(&self) -> Hand
The cards this seat may legally play right now
Empty when it is not this seat’s turn.
Sourcepub fn points_taken(&self, seat: Seat) -> u8
pub fn points_taken(&self, seat: Seat) -> u8
The penalty points seat has taken so far — public bookkeeping
Sourcepub const fn hand_len(&self, seat: Seat) -> usize
pub const fn hand_len(&self, seat: Seat) -> usize
How many cards seat holds — public arithmetic
Sourcepub const fn passed(&self) -> Option<Hand>
pub const fn passed(&self) -> Option<Hand>
The three cards this seat chose to pass, or None if it has not
passed (always None on a hold deal)
Sourcepub fn received(&self) -> Option<Hand>
pub fn received(&self) -> Option<Hand>
The three cards this seat received in the exchange
None until the exchange happens and on hold deals — a seat never
sees incoming cards while passing is still open.
Sourcepub const fn is_void(&self, seat: Seat, suit: Suit) -> bool
pub const fn is_void(&self, seat: Seat, suit: Suit) -> bool
Whether seat is known to be void in suit
Void inference is common knowledge: everyone sees a seat fail to
follow. The table is sound, not complete — it records only voids
shown in play, so it lags a seat’s real hand (including this seat’s
own; check hand()[suit].is_empty() for that).
Sourcepub fn known_cards(&self, seat: Seat) -> Hand
pub fn known_cards(&self, seat: Seat) -> Hand
The unplayed cards this seat knows seat holds: the passed cards
still in the receiver’s hand
Empty for every seat other than this seat’s receiver, and before the exchange.
Sourcepub fn unseen(&self) -> Hand
pub fn unseen(&self) -> Hand
The cards this seat cannot locate: the whole deck minus its own hand, everything played, and its own passed cards
Exactly the cards a determinizing bot must distribute among the
other hands. Once play begins, unseen().len() equals the other
hands’ total minus the cards known_cards
already places. During the passing phase the identity is offset by
passes in flight — a seat that has passed holds 10 cards while its
3 hidden passes stay unseen — so a pass-time determinizer should
sample 13-card pre-pass hands instead.
Sourcepub fn possible_cards(&self, seat: Seat) -> Hand
pub fn possible_cards(&self, seat: Seat) -> Hand
The cards seat may hold, as far as this seat can tell
This seat’s own hand for itself; otherwise the unseen cards outside
seat’s known voids, plus the known_cards.
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