Struct History

Source
pub struct History<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> { /* private fields */ }
Expand description

For repeated games, a history of previously played games.

Implementations§

Source§

impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> History<M, U, O, P>

Source

pub fn empty() -> Self

Construct a new, empty history.

Source

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

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

Source

pub fn outcomes(&self) -> Past<'_, &O>

Get an iterator over the outcomes of previously played games.

Source

pub fn records(&self) -> Past<'_, &<O as Outcome<M, U, P>>::Record>

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

Source

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

Get an iterator over the payoffs of previously played games.

Source

pub fn score(&self) -> &Payoff<U, P>

Get the cumulative score of all previously played games.

Source§

impl<M: Move, U: Utility, const P: usize> History<M, U, SimultaneousOutcome<M, U, P>, P>

Source

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

Get an iterator over the profiles of previously played games.

Source

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

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

Source§

impl<S: State, M: Move, U: Utility, const P: usize> History<M, U, SequentialOutcome<S, M, U, P>, P>

Source

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

Get an iterator over the transcripts of previously played games.

Trait Implementations§

Source§

impl<M: Clone + Move, U: Clone + Utility, O: Clone + Outcome<M, U, P>, const P: usize> Clone for History<M, U, O, P>

Source§

fn clone(&self) -> History<M, U, O, P>

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<M: Debug + Move, U: Debug + Utility, O: Debug + Outcome<M, U, P>, const P: usize> Debug for History<M, U, O, P>

Source§

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

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

impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Default for History<M, U, O, P>

Source§

fn default() -> Self

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

impl<M: Hash + Move, U: Hash + Utility, O: Hash + Outcome<M, U, P>, const P: usize> Hash for History<M, U, O, P>

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<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Outcome<M, U, P> for History<M, U, O, P>

Source§

type Record = History<M, U, O, 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<U, P>

The payoff associated with this outcome.
Source§

impl<M: PartialEq + Move, U: PartialEq + Utility, O: PartialEq + Outcome<M, U, P>, const P: usize> PartialEq for History<M, U, O, P>

Source§

fn eq(&self, other: &History<M, U, O, P>) -> 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<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Record<M, P> for History<M, U, O, P>

Source§

fn plies(&self) -> Plies<'_, M, 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.
Source§

impl<M: Eq + Move, U: Eq + Utility, O: Eq + Outcome<M, U, P>, const P: usize> Eq for History<M, U, O, P>

Source§

impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> StructuralPartialEq for History<M, U, O, P>

Auto Trait Implementations§

§

impl<M, U, O, const P: usize> Freeze for History<M, U, O, P>
where U: Freeze,

§

impl<M, U, O, const P: usize> RefUnwindSafe for History<M, U, O, P>

§

impl<M, U, O, const P: usize> Send for History<M, U, O, P>

§

impl<M, U, O, const P: usize> Sync for History<M, U, O, P>

§

impl<M, U, O, const P: usize> Unpin for History<M, U, O, P>
where M: Unpin, U: Unpin, O: Unpin,

§

impl<M, U, O, const P: usize> UnwindSafe for History<M, U, O, P>

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<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.
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> Same for T

Source§

type Output = T

Should always be Self
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, 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

Source§

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