From 67f88f5e3e4ee6e4b49151173c2898253178506f Mon Sep 17 00:00:00 2001 From: Joerg Oster Date: Thu, 13 Feb 2014 23:44:12 +0100 Subject: [PATCH] Return static eval when reaching MAX_PLY Makes more sense than returning a draw score. Tested with reduced MAX_PLY = 30 and passed both short TC LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 17434 W: 3345 L: 3194 D: 10895 And long TC LLR: 2.97 (-2.94,2.94) [0.00,6.00] Total: 2610 W: 488 L: 373 D: 1749 With current limit of MAX_PLY = 100 the patch should not introduce any measurable change, nevertheless is the correct approach. Idea of returning eval is from Michel Van den Bergh. bench: 8430785 --- src/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 0cd49085..ad13c4ba 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -512,7 +512,7 @@ namespace { { // Step 2. Check for aborted search and immediate draw if (Signals.stop || pos.is_draw() || ss->ply > MAX_PLY) - return DrawValue[pos.side_to_move()]; + return ss->ply > MAX_PLY && !inCheck ? evaluate(pos) : DrawValue[pos.side_to_move()]; // Step 3. Mate distance pruning. Even if we mate at the next move our score // would be at best mate_in(ss->ply+1), but if alpha is already bigger because @@ -1078,7 +1078,7 @@ moves_loop: // When in check and at SpNode search starts from here // Check for an instant draw or if the maximum ply has been reached if (pos.is_draw() || ss->ply > MAX_PLY) - return DrawValue[pos.side_to_move()]; + return ss->ply > MAX_PLY && !InCheck ? evaluate(pos) : DrawValue[pos.side_to_move()]; // Decide whether or not to include checks: this fixes also the type of // TT entry depth that we are going to use. Note that in qsearch we use -- 2.39.2