From: Fabian Fichter Date: Thu, 31 Jan 2019 20:14:47 +0000 (+0100) Subject: Speed-up pseudo-legal move validation of drops X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=0e7e3b244a33aa19e215e115249b20976db42a62;p=fairystockfish.git Speed-up pseudo-legal move validation of drops Improves performance by ~10% for drop variants. --- diff --git a/src/position.cpp b/src/position.cpp index ee5b2f1..f7860fe 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -831,6 +831,14 @@ bool Position::pseudo_legal(const Move m) const { Square to = to_sq(m); Piece pc = moved_piece(m); + // Use a fast check for piece drops + if (type_of(m) == DROP) + return piece_drops() + && count_in_hand(us, type_of(pc)) + && (drop_region(us, type_of(pc)) & ~pieces() & to) + && ( type_of(pc) == in_hand_piece_type(m) + || (drop_promoted() && promoted_piece_type(type_of(pc)) == in_hand_piece_type(m))); + // Use a slower but simpler function for uncommon cases if (type_of(m) != NORMAL) return MoveList(*this).contains(m);