testing
This commit is contained in:
@@ -123,13 +123,39 @@ impl FutureMoves {
|
||||
});
|
||||
|
||||
self.prune_bad_children();
|
||||
self.current_depth += 1;
|
||||
|
||||
if cf.is_break() {
|
||||
// pruning unfinished level
|
||||
let by_depth = self.by_depth(0..self.arena.len());
|
||||
let mut bdh = HashMap::new();
|
||||
for (a, b) in by_depth {
|
||||
bdh.insert(a, b);
|
||||
}
|
||||
|
||||
for &i in bdh.get(&(self.current_depth + 1)).unwrap_or(&Vec::new()) {
|
||||
self.remove(i);
|
||||
}
|
||||
|
||||
for &i in bdh.get(&self.current_depth).unwrap_or(&Vec::new()) {
|
||||
self.arena[i].tried_children = false;
|
||||
}
|
||||
|
||||
self.refocus_tree();
|
||||
|
||||
return;
|
||||
}
|
||||
self.current_depth += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn remove(&mut self, index: usize) {
|
||||
if let Some(parent) = self.arena[index].parent {
|
||||
self.arena[parent].children.retain(|&j| j != index);
|
||||
}
|
||||
|
||||
self.arena[index].parent = None;
|
||||
}
|
||||
|
||||
/// Determines if a [`Move`] at index `idx` is connected to `self.current_root`
|
||||
/// Returns `false` if `self.current_root` is None
|
||||
fn is_connected_to_root(&self, idx: usize) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user