48 lines
1.1 KiB
Rust
48 lines
1.1 KiB
Rust
use crate::{
|
|
agent::Agent,
|
|
logic::{FutureMoveConfig, FutureMoves},
|
|
repr::{Board, CoordPair, Piece},
|
|
};
|
|
|
|
pub struct ComplexAgent {
|
|
color: Piece,
|
|
future_moves: FutureMoves,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
impl ComplexAgent {
|
|
pub const fn new(color: Piece) -> Self {
|
|
const CONFIG: FutureMoveConfig = FutureMoveConfig {
|
|
max_depth: 20,
|
|
min_arena_depth_sub: 3,
|
|
top_k_children: 2,
|
|
up_to_minus: usize::MAX, // disable pruning
|
|
max_arena_size: 50_000_000,
|
|
};
|
|
Self {
|
|
color,
|
|
future_moves: FutureMoves::new(color, CONFIG),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Agent for ComplexAgent {
|
|
fn next_move(&mut self, board: &Board) -> Option<CoordPair> {
|
|
self.future_moves.update_from_board(board);
|
|
|
|
println!("# of moves stored: {}", self.future_moves.arena_len());
|
|
|
|
self.future_moves
|
|
.best_move()
|
|
.expect("FutureMoves has no move?")
|
|
}
|
|
|
|
fn name(&self) -> &'static str {
|
|
"Complex Agent"
|
|
}
|
|
|
|
fn color(&self) -> Piece {
|
|
self.color
|
|
}
|
|
}
|