Repository navigation
♻️ move board-only predicates to Board - #93
Merged
Merged
Conversation
Part 2 of p-chess#91 - Move Chess::attacked() to Board::isAttacked() - Move Chess::insufficientMaterial() logic to Board::hasInsufficientMaterial() - Keep Chess::attacked() and Chess::insufficientMaterial() as wrappers for BC - Call Board::isAttacked() directly in move generation and check detection - Rewrite AttackTest against the public API, drop attackedPublic() from ChessPublicator - Add negative insufficient material cases Perft counts unchanged. Throughput ~12% up, from direct square access.
There was a problem hiding this comment.
🟢 Approval recommended
The extraction preserves behavior, compatibility wrappers, and relevant test coverage.
0 open findings
What changed in this PR
Moves board-only chess predicates into Board while retaining compatibility wrappers in Chess.
Changes:
- Adds board-level attack and insufficient-material detection.
- Updates internal callers, tests, and documentation.
- Raises PHPStan’s memory limit.
| File | Description |
|---|---|
src/Board.php |
Adds board predicates. |
src/Chess.php |
Delegates predicates to Board. |
tests/AttackTest.php |
Tests the public board API and edge cases. |
tests/ChessPublicator.php |
Removes the obsolete attack proxy. |
docs/board.md |
Documents new methods. |
Makefile |
Removes PHPStan’s memory limit. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Part 2 of #91
Perft counts unchanged. Throughput ~12% up, from direct square access.