fix test
This commit is contained in:
parent
2c31589e51
commit
fae4aaab6f
@ -237,17 +237,13 @@ impl FutureMoves {
|
||||
/// The board is supposed to be after the opposing move
|
||||
/// Returns whether or not the arena was regenerated (bool)
|
||||
pub fn update_from_board(&mut self, board: &Board) -> bool {
|
||||
let curr_board = self
|
||||
.arena
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(idx, _)| {
|
||||
self.current_root
|
||||
.map(|x| self.arena[x].children.contains(idx))
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.find(|(_, m)| &m.board == board)
|
||||
.map(|(idx, _)| idx);
|
||||
let curr_board = (0..self.arena.len())
|
||||
// needs to be every other generation in order to
|
||||
// match the agent_color usually root or great-grand child
|
||||
.filter(|&idx| self.depth_of(idx) % 2 == 0)
|
||||
.find(|&idx| {
|
||||
&self.arena[idx].board == board && self.arena[idx].color == !self.agent_color
|
||||
});
|
||||
|
||||
if let Some(curr_board_idx) = curr_board {
|
||||
self.set_root_idx_raw(curr_board_idx);
|
||||
@ -447,7 +443,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
const FUTURE_MOVES_CONFIG: FutureMoveConfig = FutureMoveConfig {
|
||||
max_depth: 1,
|
||||
max_depth: 3, // we want great-grand children for traversing moves
|
||||
min_arena_depth_sub: 0,
|
||||
top_k_children: 1,
|
||||
up_to_minus: 0,
|
||||
@ -658,7 +654,9 @@ mod tests {
|
||||
|
||||
// make sure that the arena should only be
|
||||
// regenerated on the first move
|
||||
assert!(i <= 0 || update_result, "board regenerated on move #{}", i);
|
||||
if i > 0 && update_result {
|
||||
panic!("board regenerated on move #{}", i);
|
||||
}
|
||||
|
||||
let best_move = futm.best_move();
|
||||
assert!(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user