diff options
| author | eug-vs <eugene@eug-vs.xyz> | 2024-01-21 05:13:18 +0100 | 
|---|---|---|
| committer | eug-vs <eugene@eug-vs.xyz> | 2024-01-21 05:13:18 +0100 | 
| commit | 14a58d2268e014aaeb2ce9a3c5357b3dd443a328 (patch) | |
| tree | f0a7b59334aeb704c5215519de9c78b2db9a8b49 /src | |
| parent | 19c2df8907ebc0d13c4d745796ce63a34083186a (diff) | |
| download | chessnost-14a58d2268e014aaeb2ce9a3c5357b3dd443a328.tar.gz | |
refactor: cleanup PVS
Diffstat (limited to 'src')
| -rw-r--r-- | src/grossmeister/search.rs | 15 | 
1 files changed, 7 insertions, 8 deletions
| diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs index bf080eb..2491d1f 100644 --- a/src/grossmeister/search.rs +++ b/src/grossmeister/search.rs @@ -87,7 +87,7 @@ impl Grossmeister {              return self.quiscence(alpha, beta, root_distance)          } -        let mut should_pv_search = true; +        let mut full_window_search = true;          let mut legal_move_found = false;          self.cleanup_selector(); @@ -100,22 +100,21 @@ impl Grossmeister {              if !self.board.is_king_in_check(color) {                  legal_move_found = true; -                let mut score = if should_pv_search { +                let score = if full_window_search {                      // Assume PV-node is high in the list (if move ordering is good) -                    self.negamax_search(-beta, -alpha, depth_left - 1, root_distance + 1) +                    -self.negamax_search(-beta, -alpha, depth_left - 1, root_distance + 1)                  } else {                      // After we have PV-node (that raised alpha) all other nodes will be searched                      // with zero-window first to confirm this assumption -                    let score = self.negamax_search(-(alpha + 0.001), -alpha, depth_left - 1, root_distance + 1); +                    let score = -self.negamax_search(-(alpha + 0.01), -alpha, depth_left - 1, root_distance + 1);                      // In case some of the other nodes raises alpha, then it's true PV node now,                      // let's research with full window to find its exact value -                    if -score > alpha { -                        self.negamax_search(-beta, -alpha, depth_left - 1, root_distance + 1) +                    if score > alpha { +                        -self.negamax_search(-beta, -alpha, depth_left - 1, root_distance + 1)                      } else {                          score                      }                  }; -                score *= -1.;                  self.board.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before, hash_before);                  if score >= beta { @@ -132,7 +131,7 @@ impl Grossmeister {                  }                  if score > alpha {                      alpha = score; -                    should_pv_search = false; // Once we have PV-node we can start zero-window searching +                    full_window_search = false; // Once we have PV-node we can start zero-window searching                      transposition.mov = Some(mov);                      transposition.score = score;                      transposition.node_type = NodeType::PV; | 
