Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bananasmoothii committed Oct 13, 2023
1 parent 10d6ee8 commit b0fe69c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,25 @@ impl<G: Game> GameNode<G> {
//println!("{}({})Exploring {} children of depth {} (actual: {})...", spaces, self.id(), self.children.len(), self.depth(), self.depth().overflowing_sub(real_plays).0);

//println!("({} - {real_plays} = {} )", self.depth(), self.depth().overflowing_sub(real_plays).0);
let weight = if self.is_parallelize_depth(real_plays) {
if self.is_parallelize_depth(real_plays) {
// parallelize
self.children.par_iter_mut().try_for_each(|(_, child)| {
//print!("F");
maybe_explore_children(child)
});
let weight = (*worst_child_score.lock()).into();
self.set_weight(weight);
weight.unwrap()
} else {
self.children
.iter_mut()
.try_for_each(|(_, child)| maybe_explore_children(child));
let weight = (*worst_child_score.lock()).into();
self.set_weight(weight);
weight.unwrap()
};
let weight = (*worst_child_score.lock()).into();
self.set_weight(weight);

if auto_destroy.load(Relaxed) {
self.children = Vec::with_capacity(0);
}

weight
weight.unwrap()
}

fn is_parallelize_depth(&self, real_plays: u32) -> bool {
Expand Down

0 comments on commit b0fe69c

Please sign in to comment.