]> git.sesse.net Git - stockfish/commitdiff
Triviality in position.cpp
authorMarco Costalba <mcostalba@gmail.com>
Thu, 24 Mar 2011 09:05:14 +0000 (10:05 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 24 Mar 2011 12:21:47 +0000 (13:21 +0100)
No functional change.

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

index 8b6bafe31ad309cd8c42211098dc7ed227754ed6..8667d44bfce718500aadc73cd16fe8db34d72763 100644 (file)
@@ -1712,7 +1712,7 @@ bool Position::has_mate_threat() {
   // Loop through the moves, and see if one of them gives mate
   Bitboard pinned = pinned_pieces(sideToMove);
   CheckInfo ci(*this);
-  for (cur = mlist; cur != last && !mateFound; cur++)
+  for (cur = mlist; !mateFound && cur != last; cur++)
   {
       Move move = cur->move;
       if (   !pl_move_is_legal(move, pinned)
@@ -1720,10 +1720,7 @@ bool Position::has_mate_threat() {
           continue;
 
       do_move(move, st2, ci, true);
-
-      if (is_mate())
-          mateFound = true;
-
+      mateFound = is_mate();
       undo_move(move);
   }
 
@@ -1975,7 +1972,6 @@ bool Position::is_ok(int* failedStep) const {
 
   if (failedStep) (*failedStep)++;
   if (debugPieceList)
-  {
       for (Color c = WHITE; c <= BLACK; c++)
           for (PieceType pt = PAWN; pt <= KING; pt++)
               for (int i = 0; i < pieceCount[c][pt]; i++)
@@ -1986,13 +1982,15 @@ bool Position::is_ok(int* failedStep) const {
                   if (index[piece_list(c, pt, i)] != i)
                       return false;
               }
-  }
 
   if (failedStep) (*failedStep)++;
-  if (debugCastleSquares) {
-      for (Color c = WHITE; c <= BLACK; c++) {
+  if (debugCastleSquares)
+  {
+      for (Color c = WHITE; c <= BLACK; c++)
+      {
           if (can_castle_kingside(c) && piece_on(initial_kr_square(c)) != make_piece(c, ROOK))
               return false;
+
           if (can_castle_queenside(c) && piece_on(initial_qr_square(c)) != make_piece(c, ROOK))
               return false;
       }