]> git.sesse.net Git - stockfish/commitdiff
Do not pass pinned argument in Position::move_is_check()
authorMarco Costalba <mcostalba@gmail.com>
Thu, 19 Feb 2009 16:01:08 +0000 (17:01 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 19 Feb 2009 16:01:08 +0000 (17:01 +0100)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp
src/position.h
src/search.cpp

index 3bb8fef931c00924a9aa52cf3823fdecda4a73f6..6d4e66cab6c4ddd2eee1e002e1864a0a84ade466 100644 (file)
@@ -536,29 +536,19 @@ bool Position::pl_move_is_legal(Move m) const {
 }
 
 
 }
 
 
-/// Position::move_is_check() tests whether a pseudo-legal move is a check.
-/// There are two versions of this function:  One which takes only a move as
-/// input, and one which takes a move and a bitboard of discovered check
-/// candidates.  The latter function is faster, and should always be preferred
-/// when a discovered check candidates bitboard has already been computed.
+/// Position::move_is_check() tests whether a pseudo-legal move is a check
 
 bool Position::move_is_check(Move m) const {
 
 
 bool Position::move_is_check(Move m) const {
 
-  Bitboard dc = discovered_check_candidates(side_to_move());
-  return move_is_check(m, dc);
-}
-
-bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
-
   assert(is_ok());
   assert(move_is_ok(m));
   assert(is_ok());
   assert(move_is_ok(m));
-  assert(dcCandidates == discovered_check_candidates(side_to_move()));
 
   Color us = side_to_move();
   Color them = opposite_color(us);
   Square from = move_from(m);
   Square to = move_to(m);
   Square ksq = king_square(them);
 
   Color us = side_to_move();
   Color them = opposite_color(us);
   Square from = move_from(m);
   Square to = move_to(m);
   Square ksq = king_square(them);
+  Bitboard dcCandidates = discovered_check_candidates(us);
 
   assert(color_of_piece_on(from) == us);
   assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
 
   assert(color_of_piece_on(from) == us);
   assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
index 1e7dc9926ba24eb80e67c182bd5678ad710de89a..b526bfe7e6e39c039f0b95d93f365b651057492c 100644 (file)
@@ -221,7 +221,6 @@ public:
   // Properties of moves
   bool pl_move_is_legal(Move m) const;
   bool move_is_check(Move m) const;
   // Properties of moves
   bool pl_move_is_legal(Move m) const;
   bool move_is_check(Move m) const;
-  bool move_is_check(Move m, Bitboard dcCandidates) const;
   bool move_is_capture(Move m) const;
   bool move_is_deep_pawn_push(Move m) const;
   bool move_is_pawn_push_to_7th(Move m) const;
   bool move_is_capture(Move m) const;
   bool move_is_deep_pawn_push(Move m) const;
   bool move_is_pawn_push_to_7th(Move m) const;
index c93780b37db7d8f4288f65e73372251b43ad746c..d54087b966e35c5ef09a131f48e3932d8657d12e 100644 (file)
@@ -996,7 +996,7 @@ namespace {
       assert(move_is_ok(move));
 
       bool singleReply = (isCheck && mp.number_of_moves() == 1);
       assert(move_is_ok(move));
 
       bool singleReply = (isCheck && mp.number_of_moves() == 1);
-      bool moveIsCheck = pos.move_is_check(move, dcCandidates);
+      bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
 
       movesSearched[moveCount++] = ss[ply].currentMove = move;
       bool moveIsCapture = pos.move_is_capture(move);
 
       movesSearched[moveCount++] = ss[ply].currentMove = move;
@@ -1298,7 +1298,7 @@ namespace {
       assert(move_is_ok(move));
 
       bool singleReply = (isCheck && mp.number_of_moves() == 1);
       assert(move_is_ok(move));
 
       bool singleReply = (isCheck && mp.number_of_moves() == 1);
-      bool moveIsCheck = pos.move_is_check(move, dcCandidates);
+      bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
 
       movesSearched[moveCount++] = ss[ply].currentMove = move;
       bool moveIsCapture = pos.move_is_capture(move);
 
       movesSearched[moveCount++] = ss[ply].currentMove = move;
@@ -1489,7 +1489,7 @@ namespace {
           && !isCheck
           && !pvNode
           && !move_promotion(move)
           && !isCheck
           && !pvNode
           && !move_promotion(move)
-          && !pos.move_is_check(move, dcCandidates)
+          && !pos.move_is_check(move)
           && !pos.move_is_passed_pawn_push(move))
       {
           Value futilityValue = staticValue
           && !pos.move_is_passed_pawn_push(move))
       {
           Value futilityValue = staticValue
@@ -1583,8 +1583,9 @@ namespace {
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
       assert(move_is_ok(move));
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
       assert(move_is_ok(move));
+      assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
 
 
-      bool moveIsCheck = pos.move_is_check(move, sp->dcCandidates);
+      bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
 
       lock_grab(&(sp->lock));
       bool moveIsCapture = pos.move_is_capture(move);
 
       lock_grab(&(sp->lock));
@@ -1694,7 +1695,9 @@ namespace {
            && !thread_should_stop(threadID)
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
            && !thread_should_stop(threadID)
            && (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
     {
-      bool moveIsCheck = pos.move_is_check(move, sp->dcCandidates);
+      assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
+
+      bool moveIsCheck = pos.move_is_check(move);
       bool moveIsCapture = pos.move_is_capture(move);
 
       assert(move_is_ok(move));
       bool moveIsCapture = pos.move_is_capture(move);
 
       assert(move_is_ok(move));