V3#123
Draft
CorentinGS wants to merge 83 commits into
Draft
Conversation
Introduce MoveTree as the first-class game tree owner for root/current cursor state, traversal, variation enumeration, cloning, and line splitting. Keep active move insertion routed through Game so legality checks, terminal guards, and outcome evaluation remain authoritative. Update PGN parsing/rendering, opening callers, tests, README, package docs, and migration notes for MoveTree access and the new move insertion return signatures.
Carve the 1279-line engine.go into:
movegen.go (309 lines) - move generation orchestration
calcMoves, unsafeMoves, status, hasLegalMove, hasStandardMove,
visitLegalMoves, visitStandardMoves, moveMatchesMode,
legalMoveContext + methods, standardMoves, movePool,
promoPieceTypes, maxPossibleMoves, moveGenerationMode
attacks.go (164 lines) - attack detection
isInCheck, isSquareAttackedBy, squaresAreAttacked,
pinnedRayForPiece, pawnCheckers, pawnAttacks,
sliderBitboards, squaresAligned
movetags.go (116 lines) - move tag computation
moveTags, moveTagsForMode, moveTagsForPiece,
requiresOwnKingCheckSimulation, moveFromAlignedWithOwnKing,
exposesOwnKingToSlider
castling.go (66 lines) - castling
hasCastleMove, castleMovesInto
magic.go (243 lines) - magic bitboards
diaAttack, slowDiaAttack, hvAttack, slowHVAttack,
initMagicAttack*, magicOccupancies, rookMagicMask,
bishopMagicMask, rookMagics, bishopMagics, attack tables
patterns.go (355 lines) - piece patterns, geometry, init orchestrator
bbForPossibleMoves, pawnMoves, geometry helpers
(rayStep, squaresBetween, squareFromBit, etc.),
static pattern tables (bbKnightMoves, bbKingMoves, ...),
sliding-attack tables and their init functions,
master init() orchestrating all table population
No public API change. The master init() lives in patterns.go and calls
the per-table init functions in patterns.go and magic.go. Files form
a clean DAG with no cycles:
movegen.go -> attacks.go -> patterns.go -> magic.go
-> movetags.go
-> castling.go -> attacks.go
-> patterns.go -> magic.go
Each new file passes go vet and go build independently because the
package boundary is unchanged. The split is individually reversible
(folding any single file back into engine.go would still compile).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.