aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/grossmeister/search.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index 0ca5ef4..c195527 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -50,18 +50,20 @@ impl Grossmeister {
if let Some(transposition) = self.transposition() {
if transposition.depth >= depth_left {
match transposition.node_type {
- NodeType::PV | NodeType::Cut => {
+ NodeType::PV => {
+ return transposition.score.clamp(alpha, beta);
+ }
+ NodeType::Cut => {
if transposition.score >= beta {
- return beta
- }
- if transposition.score > alpha {
- alpha = transposition.score
+ return beta;
}
+ alpha = transposition.score.clamp(alpha, beta);
}
NodeType::All => {
if transposition.score <= alpha {
- return alpha
+ return alpha;
}
+ beta = transposition.score.clamp(alpha, beta);
}
}
}
@@ -171,18 +173,20 @@ impl Grossmeister {
if let Some(transposition) = self.transposition() {
match transposition.node_type {
- NodeType::PV | NodeType::Cut => {
+ NodeType::PV => {
+ return transposition.score.clamp(alpha, beta);
+ }
+ NodeType::Cut => {
if transposition.score >= beta {
- return beta
- }
- if transposition.score > alpha {
- alpha = transposition.score
+ return beta;
}
+ alpha = transposition.score.clamp(alpha, beta);
}
NodeType::All => {
if transposition.score <= alpha {
- return alpha
+ return alpha;
}
+ beta = transposition.score.clamp(alpha, beta);
}
}
}