-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
base: master
Are you sure you want to change the base?
Priority drops #805
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is fairly trivial logic and does not depend on other moves, it should be more suitable to validate this in move generation and pseudo-legal validation instead of in legal validation. |
||
return false; | ||
|
||
// No legal moves from target square | ||
if (immobility_illegal() && (type_of(m) == DROP || type_of(m) == NORMAL) && !(PseudoMoves[0][us][type_of(moved_piece(m))][to] & board_bb())) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ struct Variant { | |
bool mustCapture = false; | ||
bool mustDrop = false; | ||
PieceType mustDropType = ALL_PIECES; | ||
bool isPriorityDrop[PIECE_TYPE_NB] = {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more consistent and storage efficient to use a |
||
bool pieceDrops = false; | ||
bool dropLoop = false; | ||
bool capturesToHand = false; | ||
|
There was a problem hiding this comment.
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.