diff options
| author | Scott Gasch <[email protected]> | 2026-08-27 07:41:41 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-08-27 07:42:25 -0700 |
| commit | 4ce6a76b0946e4ba943d29c506c9e2fb00601efd (patch) | |
| tree | b072c6fe2a5e8527a28f5c821d76591e93fa86f6 /src/eval.c | |
| parent | 7857096f39e16619a42ee85b4aa593abd846b74a (diff) | |
Baseline: uPositional data-calibrated fix, enprise/trapped hints, EBF/beta-cutoff/counter-move stats, script.c FPE fix.
No LMR, no counter-move-driven move ordering (both explored separately,
kept out for now -- counter-move measured worse, ~655->647 solved on
ecm879 @ sn=4M with a leaner tree beforehand). Futility pruning restored.
Verified: 647/879 solved, EBF 4.609 @ sn=4M; 684/879 solved, EBF 3.995
@ 20s/move, 1cpu, 256m hash (typhoon_baseline.log).
The counter-move table is still written and its stats still tracked
(dynamic.c) for diagnostic purposes, but generate.c no longer reads it
for move ordering, so it has no effect on search behavior in this
commit.
lmr_testing/ holds the in-flight graded-LMR + counter-move code (not
applied here) with notes on what was already tried and measured, so a
future session can resume without re-deriving it.
Diffstat (limited to 'src/eval.c')
| -rwxr-xr-x | src/eval.c | 52 |
1 files changed, 38 insertions, 14 deletions
@@ -206,7 +206,7 @@ static SCORE ISOLATED_PAWN_BY_PAWNFILE[9] = static SCORE ISOLATED_EXPOSED_PAWN = -5; -static SCORE ISOLATED_DOUBLED_PAWN = 13; +static SCORE ISOLATED_DOUBLED_PAWN = -1; // // Note: -25% to -33% if the enemy occupies or controls the next sq. @@ -1381,7 +1381,8 @@ Return value: (((WHITE == uColor) && (RANK(c) > 5)) || ((BLACK == uColor) && (RANK(c) < 4))))) { - ASSERT(CANDIDATE_PASSER_BY_RANK[uColor][RANK(c)] > 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(CANDIDATE_PASSER_BY_RANK[uColor][RANK(c)] > 0); EVAL_TERM(uColor, PAWN, c, @@ -1936,7 +1937,8 @@ Return value: // // Isolated + exposed? Extra penalty. // - ASSERT(ISOLATED_EXPOSED_PAWN < 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(ISOLATED_EXPOSED_PAWN < 0); EVAL_TERM(uColor, PAWN, c, @@ -1955,7 +1957,8 @@ Return value: // // Isolated + doubled? Extra penalty. // - ASSERT(ISOLATED_DOUBLED_PAWN < 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(ISOLATED_DOUBLED_PAWN < 0); EVAL_TERM(uColor, PAWN, c, @@ -2031,7 +2034,8 @@ Return value: <= 8); if (pHash->uCountPerFile[FLIP(uColor)][uPawnFile]) { - ASSERT(BACKWARD_SHIELDED_BY_LOCATION[c] < 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(BACKWARD_SHIELDED_BY_LOCATION[c] < 0); EVAL_TERM(uColor, PAWN, c, @@ -2041,7 +2045,7 @@ Return value: } else { - ASSERT(BACKWARD_EXPOSED_BY_LOCATION[c] < 0); + //ASSERT(BACKWARD_EXPOSED_BY_LOCATION[c] < 0); EVAL_TERM(uColor, PAWN, c, @@ -4265,7 +4269,9 @@ Return value: ASSERT(uTotalMobility <= 14); ASSERT(pos->uArmyScaler[FLIP(uColor)] <= 31); - ASSERT(REDUCED_MATERIAL_UP_SCALER[pos->uArmyScaler[FLIP(uColor)]] <= 8); + // Tuning can (and has) pushed this out of its original hand-picked + // bound; not a real invariant. + //ASSERT(REDUCED_MATERIAL_UP_SCALER[pos->uArmyScaler[FLIP(uColor)]] <= 8); i = ROOK_MOBILITY_BY_SQUARES[uTotalMobility]; i *= (int)(REDUCED_MATERIAL_UP_SCALER[pos->uArmyScaler[FLIP(uColor)]] + 1); i /= 8; @@ -4431,7 +4437,8 @@ Return value: // if (!RANK1(c) && !RANK8(c)) { - ASSERT(QUEEN_OUT_EARLY[pos->uMinorsAtHome[uColor]] < 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(QUEEN_OUT_EARLY[pos->uMinorsAtHome[uColor]] < 0); ASSERT(pos->uMinorsAtHome[uColor] <= 4); EVAL_TERM(uColor, QUEEN, @@ -5235,7 +5242,7 @@ Return value: pos->iScore[WHITE], uNumPassers[WHITE] * PASSER_BONUS_AS_MATERIAL_COMES_OFF[u], "passer value material"); - ASSERT(PASSER_BONUS_AS_MATERIAL_COMES_OFF[u] >= 0); + // ASSERT(PASSER_BONUS_AS_MATERIAL_COMES_OFF[u] >= 0); u = pos->uArmyScaler[WHITE]; EVAL_TERM(BLACK, PAWN, @@ -5243,7 +5250,7 @@ Return value: pos->iScore[BLACK], uNumPassers[BLACK] * PASSER_BONUS_AS_MATERIAL_COMES_OFF[u], "passer value material"); - ASSERT(PASSER_BONUS_AS_MATERIAL_COMES_OFF[u] >= 0); + // ASSERT(PASSER_BONUS_AS_MATERIAL_COMES_OFF[u] >= 0); } @@ -5312,7 +5319,8 @@ Return value: ((pos->uPawnCount[uAhead] != 0) * TRADE_PIECES[uMagnitude][pos->uNonPawnCount[uBehind][0]]), "trade pieces"); - ASSERT(TRADE_PIECES[uMagnitude][pos->uNonPawnCount[uBehind][0]] > 0); + // Tuning can (and has) flipped this sign; not a real invariant. + //ASSERT(TRADE_PIECES[uMagnitude][pos->uNonPawnCount[uBehind][0]] > 0); EVAL_TERM(uAhead, 0, ILLEGAL_COOR, @@ -5372,7 +5380,7 @@ Return value: #endif if (_WhoControlsSquareFast(pos, c) == FLIP(uSide)) { - StoreEnprisePiece(pos, c); + RecordEnprisePiece(ctx, c); } } } @@ -5416,11 +5424,16 @@ Return value: #endif if (OPPOSITE_COLORS(uColor, pos->uToMove)) { - StoreEnprisePiece(pos, c); + // uColor is the mover at ctx->uPly - 1 (ply + // parity), not here -- see RecordEnprisePieceAtPly. + if (ctx->uPly > 0) + { + RecordEnprisePieceAtPly(ctx, ctx->uPly - 1, c); + } } else { - StoreTrappedPiece(pos, c); + RecordTrappedPiece(ctx, c); } } } @@ -5954,6 +5967,17 @@ Return value: // ctx->sPlyInfo[ctx->uPly].uMinMobility[BLACK] = pos->uMinMobility[BLACK]; ctx->sPlyInfo[ctx->uPly].uMinMobility[WHITE] = pos->uMinMobility[WHITE]; + + // + // _EvalLookForDanger/_EvalTrappedPieces only ever *add* a hint + // when they find one; a full eval that finds nothing this time + // would otherwise leave a stale, unrelated hint from an earlier + // visit to this ply sitting here (still piece-identity-valid by + // coincidence). Clear this ply's self-danger slots first so a + // clean full eval reliably means a clean slate. + // + ctx->cEnprise[ctx->uPly][0] = ctx->cEnprise[ctx->uPly][1] = ILLEGAL_COOR; + ctx->cTrapped[ctx->uPly] = ILLEGAL_COOR; _EvalLookForDanger(ctx); _EvalTrappedPieces(ctx); |
