logic improvements

This commit is contained in:
2025-02-28 23:36:47 -05:00
parent ff1ded0a74
commit 19b5b856db
4 changed files with 22 additions and 17 deletions

View File

@@ -77,8 +77,8 @@ impl Move {
/// 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());
self.children.sort_by(|&a, &b| {
arena[b].value.cmp(&arena[a].value) // Descending order for agent's max nodes
});
}
}