logic improvements
This commit is contained in:
@@ -41,6 +41,8 @@ pub struct FutureMoveConfig {
|
||||
/// Max size of the arena, will not generate more if
|
||||
/// the arena is of that size or bigger
|
||||
pub max_arena_size: usize,
|
||||
|
||||
pub do_not_prune: bool,
|
||||
}
|
||||
|
||||
impl FutureMoves {
|
||||
@@ -227,10 +229,7 @@ impl FutureMoves {
|
||||
.children
|
||||
.iter()
|
||||
.flat_map(|&child| self.arena[child].value)
|
||||
// sum values of children
|
||||
.sum::<i128>()
|
||||
// divide in order to calculate average value of all children
|
||||
.checked_div(self.arena[idx].children.len() as i128)
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
|
||||
// we use `depth` and divided `self_value` by it, idk if this is worth it
|
||||
@@ -358,7 +357,9 @@ impl FutureMoves {
|
||||
}
|
||||
|
||||
fn prune_bad_children(&mut self) {
|
||||
if self.config.max_depth > self.current_depth + self.config.min_arena_depth_sub {
|
||||
if self.config.max_depth > (self.current_depth + self.config.min_arena_depth_sub)
|
||||
|| self.config.do_not_prune
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -469,6 +470,7 @@ mod tests {
|
||||
top_k_children: 1,
|
||||
up_to_minus: 0,
|
||||
max_arena_size: 100,
|
||||
do_not_prune: true,
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user