Safer pseudo-legal move validation for drops
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 21 Mar 2020 17:13:29 +0000 (18:13 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 21 Mar 2020 17:13:29 +0000 (18:13 +0100)
crazyhouse STC
LLR: 2.96 (-2.94,2.94) [-10.00,5.00]
Total: 6452 W: 3127 L: 3107 D: 218
http://www.variantfishtest.org:6543/tests/view/5e6a9cae6e23db46beba4f9a

crazyhouse LTC
LLR: 2.99 (-2.94,2.94) [-10.00,5.00]
Total: 5895 W: 2831 L: 2807 D: 257
http://www.variantfishtest.org:6543/tests/view/5e6b45b36e23db46beba4f9d

src/position.cpp

index 0596378..08d1336 100644 (file)
@@ -938,6 +938,8 @@ bool Position::pseudo_legal(const Move m) const {
   // Use a fast check for piece drops
   if (type_of(m) == DROP)
       return   piece_drops()
+            && pc != NO_PIECE
+            && color_of(pc) == us
             && count_in_hand(us, in_hand_piece_type(m))
             && (drop_region(us, type_of(pc)) & ~pieces() & to)
             && (   type_of(pc) == in_hand_piece_type(m)