Skip to content

Commit

Permalink
Do not visit hash move twice
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmendes committed Jan 11, 2024
1 parent 8ebddd1 commit 24aeab8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/search/movepick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,17 @@ impl std::iter::Iterator for MovePicker<false> {
fn next(&mut self) -> Option<Self::Item> {
if let Some((mov, score, index)) = find_next_max_and_swap(&mut self.moves, &mut self.index)
{
if self.stage != MoveStage::HashMove {
let hash_move =
self.table.as_ref().unwrap().lock().unwrap().get_hash_move(&self.position);
if hash_move == Some(mov) {
return self.next();
}
}
return Some((mov, score, index));
}

// Advance to the next stage
match self.stage {
MoveStage::HashMove => {
self.stage = MoveStage::CapturesAndPromotions;
Expand Down

0 comments on commit 24aeab8

Please sign in to comment.