From: erbsenzaehler Date: Sun, 27 Jan 2019 08:20:38 +0000 (+0100) Subject: Make ONE_PLY value independent again X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=49a1fdd3fe894d170a2c2781238c0f0f907c08cc Make ONE_PLY value independent again And a Trevis CI test to catch future issues. No functional change. --- diff --git a/.travis.yml b/.travis.yml index c4f68ae5..f27f9c95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,9 @@ script: - make clean && make -j2 ARCH=x86-64 optimize=no debug=yes build && ../tests/signature.sh $benchref - make clean && make -j2 ARCH=x86-32 optimize=no debug=yes build && ../tests/signature.sh $benchref - make clean && make -j2 ARCH=x86-32 build && ../tests/signature.sh $benchref + + # Verify bench number is ONE_PLY independent by doubling its value + - sed -i 's/.*\(ONE_PLY = [0-9]*\),.*/\1 * 2,/g' types.h - make clean && make -j2 ARCH=x86-64 build && ../tests/signature.sh $benchref # # Check perft and reproducible search diff --git a/src/search.cpp b/src/search.cpp index 36c8a5eb..a9a62dbf 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -86,8 +86,8 @@ namespace { // Add a small random component to draw evaluations to avoid 3fold-blindness Value value_draw(Depth depth, Thread* thisThread) { - return depth < 4 ? VALUE_DRAW - : VALUE_DRAW + Value(2 * (thisThread->nodes & 1) - 1); + return depth < 4 * ONE_PLY ? VALUE_DRAW + : VALUE_DRAW + Value(2 * (thisThread->nodes & 1) - 1); } // Skill structure is used to implement strength limit @@ -785,7 +785,7 @@ namespace { // Do verification search at high depths, with null move pruning disabled // for us, until ply exceeds nmpMinPly. - thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4; + thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / (4 * ONE_PLY); thisThread->nmpColor = us; Value v = search(pos, ss, beta-1, beta, depth-R, false); @@ -912,8 +912,9 @@ moves_loop: // When in check, search starts from here && pos.legal(move)) { Value singularBeta = ttValue - 2 * depth / ONE_PLY; + Depth halfDepth = depth / (2 * ONE_PLY) * ONE_PLY; // ONE_PLY invariant ss->excludedMove = move; - value = search(pos, ss, singularBeta - 1, singularBeta, depth / 2, cutNode); + value = search(pos, ss, singularBeta - 1, singularBeta, halfDepth, cutNode); ss->excludedMove = MOVE_NONE; if (value < singularBeta) @@ -961,7 +962,8 @@ moves_loop: // When in check, search starts from here continue; // Reduced depth of the next LMR search - int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY; + int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO); + lmrDepth /= ONE_PLY; // Countermoves based pruning (~20 Elo) if ( lmrDepth < 3 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)