weight children differently
This commit is contained in:
parent
18dbc2ffe2
commit
ac61d9a127
@ -256,7 +256,10 @@ impl FutureMoves {
|
|||||||
let children_value = node
|
let children_value = node
|
||||||
.children
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&child| self.arena[child].value)
|
.rev() // rev then reverse so we get an index starting from the back
|
||||||
|
.enumerate()
|
||||||
|
// since children are sorted by value, we should weight the first one more
|
||||||
|
.map(|(i, &child)| self.arena[child].value * (i as i64 + 1))
|
||||||
.sum::<i64>()
|
.sum::<i64>()
|
||||||
.checked_div(node.children.len() as i64)
|
.checked_div(node.children.len() as i64)
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user