summaryrefslogtreecommitdiff
path: root/src/command.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-05 09:35:19 -0700
committerScott Gasch <[email protected]>2026-09-05 09:35:19 -0700
commitd184a2ea4314d6bd4b8933482c0c1e7a420f2872 (patch)
treed9511b62032b9e039ea9a97944c72bc4b6f45545 /src/command.c
parent863bc8f6c82595de32b382bbde6a0fe81f0a6dcf (diff)
Rook attack/mobility: bitboard rewrite; backport bounded x-ray chaining to bishop
_EvalRook's mobility ray-walk and RMobCaseTable switch replaced with _RookAttacksBB(c, pos->bbOccupied) plus bitboard masks, same technique as knight/bishop. Adds pos->bbRookAttacks[2]/bbRookXrayAttacks[2], first contributors alongside bbMinorAttacks/bbMinorXrayAttacks. Connected-rook bonus and x-ray population derived from the attack bitboard instead of a per-square dispatch. Unlike bishop's single-hop x-ray simplification, rook's x-ray population uses a bounded chain-following loop (recompute with the newly-found blocker excluded, repeat until no new x-ray-worthy terminal appears): checked frequency first (board_representation/ EVAL.md), and 14% of the curated-suite positions have a genuine 2+-deep rook/queen battery on some ray, far more common than bishop's ~1% -- a one-hop approximation here would be a real fidelity loss, not a negligible one. The stashed first bitboard-eval attempt (git stash@{1}) had already solved this correctly by walking blocker-to- blocker via bit-scan; this reproduces the same unbounded behavior via repeated magic-lookup recomputation, cheap because the loop only iterates again when an actual chained battery exists. Backported the same bounded-chain fix to bishop's x-ray population (previously single-hop only) for consistency, now that it's known cheap and mechanically identical -- bishop's own battery rate is much lower (~1%) so this mostly just removes an intentional divergence rather than fixing an active problem. Also fixes two real correctness gaps this conversion would otherwise have introduced silently (same failure mode as pawn's earlier conversion, EVAL.md's progress log): rook no longer writes ROOK_BIT/ ROOK_XRAY_BIT into the old per-square bvAttacks structure, but _WhoControlsSquareFast and queen's mobility unsafe-check both still read those bits directly. Added _IsSquareAttackedByRook/ _IsSquareXrayedByRook (same transitional-helper, DEBUG-cross-checked pattern as the minor-piece helpers) and updated both call sites. Verified via precommit_check.sh (self-test + DEBUG smoke test) after each step. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XxmVi2sTMwpPp4i6WYFjan
Diffstat (limited to 'src/command.c')
0 files changed, 0 insertions, 0 deletions