From 1fc88071d1b982166de5af42e834e018ead80595 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Mon, 22 Mar 2010 08:52:04 +0100 Subject: [PATCH] Sync static null conditions with real one Almost no functional change, but it seems more in line with the meaning of static null pruning. Signed-off-by: Marco Costalba --- src/search.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index a383385c..92d2eda6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1368,11 +1368,13 @@ namespace { // Step 7. Static null move pruning // We're betting that the opponent doesn't have a move that will reduce - // the score by more than fuility_margin(depth) if we do a null move. - if ( !isCheck - && allowNullmove - && depth < RazorDepth - && refinedValue - futility_margin(depth, 0) >= beta) + // the score by more than futility_margin(depth) if we do a null move. + if ( allowNullmove + && depth < RazorDepth + && !isCheck + && !value_is_mate(beta) + && ok_to_do_nullmove(pos) + && refinedValue >= beta + futility_margin(depth, 0)) return refinedValue - futility_margin(depth, 0); // Step 8. Null move search with verification search @@ -1388,8 +1390,6 @@ namespace { { ss[ply].currentMove = MOVE_NULL; - pos.do_null_move(st); - // Null move dynamic reduction based on depth int R = 3 + (depth >= 5 * OnePly ? depth / 8 : 0); @@ -1397,6 +1397,8 @@ namespace { if (refinedValue - beta > PawnValueMidgame) R++; + pos.do_null_move(st); + nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID); pos.undo_null_move(); -- 2.39.2