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>
impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> History<M, U, O, P>
Sourcepub fn add(&mut self, outcome: O) -> &O
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.
Sourcepub fn outcomes(&self) -> Past<'_, &O> ⓘ
pub fn outcomes(&self) -> Past<'_, &O> ⓘ
Get an iterator over the outcomes of previously played games.
Sourcepub fn records(&self) -> Past<'_, &<O as Outcome<M, U, P>>::Record> ⓘ
pub fn records(&self) -> Past<'_, &<O as Outcome<M, U, P>>::Record> ⓘ
Get an iterator over the move records of previously played games.
Source§impl<M: Move, U: Utility, const P: usize> History<M, U, SimultaneousOutcome<M, U, P>, P>
impl<M: Move, U: Utility, const P: usize> History<M, U, SimultaneousOutcome<M, U, P>, P>
Sourcepub fn profiles(&self) -> Past<'_, &Profile<M, P>> ⓘ
pub fn profiles(&self) -> Past<'_, &Profile<M, P>> ⓘ
Get an iterator over the profiles of previously played games.
Sourcepub fn moves_for_player(&self, player: PlayerIndex<P>) -> Past<'_, M> ⓘ
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>
impl<S: State, M: Move, U: Utility, const P: usize> History<M, U, SequentialOutcome<S, M, U, P>, P>
Sourcepub fn transcripts(&self) -> Past<'_, &Transcript<M, P>> ⓘ
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>
impl<M: Clone + Move, U: Clone + Utility, O: Clone + Outcome<M, U, P>, const P: usize> Clone for History<M, U, O, P>
Source§impl<M: Debug + Move, U: Debug + Utility, O: Debug + Outcome<M, U, P>, const P: usize> Debug for History<M, U, O, P>
impl<M: Debug + Move, U: Debug + Utility, O: Debug + Outcome<M, U, P>, const P: usize> Debug for History<M, U, O, P>
Source§impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Default for History<M, U, O, P>
impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Default for History<M, U, O, P>
Source§impl<M: Hash + Move, U: Hash + Utility, O: Hash + Outcome<M, U, P>, const P: usize> Hash for History<M, U, O, P>
impl<M: Hash + Move, U: Hash + Utility, O: Hash + Outcome<M, U, P>, const P: usize> Hash for History<M, U, O, P>
Source§impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Outcome<M, U, P> for History<M, U, O, P>
impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Outcome<M, U, P> for History<M, U, O, P>
Source§impl<M: PartialEq + Move, U: PartialEq + Utility, O: PartialEq + Outcome<M, U, P>, const P: usize> PartialEq for History<M, U, O, P>
impl<M: PartialEq + Move, U: PartialEq + Utility, O: PartialEq + Outcome<M, U, P>, const P: usize> PartialEq for History<M, U, O, P>
Source§impl<M: Move, U: Utility, O: Outcome<M, U, P>, const P: usize> Record<M, P> for History<M, U, O, P>
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>
fn plies(&self) -> Plies<'_, M, P>
An iterator over the played moves in this record. Read more
Source§fn to_transcript(&self) -> Transcript<M, P>
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> ⓘ
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> ⓘ
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>
fn played_moves_per_player(&self) -> PerPlayer<PlayedMoves<'_, M>, P>
Iterators over the moves by each player.
impl<M: Eq + Move, U: Eq + Utility, O: Eq + Outcome<M, U, P>, const P: usize> Eq for History<M, U, O, P>
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>
impl<M, U, O, const P: usize> UnwindSafe for History<M, U, O, P>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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