Skip to content

Commit f27c57c

Browse files
authored
Adjust NMP bound with TT score (#1031)
Idea inspired by Beal's paper "A generalised quiescence search algorithm" where he mentions the concept of touching bounds when considering null-move searches. If we have a null move search score that touches the TT score, we have an adequate estimate of the value of the position. Therefore, return. STC Elo | 2.35 +- 1.79 (95%) SPRT | 8.0+0.08s Threads=1 Hash=16MB LLR | 2.89 (-2.25, 2.89) [0.00, 3.00] Games | N: 36348 W: 9282 L: 9036 D: 18030 Penta | [104, 3990, 9753, 4210, 117] https://recklesschess.space/test/14804/ LTC Elo | 1.66 +- 1.33 (95%) SPRT | 40.0+0.40s Threads=1 Hash=64MB LLR | 2.95 (-2.25, 2.89) [0.00, 3.00] Games | N: 58740 W: 14662 L: 14381 D: 29697 Penta | [37, 6263, 16482, 6558, 30] https://recklesschess.space/test/14805/ Bench: 2482674
1 parent 76205ed commit f27c57c

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/search.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,28 +565,34 @@ fn search<NODE: NodeType>(
565565
td.board.make_null_move();
566566
td.shared.tt.prefetch(td.board.hash());
567567

568-
let score = -search::<NonPV>(td, -beta, -beta + 1, depth - r, false, ply + 1);
568+
let bound = if is_valid(tt_score) && beta > tt_score && tt_bound == Bound::Lower && depth - 2 <= tt_depth {
569+
tt_score
570+
} else {
571+
beta
572+
};
573+
574+
let score = -search::<NonPV>(td, -bound, -bound + 1, depth - r, false, ply + 1);
569575

570576
td.board.undo_null_move();
571577

572578
if td.shared.status.get() == Status::STOPPED {
573579
return Score::ZERO;
574580
}
575581

576-
if score >= beta && !is_win(score) {
582+
if score >= bound && !is_win(score) {
577583
if td.nmp_min_ply > 0 || depth < 16 {
578584
return score;
579585
}
580586

581587
td.nmp_min_ply = ply as i32 + 3 * (depth - r) / 4;
582-
let verified_score = search::<NonPV>(td, beta - 1, beta, depth - r, false, ply);
588+
let verified_score = search::<NonPV>(td, bound - 1, bound, depth - r, false, ply);
583589
td.nmp_min_ply = 0;
584590

585591
if td.shared.status.get() == Status::STOPPED {
586592
return Score::ZERO;
587593
}
588594

589-
if verified_score >= beta {
595+
if verified_score >= bound {
590596
return score;
591597
}
592598
}

0 commit comments

Comments
 (0)