future_move: improve pruning logic

This commit is contained in:
Simon Gardling 2025-03-25 13:29:19 -04:00
parent 9757264854
commit f10f4d83e0
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -480,9 +480,16 @@ impl FutureMoves {
}
for idx in indexes {
// TODO! add check here to make sure that this index is
// still connected to the root from the previous trimming
// steps
// any nodes that have no parent node and aren't
// the root node, is orphaned
if self.arena[idx].parent.is_none() && self.current_root != Some(idx) {
// propegate orphan-ness to the children
let children: Vec<usize> = self.arena[idx].children.drain(..).collect();
for idx in children {
self.arena[idx].parent = None;
}
continue;
}
let mut m = self.arena[idx].clone();
// don't attempt and trim moves that have already been trimmed