]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Make key_after() more consistent with key()
[stockfish] / src / position.cpp
index 08ed1a89e1578f8202392c4bbf61daa8653fcda9..62e6e2387cb657a58976ce52a4faa9be16db1ff1 100644 (file)
@@ -1054,7 +1054,10 @@ Key Position::key_after(Move m) const {
   if (captured)
       k ^= Zobrist::psq[captured][to];
 
-  return k ^ Zobrist::psq[pc][to] ^ Zobrist::psq[pc][from];
+  k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[pc][from];
+
+  return (captured || type_of(pc) == PAWN)
+      ? k : adjust_key50<true>(k);
 }