aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-09-04 12:22:54 +0300
committereug-vs <eugene@eug-vs.xyz>2023-09-04 12:22:54 +0300
commit20dd36d4b39654c4d8d2f5d28817fa308eb4c624 (patch)
tree4c280f12d5133e9f477236b5ae586966aebc616d
parent2f7a449038fb5dbc620e9f156c24bb6fa318d8fb (diff)
downloadchessnost-20dd36d4b39654c4d8d2f5d28817fa308eb4c624.tar.gz
feat: use plain negamax instead of MTD(f)
TODO: figure out MTD(f) with TTable
-rw-r--r--src/grossmeister/search.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index 23bcdfa..09c8bc1 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -48,7 +48,7 @@ impl Grossmeister {
}
if let Some(transposition) = self.transposition() {
- if transposition.depth == depth_left {
+ if transposition.depth >= depth_left {
match transposition.node_type {
NodeType::PV => { // PV-nodes have exact score
return transposition.score
@@ -57,11 +57,17 @@ impl Grossmeister {
if transposition.score >= beta {
return beta
}
+ if transposition.score > alpha {
+ alpha = transposition.score
+ }
}
NodeType::All => {
if transposition.score <= alpha {
return alpha
}
+ if transposition.score < beta {
+ beta = transposition.score
+ }
}
}
}
@@ -229,7 +235,6 @@ impl Grossmeister {
let mut pv = Vec::with_capacity(depth as usize);
if let Some(transposition) = self.transposition() {
- debug_assert!(transposition.node_type == NodeType::PV);
let mov = transposition.mov;
let ep_target_before = self.board.ep_target;
let castling_rights_before = self.board.castling_rights;
@@ -248,7 +253,9 @@ impl Grossmeister {
/// Memory-enhanced Test Driver
/// Given a guess score (from previous iteration), use it for series of small-window searches
+ #[allow(unused)]
fn mtdf(&mut self, score_guess: Score, depth: u8) -> Score {
+ todo!("In order to use, (NodeType::PV ? NodeType::Cut) must be Ordering::Equal, try your luck with mate_in_3 test");
let window_size = 1.00;
let mut score = score_guess;
let mut lowerbound = -INFINITY;
@@ -279,7 +286,7 @@ impl Grossmeister {
let mut depth = 0;
while depth <= max_depth {
- let score = self.mtdf(best_score, depth);
+ let score = self.negamax_search(-INFINITY, INFINITY, depth, 0);
if self.should_halt.load(std::sync::atomic::Ordering::SeqCst) {
println!("info string halting search");