1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Make ONE_PLY value independent again

And a Trevis CI test to catch future issues.

No functional change.
This commit is contained in:
erbsenzaehler 2019-01-27 09:20:38 +01:00 committed by Marco Costalba
parent fdd799bc16
commit 49a1fdd3fe
2 changed files with 10 additions and 5 deletions

View file

@ -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

View file

@ -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<NonPV>(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<NonPV>(pos, ss, singularBeta - 1, singularBeta, depth / 2, cutNode);
value = search<NonPV>(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<PvNode>(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY;
int lmrDepth = std::max(newDepth - reduction<PvNode>(improving, depth, moveCount), DEPTH_ZERO);
lmrDepth /= ONE_PLY;
// Countermoves based pruning (~20 Elo)
if ( lmrDepth < 3 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)