]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Simplify a condition in gives_check()
[stockfish] / src / position.cpp
index ca7c460047bdd16716584916bbe4bd3abfcfe804..2f3c62f552ac8fec90ef1e1bb3fa1d8f7600702e 100644 (file)
@@ -21,7 +21,6 @@
 #include <cassert>
 #include <cstring>
 #include <iomanip>
-#include <iostream>
 #include <sstream>
 
 #include "bitcount.h"
@@ -34,8 +33,6 @@
 #include "tt.h"
 
 using std::string;
-using std::cout;
-using std::endl;
 
 static const string PieceToChar(" PNBRQK  pnbrqk");
 
@@ -636,14 +633,11 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const {
   if (ci.checkSq[pt] & to)
       return true;
 
-  // Discovery check ?
-  if (unlikely(ci.dcCandidates) && (ci.dcCandidates & from))
-  {
-      // For pawn and king moves we need to verify also direction
-      if (   (pt != PAWN && pt != KING)
-          || !aligned(from, to, king_square(~sideToMove)))
-          return true;
-  }
+  // Discovered check ?
+  if (   unlikely(ci.dcCandidates)
+      && (ci.dcCandidates & from)
+      && !aligned(from, to, king_square(~sideToMove)))
+      return true;
 
   // Can we skip the ugly special cases ?
   if (type_of(m) == NORMAL)