weight children differently

This commit is contained in:
Simon Gardling 2025-02-19 22:21:53 -05:00
parent 18dbc2ffe2
commit ac61d9a127
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -256,7 +256,10 @@ impl FutureMoves {
let children_value = node
.children
.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>()
.checked_div(node.children.len() as i64)
.unwrap_or(0);