From 9927af55dd12bc5eca7ff17e9dbc2665c42fcfb7 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 3 Sep 2023 17:32:31 +0300 Subject: refactor: separate threefold_repetition --- src/grossmeister/search.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/grossmeister/search.rs') diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs index fb7e385..2d20e3a 100644 --- a/src/grossmeister/search.rs +++ b/src/grossmeister/search.rs @@ -44,8 +44,7 @@ impl Grossmeister { let mut principal_variation = Vec::new(); let color = self.board.color(); - if self.board.positions.iter().filter(|p| **p == self.board.hash).count() >= 3 { - // Draw by repetition + if self.board.threefold_repetition() { return (0.0, principal_variation); } @@ -176,9 +175,8 @@ impl Grossmeister { pub fn quiscence(&mut self, mut alpha: f32, mut beta: f32, root_distance: u8) -> f32 { let color = self.board.color(); - if self.board.positions.iter().filter(|p| **p == self.board.hash).count() >= 3 { - // Draw by repetition - return 0.0; + if self.board.threefold_repetition() { + return 0.0 } // Mate distance pruning -- cgit v1.2.3