disable progressbar for tests
This commit is contained in:
parent
992ca01169
commit
12a6881070
@ -62,28 +62,32 @@ impl FutureMoves {
|
|||||||
/// Generate children for all children of `nodes`
|
/// Generate children for all children of `nodes`
|
||||||
/// only `pub` for the sake of benchmarking
|
/// only `pub` for the sake of benchmarking
|
||||||
pub fn extend_layers(&mut self) {
|
pub fn extend_layers(&mut self) {
|
||||||
for i in (self.current_depth + 1)..=self.config.max_depth {
|
for _ in (self.current_depth + 1)..=self.config.max_depth {
|
||||||
if self.arena_len() >= self.config.max_arena_size {
|
if self.arena_len() >= self.config.max_arena_size {
|
||||||
dbg!("extend_layers: early break ({})", self.arena_len());
|
dbg!("extend_layers: early break ({})", self.arena_len());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let pstyle_inner = if cfg!(test) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
&format!(
|
||||||
|
"Generating children (depth: {}/{}): ({{pos}}/{{len}}) {{per_sec}}",
|
||||||
|
self.current_depth + 1,
|
||||||
|
self.config.max_depth
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
(0..self.arena.len())
|
(0..self.arena.len())
|
||||||
// we want to select all nodes that don't have children, or are lazy (need to maybe be regenerated)
|
// we want to select all nodes that don't have children, or are lazy (need to maybe be regenerated)
|
||||||
.filter(|&idx| {
|
.filter(|&idx| {
|
||||||
let got = &self.arena[idx];
|
let got = &self.arena[idx];
|
||||||
!got.is_trimmed && got.winner == Winner::None && !got.tried_children
|
!got.is_trimmed && !got.tried_children && got.winner == Winner::None
|
||||||
})
|
})
|
||||||
.filter(|&idx| self.is_connected_to_root(idx))
|
.filter(|&idx| self.is_connected_to_root(idx))
|
||||||
.collect::<Vec<usize>>()
|
.collect::<Vec<usize>>()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.progress_with_style(
|
.progress_with_style(ProgressStyle::with_template(pstyle_inner).unwrap())
|
||||||
ProgressStyle::with_template(&format!(
|
|
||||||
"Generating children (depth: {}/{}): ({{pos}}/{{len}}) {{per_sec}}",
|
|
||||||
i, self.config.max_depth
|
|
||||||
))
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.for_each(|node_idx| {
|
.for_each(|node_idx| {
|
||||||
self.generate_children(node_idx).last();
|
self.generate_children(node_idx).last();
|
||||||
self.arena[node_idx].tried_children = true;
|
self.arena[node_idx].tried_children = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user