Skip to main content

Partial

Struct Partial 

Source
pub struct Partial { /* private fields */ }
Expand description

Perfect-recall game history from a single player’s perspective.

While Game is memoryless, Partial tracks the complete action sequence from the start of a hand. This is the primary type for inference time: hero knows their own cards but not the opponent’s.

§Information Boundary

TypePerspectiveUsed For
PartialHero only (own cards)Inference, UI, opponent iteration
PerfectGod’s view (both hands)Training CFR traversal

§Key Operations

  • NlheInfo::from((&partial, abstraction)) for strategy lookup
  • Perfect::from((&partial, hole)) for opponent modeling
  • partial.histories() → iterate all possible opponent hands

§Structure

  • pov — Which player’s perspective we’re tracking
  • actions — Action sequence excluding blinds (bets, draws)
  • reveals — The card arrangement for this hand (hero’s observation)

§Invariants

Assumes default stacks (100bb) and P0 on button. Blinds are constant and handled by root() returning a POST-blind state.

Implementations§

Source§

impl Partial

Source

pub fn initial(pov: Turn) -> Self

Creates a recall at the start of a hand (blinds posted, no decisions).

Source

pub fn with_pov(&self, pov: Turn) -> Self

Returns a new recall with the given perspective.

Source§

impl Partial

Strategy lookup methods.

Source

pub fn betting_edges(&self) -> Vec<Edge>

Returns all betting edges (Open or Raise) available at the current state.

Source

pub fn histories(&self) -> Vec<(Observation, Perfect)>

Iterates over all possible opponent hands.

For each opponent observation, yields a complete-information Perfect that can compute exact reach probabilities. Since Partial has partial information (only hero’s cards), this method enumerates the unknown opponent hands.

Source§

impl Partial

Source

pub fn try_build( pov: Turn, seen: Observation, actions: Vec<Action>, ) -> Result<Self>

Fallible constructor from (POV, observation, actions).

Returns Err if any action in the sequence is illegal, enabling graceful error handling for untrusted input. The actions parameter should NOT include blinds.

Source§

impl Partial

State reconstruction methods.

Source

pub fn base(&self) -> Game

Returns the initial game state (before blinds, with hero’s hole cards).

Source

pub fn street(&self) -> Street

The current betting street.

Source

pub fn dealt(&self) -> Street

The street based on Draw actions in the action sequence.

Source

pub fn turn(&self) -> Turn

The player perspective for this recall.

Source

pub fn arr(&self) -> Arrangement

The card arrangement for this recall.

Source

pub fn seen(&self) -> Observation

The observation (hole cards + board) for this recall.

Source

pub fn reset(&self) -> Self

Resets to initial state (no decisions), preserving POV and cards.

Source

pub fn cursor(&self) -> NodeIndex

Node index for graph traversal.

Source

pub fn plays(&self) -> Vec<(Position, Action, Street)>

Returns (position, action, street) for each action in the sequence.

Source

pub fn aggressor(&self) -> Option<Position>

Finds the last aggressor on the final betting street. Returns None if no aggressive action was taken (all checks/calls).

Source

pub fn truncate(&self, street: Street) -> Self

Truncates actions to a specific street.

Source

pub fn replace(&self, reveals: Arrangement) -> Self

Swaps the card arrangement, updating draw actions to match.

Source

pub fn decisions(&self, street: Street) -> Vec<Action>

Player decisions (non-draw) for a specific street.

Source

pub fn board(&self) -> Vec<Card>

Community cards dealt so far (in deal order).

Source

pub fn revealed(&self, street: Street) -> Vec<Card>

Cards revealed on a specific street.

Source

pub fn isomorphism(&self) -> Isomorphism

The canonical form of the observation.

Source

pub fn empty(&self) -> bool

True if no decisions have been made.

Source

pub fn aligned(&self) -> bool

True if observation’s public cards match the dealt draw actions.

Source§

impl Partial

Action modification methods.

Source

pub fn undo(&self) -> Self

Removes the most recent action and any trailing draws.

Source

pub fn push(&self, action: Action) -> Self

Adds an action, auto-inserting draw actions when needed.

Source

pub fn try_push(&self, action: Action) -> Result<Self>

Fallible version of push.

Returns Err if the action is not legal in the current state, enabling graceful error handling instead of panicking.

Source§

impl Partial

Validation.

Source

pub fn validate(self) -> Result<Self>

Validates alignment and playability, returning error if invalid.

Source§

impl Partial

State predicates.

Source

pub fn can_play(&self) -> bool

True if it’s hero’s turn and observation is current.

Source

pub fn can_push(&self, action: &Action) -> bool

True if the action is legal in the current state.

Source

pub fn can_undo(&self) -> bool

True if there are actions to undo.

Trait Implementations§

Source§

impl Arbitrary for Partial

Source§

fn random() -> Self

Generate a uniformly random instance.
Source§

impl Clone for Partial

Source§

fn clone(&self) -> Partial

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Partial

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Partial

Display shows a compact visual representation of the game history Format: table with cards from arrangement (preserving deal order) and actions in a fixed-width grid layout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<(Turn, Arrangement)> for Partial

Constructs recall from a POV and arrangement (no decisions yet).

Source§

fn from((pov, reveals): (Turn, Arrangement)) -> Self

Converts to this type from the input type.
Source§

impl From<(Turn, Observation, Vec<Action>)> for Partial

Source§

fn from((pov, seen, actions): (Turn, Observation, Vec<Action>)) -> Self

Converts to this type from the input type.
Source§

impl From<Street> for Partial

random non-folding actions lead to this street

Source§

fn from(_: Street) -> Self

Converts to this type from the input type.
Source§

impl Hash for Partial

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Partial

Source§

fn eq(&self, other: &Partial) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Recall for Partial

Source§

fn root(&self) -> Game

The starting game state for replaying actions (POST-blind).
Source§

fn actions(&self) -> &[Action]

The action sequence from root to current state (excludes blinds).
Source§

fn complete(&self) -> Vec<Action>

Complete action sequence including blinds (for client display).
Source§

fn head(&self) -> Game

Current game state (replay actions from root).
Source§

fn states(&self) -> Vec<Game>

Sequence of game states from root to head.
Source§

fn aggression(&self) -> usize

Current aggression (trailing aggressive actions on current street).
Source§

fn history(&self) -> Vec<Edge>

Full edge history (all streets).
Source§

fn subgame(&self) -> Path

Current street edges only (trailing choice edges before any Draw).
Source§

fn choices(&self) -> Path

Available actions at current state.
Source§

impl Eq for Partial

Source§

impl StructuralPartialEq for Partial

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V