some changes

This commit is contained in:
2025-02-13 22:33:37 -05:00
parent 81c08f5407
commit dafe585f0c
6 changed files with 201 additions and 44 deletions

View File

@@ -1,4 +1,5 @@
use either::Either;
use indicatif::{ProgressBar, ProgressIterator, ProgressStyle};
use crate::{agent::Agent, board::Board, piece::Piece};
@@ -92,16 +93,21 @@ impl FutureMoves {
if self.arena.len() >= self.max_arena {
break;
}
next_nodes = next_nodes
.into_iter()
.flat_map(|node_idx| {
self.generate_children(
Some(node_idx),
&self.arena[node_idx].board.clone(),
next_color,
)
})
.collect();
let arena_len = self.arena.len();
next_nodes =
next_nodes
.into_iter()
.flat_map(|node_idx| {
self.generate_children(
Some(node_idx),
&self.arena[node_idx].board.clone(),
next_color,
)
})
.progress_with(ProgressBar::new(arena_len as u64).with_style(
ProgressStyle::with_template("({pos}/{len}) {per_sec}").unwrap(),
))
.collect();
next_color = !next_color;
}
}
@@ -277,8 +283,8 @@ pub struct ComplexAgent {
impl ComplexAgent {
pub const fn new(color: Piece) -> Self {
const MAX_DEPTH: usize = 8;
const MAX_ARENA: usize = 20_000_000;
const MAX_DEPTH: usize = 10;
const MAX_ARENA: usize = 100_000_000;
Self {
color,
future_moves: FutureMoves::new(color, MAX_DEPTH, MAX_ARENA),