fix failing test

This commit is contained in:
Simon Gardling 2025-02-26 22:52:25 -05:00
parent e468464956
commit 4a82c01d64
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
2 changed files with 9 additions and 4 deletions

View File

@ -13,10 +13,10 @@ pub struct ComplexAgent {
impl ComplexAgent { impl ComplexAgent {
pub const fn new(color: Piece) -> Self { pub const fn new(color: Piece) -> Self {
const CONFIG: FutureMoveConfig = FutureMoveConfig { const CONFIG: FutureMoveConfig = FutureMoveConfig {
max_depth: 10, max_depth: 13,
min_arena_depth_sub: 3, min_arena_depth_sub: 3,
top_k_children: 2, top_k_children: 2,
up_to_minus: 4, up_to_minus: 3,
max_arena_size: 10_000_000, max_arena_size: 10_000_000,
}; };
Self { Self {

View File

@ -255,6 +255,10 @@ impl FutureMoves {
!self.agent_color, !self.agent_color,
self.agent_color, self.agent_color,
)); ));
// because we have to regenerate root from a [`Board`]
// we need to reset the current_depth (fixes `skip_move_recovery`)
self.current_depth = 0;
self.set_root_idx_raw(0); self.set_root_idx_raw(0);
} }
@ -557,7 +561,7 @@ mod tests {
board: Board::new(), board: Board::new(),
winner: Winner::None, winner: Winner::None,
parent: None, parent: None,
children: vec![1], children: vec![],
value: None, value: None,
self_value: 0, self_value: 0,
color: Piece::Black, color: Piece::Black,
@ -638,8 +642,9 @@ mod tests {
); );
} }
/// tests whether or not FutureMoves can recover from multiple skips and then manually regenerating the arena
#[test] #[test]
fn best_move_failure() { fn skip_move_recovery() {
let mut futm = FutureMoves::new(Piece::Black, FUTURE_MOVES_CONFIG); let mut futm = FutureMoves::new(Piece::Black, FUTURE_MOVES_CONFIG);
let mut board = Board::new().starting_pos(); let mut board = Board::new().starting_pos();