summaryrefslogtreecommitdiff
path: root/src/chess.h
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-23 15:12:10 -0700
committerScott Gasch <[email protected]>2026-09-23 15:12:10 -0700
commitf0b56611d8ef5ce2d121f532931de0252628d995 (patch)
tree9db1896f7f8308b28adc500853e440f0f5122d8e /src/chess.h
parentb7e4cdfeb3c1aadb3f488f6794e6d1a748dc6c8f (diff)
Real chess knowledge in the KPK[P] recognizer. Sound (but not perfect)
knowledge in eval's EvalRacersAgainstLongKing code. Other minor changes. Even in self-play.
Diffstat (limited to 'src/chess.h')
-rwxr-xr-xsrc/chess.h62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/chess.h b/src/chess.h
index 8d9a8d8..72289ad 100755
--- a/src/chess.h
+++ b/src/chess.h
@@ -3630,10 +3630,26 @@ InitEval();
SCORE
Eval(SEARCHER_THREAD_CONTEXT *, SCORE, SCORE, SCORE (*)[2]);
+// Exposed (non-static) so testrecogn.c can EGTB-cross-check the
+// wrong-bishop-rook-pawn-fortress shortcut inside it -- see this
+// function's own header comment in eval.c for why that specific case
+// is fine to be occasionally wrong here (a soft eval nudge) in a way
+// it would not be as a recogn.c hard bound.
FLAG
-_EvalPasserRacesAgainstLoneKings(POSITION *,
+SideHasWinningChances(POSITION *pos, ULONG uSide);
+
+FLAG
+_EvalPasserRacesAgainstLoneKings(SEARCHER_THREAD_CONTEXT *,
PAWN_HASH_ENTRY *);
+// Exposed (non-static) so testrecogn.c can build a real,
+// fully-populated PAWN_HASH_ENTRY (bbPasserLocations included) the
+// same way Eval() itself does, in order to EGTB-cross-check
+// _EvalPasserRacesAgainstLoneKings directly rather than guessing at
+// its accuracy.
+PAWN_HASH_ENTRY *
+EvalPawns(SEARCHER_THREAD_CONTEXT *ctx, FLAG *pfDeferred);
+
ULONG
CountKingSafetyDefects(POSITION *pos,
ULONG uSide);
@@ -4211,6 +4227,24 @@ TestRecognExhaustiveKNKP(void);
void
TestRecognExhaustiveKPK(void);
+void
+TestRecognExhaustiveKPvKP(void);
+
+void
+TestRecognSampleKPvKP(void);
+
+void
+TestEvalWrongBishopFortress(void);
+
+void
+TestEvalPasserRacesAgainstLoneKings(void);
+
+void
+TestEvalSamplePasserRacesKPPKPP(void);
+
+void
+TestEvalSamplePasserRacesKPKPPP(void);
+
//
// probe.c
//
@@ -4299,6 +4333,32 @@ RecognLookup(SEARCHER_THREAD_CONTEXT *ctx,
FLAG fProbeEGTB);
//
+// Shared, ctx-free KP+KP* "unstoppable passer" static analysis --
+// deliberately touches no move generation (see recogn.c's
+// IsStaticSafeQueeningPawn for why) so it's safe to call from eval.c's
+// Eval() as well as recogn.c's own hard-bound recognizer. See that
+// function's comment for the full rationale and the trust boundary
+// between recogn.c (must never be wrong) and eval.c (a soft bonus,
+// allowed to occasionally miss what recogn.c's fuller,
+// move-generation-assisted version catches).
+//
+FLAG
+IsStaticSafeQueeningPawn(POSITION *pos, ULONG uColor, COOR cPawn);
+
+FLAG
+HasStaticUnstoppablePasser(POSITION *pos, ULONG uColor, COOR *pcPawn);
+
+//
+// True-lone-king (weak side has zero pawns) "rule of the square + king
+// escort" analysis -- exhaustively verified via TestRecognExhaustiveKPK
+// (0 wrong across all 165,676 EGTB-covered legal single-pawn KPK
+// positions). Also pure geometry, no move generation, so also safe for
+// eval.c to call directly.
+//
+FLAG
+IsUnstoppableLoneKingPasser(POSITION *pos, ULONG uStrong, COOR cPawn);
+
+//
// Unregistered/experimental recognizers, exposed only so testrecogn.c
// can exhaustively validate a candidate before it's ever re-registered
// in InitializeInteriorNodeRecognizers. Not reachable from the normal