ChildrenEvalMethod: add and switch to AverageDivDepth

This commit is contained in:
2025-03-12 16:53:07 -04:00
parent e14391d129
commit 31e88e3313
4 changed files with 24 additions and 18 deletions

View File

@@ -78,6 +78,7 @@ impl std::fmt::Display for FutureMoveConfig {
pub enum ChildrenEvalMethod {
/// Best (by far) strat compared to Max or Min
Average,
AverageDivDepth,
}
impl FutureMoves {
@@ -271,7 +272,7 @@ impl FutureMoves {
let by_depth_vec = self.by_depth(indexes);
// reversed so we build up the value of the closest (in time) moves from the future
for (_, nodes) in by_depth_vec.into_iter().rev() {
for (depth, nodes) in by_depth_vec.into_iter().rev() {
for idx in nodes {
let children_values = self.arena[idx]
.children
@@ -284,6 +285,12 @@ impl FutureMoves {
.into_iter()
.sum::<i32>()
.checked_div(self.arena[idx].children.len() as i32),
ChildrenEvalMethod::AverageDivDepth => children_values
.into_iter()
.sum::<i32>()
.checked_div(self.arena[idx].children.len() as i32)
.and_then(|x| x.checked_div(depth as i32)),
}
.unwrap_or(0);
@@ -560,7 +567,7 @@ mod tests {
max_arena_size: 100,
do_prune: false,
print: false,
children_eval_method: ChildrenEvalMethod::Average,
children_eval_method: ChildrenEvalMethod::AverageDivDepth,
};
#[test]