commit old stuff

This commit is contained in:
Simon Gardling 2025-07-24 23:19:09 -07:00
parent ef2e551085
commit 4ca6dfc572
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
3 changed files with 8 additions and 3 deletions

View File

@ -30,7 +30,7 @@ pub fn run() {
..Default::default() ..Default::default()
}; };
let configs = [6] let configs = [2, 3, 4, 5, 6, 7, 8]
.into_iter() .into_iter()
.map(move |d| FutureMoveConfig { .map(move |d| FutureMoveConfig {
max_depth: d, max_depth: d,
@ -121,7 +121,7 @@ pub fn run() {
}) })
.collect(); .collect();
if true { if false {
vec.push(( vec.push((
"RandomAgent".to_string(), "RandomAgent".to_string(),
Box::new(move |piece| Box::new(RandomAgent::new(piece))), Box::new(move |piece| Box::new(RandomAgent::new(piece))),

View File

@ -311,6 +311,7 @@ impl FutureMoves {
match self.config.children_eval_method { match self.config.children_eval_method {
ChildrenEvalMethod::MinMax => { ChildrenEvalMethod::MinMax => {
self.arena[idx].value.value += child_value.value; self.arena[idx].value.value += child_value.value;
self.arena[idx].value.set_state(child_value.state());
} }
ChildrenEvalMethod::MinMaxProb => { ChildrenEvalMethod::MinMaxProb => {
self.arena[idx] self.arena[idx]
@ -367,7 +368,7 @@ impl FutureMoves {
ChildrenEvalMethod::MinMax => self.arena[x] ChildrenEvalMethod::MinMax => self.arena[x]
.children .children
.iter() .iter()
.max_by_key(|&&idx| self.arena[idx].value.value), .max_by_key(|&&idx| self.arena[idx].value),
ChildrenEvalMethod::MinMaxProb => self.arena[x] ChildrenEvalMethod::MinMaxProb => self.arena[x]
.children .children
.iter() .iter()

View File

@ -56,6 +56,10 @@ impl MoveValueStats {
self.state = state; self.state = state;
} }
pub const fn state(&self) -> Option<MVSGameState> {
self.state
}
pub fn populate_self_from_children(&mut self, others: &[Self]) { pub fn populate_self_from_children(&mut self, others: &[Self]) {
(self.wins, self.losses, self.ties) = (self.wins, self.losses, self.ties) =
others.iter().fold((0, 0, 0), |(wins, losses, ties), x| { others.iter().fold((0, 0, 0), |(wins, losses, ties), x| {