From 2201fb4598f9f6ba1b8019b42edc75f945d5a725 Mon Sep 17 00:00:00 2001 From: syzygy1 <3028851+syzygy1@users.noreply.github.com> Date: Sun, 12 Jul 2020 00:27:25 +0200 Subject: [PATCH] Cfish 11a This fixes a minor problem causing diverging node counts and re-enables large pages on Linux. It also fixes the one-by-off error in reported seldepth. --- src/misc.c | 2 +- src/ntsearch.c | 16 +++++++--------- src/position.h | 3 ++- src/search.c | 4 ++-- src/ucioption.c | 2 ++ 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/misc.c b/src/misc.c index 5e87a888..934a1a6a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -36,7 +36,7 @@ // Version number. If Version is left empty, then compile date in the format // DD-MM-YY and show in engine_info. -char Version[] = "11"; +char Version[] = "11a"; #ifndef _WIN32 pthread_mutex_t ioMutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/ntsearch.c b/src/ntsearch.c index 75a87301..906e52a8 100644 --- a/src/ntsearch.c +++ b/src/ntsearch.c @@ -281,7 +281,7 @@ Value search_NonPV(Pos *pos, Stack *ss, Value alpha, Depth depth, int cutNode) && ss->staticEval >= beta - 32 * depth + 292 - improving * 30 && !excludedMove && non_pawn_material_c(stm()) - && (ss->ply >= pos->nmpPly || ss->ply % 2 != pos->nmpOdd)) + && (ss->ply >= pos->nmpMinPly || stm() != pos->nmpColor)) { assert(eval - beta >= 0); @@ -301,19 +301,17 @@ Value search_NonPV(Pos *pos, Stack *ss, Value alpha, Depth depth, int cutNode) if (nullValue >= VALUE_MATE_IN_MAX_PLY) nullValue = beta; - if ( (depth < 13 || pos->nmpPly) - && abs(beta) < VALUE_KNOWN_WIN) + if (pos->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 13)) return nullValue; - // Do verification search at high depths - // Disable null move pruning for side to move for the first part of - // the remaining search tree - pos->nmpPly = ss->ply + 3 * (depth-R) / 4; - pos->nmpOdd = ss->ply & 1; + // Do verification search at high depths, with null move pruning + // disabled for us, until ply exceeds nmpMinPly + pos->nmpMinPly = ss->ply + 3 * (depth-R) / 4; + pos->nmpColor = stm(); Value v = search_NonPV(pos, ss, beta-1, depth-R, 0); - pos->nmpOdd = pos->nmpPly = 0; + pos->nmpMinPly = 0; if (v >= beta) return nullValue; diff --git a/src/position.h b/src/position.h index d0e9790a..ab938508 100644 --- a/src/position.h +++ b/src/position.h @@ -156,7 +156,8 @@ struct Pos { uint64_t tbHits; uint64_t ttHitAverage; int pvIdx, pvLast; - int selDepth, nmpPly, nmpOdd; + int selDepth, nmpMinPly; + uint32_t nmpColor; Depth rootDepth; Depth completedDepth; Score contempt; diff --git a/src/search.c b/src/search.c index e7d599d9..b97227a6 100644 --- a/src/search.c +++ b/src/search.c @@ -864,7 +864,7 @@ static void uci_print_pv(Pos *pos, Depth depth, Value alpha, Value beta) TB_expand_mate(pos, &rm->move[i]); printf("info depth %d seldepth %d multipv %d score %s", - d, rm->move[i].selDepth, i + 1, + d, rm->move[i].selDepth + 1, i + 1, uci_value(buf, v)); if (!tb && i == pvIdx) @@ -1010,7 +1010,7 @@ void start_thinking(Pos *root) for (int idx = 0; idx < Threads.numThreads; idx++) { Pos *pos = Threads.pos[idx]; pos->selDepth = 0; - pos->nmpPly = pos->nmpOdd = 0; + pos->nmpMinPly = 0; pos->rootDepth = 0; pos->nodes = pos->tbHits = 0; RootMoves *rm = pos->rootMoves; diff --git a/src/ucioption.c b/src/ucioption.c index 28a75258..fcc82589 100644 --- a/src/ucioption.c +++ b/src/ucioption.c @@ -18,6 +18,8 @@ along with this program. If not, see . */ +#define _GNU_SOURCE + #include #include #include