Skip to content

Commit

Permalink
Abstract the PV best move
Browse files Browse the repository at this point in the history
  • Loading branch information
crippa1337 committed Jul 2, 2023
1 parent 8c57cbe commit 4fa1a91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions engine/src/body/pv_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ impl PVTable {

pv
}

pub fn best_move(&self) -> Option<Move> {
self.table[0]
}
}

impl Default for PVTable {
Expand Down
4 changes: 2 additions & 2 deletions engine/src/body/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl Search {
break;
}

best_move = pv.table[0];
best_move = pv.best_move();

if pretty {
crate::uci::handler::pretty_print(
Expand Down Expand Up @@ -709,7 +709,7 @@ impl Search {
break;
}

best_move = pv.table[0];
best_move = pv.best_move();

if let Some(nodes) = goal_nodes {
if self.info.nodes >= nodes {
Expand Down

0 comments on commit 4fa1a91

Please sign in to comment.