Skip to content

V3#123

Draft
CorentinGS wants to merge 83 commits into
mainfrom
v3
Draft

V3#123
CorentinGS wants to merge 83 commits into
mainfrom
v3

Conversation

@CorentinGS

Copy link
Copy Markdown
Owner

No description provided.

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant