Fix en passant square not set by Board::apply_move after double pawn push#165
Merged
chase-manning merged 5 commits intomainfrom Feb 22, 2026
Merged
Fix en passant square not set by Board::apply_move after double pawn push#165chase-manning merged 5 commits intomainfrom
chase-manning merged 5 commits intomainfrom
Conversation
Always set the en passant square in board state after a double pawn push (per FEN standard), but only include it in the zobrist hash when an opponent pawn can actually capture en passant (for correct threefold repetition detection per FIDE rules). Co-authored-by: chase-manning <53957795+chase-manning@users.noreply.github.com>
Co-authored-by: chase-manning <53957795+chase-manning@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix en passant flag not set by Board::apply_move
Fix en passant square not set by Board::apply_move after double pawn push
Feb 22, 2026
Contributor
|
@copilot CI is failing |
Contributor
Author
The CI failures are all pre-existing issues unrelated to this PR:
I verified by checking that the same errors exist on the base branch ( |
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.
Board::apply_moveonly set the EP square when an opponent pawn could actually capture en passant. The FEN standard requires it to be set after any double pawn push unconditionally.Changes
board/mod.rs–apply_move_pft_chk: Always setep_squareafter double pawn push. Zobrist XOR remains conditional on capture possibility to preserve correct threefold repetition detection (FIDE: positions match iff possible moves match).board/mod.rs– EP hash XOR-out: Made removal of previous EP from zobrist conditional with the same capture-possibility check, maintaining symmetry with XOR-in.board/mod.rs–apply_null_move: Same conditional EP hash treatment.board/board_state.rs–set_zob_hash: Conditional EP hash when computing from scratch (e.g.from_fen), ensuring board→FEN→board round-trips produce identical zobrist hashes.tests/board_move_apply.rs: Added regression test from the issue.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.