Skip to content

Simplify Evasion Logic#6902

Open
FauziAkram wants to merge 1 commit into
official-stockfish:masterfrom
FauziAkram:wild85PR
Open

Simplify Evasion Logic#6902
FauziAkram wants to merge 1 commit into
official-stockfish:masterfrom
FauziAkram:wild85PR

Conversation

@FauziAkram

Copy link
Copy Markdown
Contributor

Simplify Evasion Logic
When the king is in check, a pseudo-legal move must be a valid evasion. Instead of duplicating the checking rules for king and non-king moves, we can leverage the existing MoveList class.

Passed non-reg STC:
LLR: 2.98 (-2.94,2.94) <-1.75,0.25>
Total: 187360 W: 47579 L: 47524 D: 92257
Ptnml(0-2): 418, 20266, 52263, 20309, 424
https://tests.stockfishchess.org/tests/view/6a28aa5b7c758d82accea13c

No functional change

No functional change
@github-actions

Copy link
Copy Markdown

(execution 27421468179 / attempt 1)

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc1be0ac-57d1-45fc-9655-ce52dcdbb5f6

📥 Commits

Reviewing files that changed from the base of the PR and between 86f1df7 and 684d921.

📒 Files selected for processing (1)
  • src/position.cpp

📝 Walkthrough

Walkthrough

The PR simplifies Position::pseudo_legal by refactoring how it validates moves when the position is under check. Instead of performing manual evasion filtering inline—which included special handling for double check, king moves, and validating interpositions or captures—the function now delegates the entire check to MoveList<EVASIONS>(*this).contains(m). This replaces approximately 19 lines of custom evasion logic with a single delegation call.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants