logic improvements
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user