aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/grossmeister/search.rs')
-rw-r--r--src/grossmeister/search.rs15
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;