Add improved NMP reduction scheme (20.1 +/- 14)

This commit is contained in:
Mattia Giambirtone 2024-05-11 12:50:33 +02:00
parent 9331729d76
commit 25677ae2c6
1 changed files with 2 additions and 7 deletions

View File

@ -56,7 +56,7 @@ const
# Limit after which FP is disabled # Limit after which FP is disabled
FP_DEPTH_LIMIT {.used.} = 1 FP_DEPTH_LIMIT {.used.} = 1
# Advantage threshold # Advantage threshold
FP_EVAL_MARGIN {.used.} = 300 FP_EVAL_MARGIN {.used.} = 125
# Constants to configure LMP (Late # Constants to configure LMP (Late
# Move Pruning) # Move Pruning)
@ -448,12 +448,7 @@ proc search(self: var SearchManager, depth, ply: int, alpha, beta: Score, isPV:
self.board.makeNullMove() self.board.makeNullMove()
# We perform a shallower search because otherwise there would be no point in # We perform a shallower search because otherwise there would be no point in
# doing NMP at all! # doing NMP at all!
var reduction: int var reduction = NMP_BASE_REDUCTION + depth div NMP_DEPTH_REDUCTION
when defined(NMP2):
# Reduce more based on depth
reduction = NMP_BASE_REDUCTION + depth div NMP_DEPTH_REDUCTION
else:
reduction = NMP_BASE_REDUCTION
let score = -self.search(depth - reduction, ply + 1, -beta + 1, -beta, isPV=false) let score = -self.search(depth - reduction, ply + 1, -beta + 1, -beta, isPV=false)
self.board.unmakeMove() self.board.unmakeMove()
if score >= beta: if score >= beta: