diff options
Diffstat (limited to 'src/board')
-rw-r--r-- | src/board/engine.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs index 6543d1d..2c6e47a 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -113,18 +113,19 @@ impl Board { let mut principal_variation = Vec::new(); let color = self.color(); - let moves = match transposition { - Some(item) => { - - if item.node_type == NodeType::PV && item.depth >= depth_left { - // println!("Cache hit (depth_left={}): {:?}", depth_left, item); - vec![item.best_move] - } else { - self.generate_pseudolegal_moves(color) + let mut moves = self.generate_pseudolegal_moves(color); + + if transposition.is_some() { + match transposition { + Some(item) => { + if item.node_type == NodeType::PV { + // println!("Cache hit at depth {}: {:?}", depth_left, item); + moves.insert(0, item.best_move); + } } + None => panic!("Unreachable"), } - None => self.generate_pseudolegal_moves(color), - }; + } if depth_left == 0 { return (self.evaluate(Some(moves.len() as f32)), principal_variation); |