pub struct PartisanGameAnalyzer<G>{ /* private fields */ }
Implementations§
Source§impl<G> PartisanGameAnalyzer<G>
impl<G> PartisanGameAnalyzer<G>
pub fn new(game: G) -> Self
Sourcepub fn eval(&mut self, s: &G::State) -> i64
pub fn eval(&mut self, s: &G::State) -> i64
Examples found in repository?
crates/competitive/src/algorithm/partisan_game.rs (line 87)
80 pub fn eval(&mut self, s: &G::State) -> i64 {
81 if let Some(n) = self.number.get(s).cloned() {
82 n
83 } else {
84 let lmax = self
85 .game
86 .next_left(s)
87 .map(|ns| self.eval(&ns))
88 .fold(i64::MIN, Ord::max);
89 let rmin = self
90 .game
91 .next_right(s)
92 .map(|ns| self.eval(&ns))
93 .fold(i64::MAX, Ord::min);
94 let res = Self::simple_number(lmax, rmin);
95 self.number.insert(s.clone(), res);
96 res
97 }
98 }
Trait Implementations§
Source§impl<G> Clone for PartisanGameAnalyzer<G>
impl<G> Clone for PartisanGameAnalyzer<G>
Source§fn clone(&self) -> PartisanGameAnalyzer<G>
fn clone(&self) -> PartisanGameAnalyzer<G>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<G> Freeze for PartisanGameAnalyzer<G>where
G: Freeze,
impl<G> RefUnwindSafe for PartisanGameAnalyzer<G>
impl<G> Send for PartisanGameAnalyzer<G>
impl<G> Sync for PartisanGameAnalyzer<G>
impl<G> Unpin for PartisanGameAnalyzer<G>
impl<G> UnwindSafe for PartisanGameAnalyzer<G>
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