Skip to main content

View

Struct View 

Source
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>

Source

pub const fn seat(&self) -> Seat

The seat this view belongs to

Source

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.

Source

pub const fn rules(&self) -> &'a Rules

The rules of the round

Source

pub const fn direction(&self) -> PassDirection

The pass direction of the round

Source

pub const fn phase(&self) -> Phase

The current phase of the round

Source

pub const fn hand(&self) -> Hand

This seat’s hand

Source

pub fn turn(&self) -> Option<Seat>

The seat to play, or None outside the playing phase

Source

pub const fn current_trick(&self) -> Option<Trick>

The trick in progress; Some exactly during Phase::Playing

Source

pub fn tricks(&self) -> &'a [Trick]

The completed tricks in play order

Source

pub fn played(&self) -> Hand

Every card played so far, including the trick in progress

Source

pub fn hearts_broken(&self) -> bool

Whether a heart has been played, allowing hearts to be led

Source

pub fn legal_plays(&self) -> Hand

The cards this seat may legally play right now

Empty when it is not this seat’s turn.

Source

pub fn points_taken(&self, seat: Seat) -> u8

The penalty points seat has taken so far — public bookkeeping

Source

pub const fn hand_len(&self, seat: Seat) -> usize

How many cards seat holds — public arithmetic

Source

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)

Source

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.

Source

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).

Source

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.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.