initial rewrite of lazy_children logic

This commit is contained in:
2025-02-25 11:23:14 -05:00
parent 9976368730
commit 0adb59dc7f
3 changed files with 21 additions and 27 deletions

View File

@@ -86,4 +86,11 @@ impl Move {
BVM.board_value(&self.board, agent_color)
}
/// Sort children of the [`Move`] by their self_value in `arena`
pub fn sort_children(&mut self, arena: &[Move]) {
// negative, because we want the max value to be at the first index
// abs because we want the most EXTREME possible outcome (win or lose for example)
self.children.sort_by_key(|&i| -arena[i].self_value.abs());
}
}