Struct t4t::History

source ·
pub struct History<G: Game<P>, const P: usize> { /* private fields */ }
Expand description

For repeated games, a history of previously played games.

Implementations§

source§

impl<G: Game<P>, const P: usize> History<G, P>

source

pub fn empty() -> Self

Construct a new, empty history.

source

pub fn add(&mut self, outcome: G::Outcome) -> &G::Outcome

Update the history by adding a new game outcome. Returns a reference to the newly added outcome.

source

pub fn outcomes(&self) -> Past<'_, &G::Outcome>

Get an iterator over the outcomes of previously played games.

source

pub fn records( &self, ) -> Past<'_, &<G::Outcome as Outcome<G::Move, G::Utility, P>>::Record>

Get an iterator over the move records of previously played games.

source

pub fn payoffs(&self) -> Past<'_, &Payoff<G::Utility, P>>

Get an iterator over the payoffs of previously played games.

source

pub fn score(&self) -> &Payoff<G::Utility, P>

Get the cumulative score of all previously played games.

source§

impl<M, U, G, const P: usize> History<G, P>
where M: Move, U: Utility, G: Game<P, Move = M, Utility = U, Outcome = SimultaneousOutcome<M, U, P>>,

source

pub fn profiles(&self) -> Past<'_, &Profile<G::Move, P>>

Get an iterator over the profiles of previously played games.

source

pub fn moves_for_player(&self, player: PlayerIndex<P>) -> Past<'_, G::Move>

Get an iterator over all moves played by a given player.

source§

impl<M, U, G, const P: usize> History<G, P>
where M: Move, U: Utility, G: Game<P, Move = M, Utility = U, Outcome = SequentialOutcome<M, U, P>>,

source

pub fn transcripts(&self) -> Past<'_, &Transcript<G::Move, P>>

Get an iterator over the transcripts of previously played games.

Trait Implementations§

source§

impl<G: Game<P>, const P: usize> Clone for History<G, P>

source§

fn clone(&self) -> Self

Returns a copy 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<G: Game<P>, const P: usize> Debug for History<G, P>

source§

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

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

impl<G: Game<P>, const P: usize> Default for History<G, P>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<G: Game<P>, const P: usize> Hash for History<G, P>
where G::Outcome: Hash, G::Utility: Hash,

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<G: Game<P>, const P: usize> Outcome<<G as Game<P>>::Move, <G as Game<P>>::Utility, P> for History<G, P>

§

type Record = History<G, P>

A type for capturing the record of moves that produced (or would produce) this outcome. Read more
source§

fn record(&self) -> &Self

A record of the moves that produced this outcome.
source§

fn payoff(&self) -> &Payoff<G::Utility, P>

The payoff associated with this outcome.
source§

impl<G: Game<P>, const P: usize> PartialEq for History<G, P>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<G: Game<P>, const P: usize> Record<<G as Game<P>>::Move, P> for History<G, P>

source§

fn plies(&self) -> Plies<'_, G::Move, P>

An iterator over the played moves in this record. Read more
source§

fn summary(&self) -> Summary<P>

A summary of the number of moves in this record.
source§

fn to_transcript(&self) -> Transcript<M, P>

Get the moves played in the form of a transcript.
source§

fn played_moves_by_chance(&self) -> PlayedMoves<'_, M>

An iterator over all moves by chance.
source§

fn played_moves_by_player(&self, player: PlayerIndex<P>) -> PlayedMoves<'_, M>

An iterator over all moves by a particular player.
source§

fn played_moves_per_player(&self) -> PerPlayer<PlayedMoves<'_, M>, P>

Iterators over the moves by each player.

Auto Trait Implementations§

§

impl<G, const P: usize> Freeze for History<G, P>
where <G as Game<P>>::Utility: Freeze,

§

impl<G, const P: usize> RefUnwindSafe for History<G, P>
where <G as Game<P>>::Utility: RefUnwindSafe, <G as Game<P>>::Outcome: RefUnwindSafe,

§

impl<G, const P: usize> Send for History<G, P>

§

impl<G, const P: usize> Sync for History<G, P>

§

impl<G, const P: usize> Unpin for History<G, P>
where <G as Game<P>>::Utility: Unpin, <G as Game<P>>::Outcome: Unpin,

§

impl<G, const P: usize> UnwindSafe for History<G, P>
where <G as Game<P>>::Outcome: UnwindSafe, <G as Game<P>>::Utility: UnwindSafe,

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

source§

impl<T> State for T
where T: Clone + Debug + PartialEq + Send + Sync + 'static,