Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priority drops #805

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

inversed-ru
Copy link

Implementation of priority drops, a feature I needed for my chess variant. Pieces from priorityDropTypes must be dropped before dropping any other pieces. In my variant, I use this feature to control the early game setup, even though I don't technically impose a separate setup phase: stronger pieces can be dropped only after all the weaker ones have been dropped.

@ianfab ianfab added enhancement New feature or request and removed enhancement New feature or request labels Jul 4, 2024
@@ -1086,6 +1086,8 @@ bool Position::legal(Move m) const {
if (popcount((DarkSquares & to ? DarkSquares : ~DarkSquares) & pieces(us, BISHOP)) + 1 > (count_with_hand(us, BISHOP) + 1) / 2)
return false;
}
if (type_of(m) == DROP && (!var->isPriorityDrop[type_of(moved_piece(m))]) && priorityDropCountInHand[us] > 0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For efficiency, I think these two new conditions should be checked in reverse order.

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.

None yet

3 participants