]> git.sesse.net Git - stockfish/commitdiff
Tidy up Position::pretty
authorMarco Costalba <mcostalba@gmail.com>
Mon, 29 Jul 2013 17:33:30 +0000 (19:33 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 29 Jul 2013 17:33:30 +0000 (19:33 +0200)
No functional change.

src/position.cpp

index 60d619bed4e0636a34b27cb93321dd446a9d6bfc..5dc94a634d665b08e878931ac1b7bb38389da8fa 100644 (file)
@@ -392,16 +392,18 @@ const string Position::pretty(Move move) const {
 
   string brd = twoRows + twoRows + twoRows + twoRows + dottedLine;
 
 
   string brd = twoRows + twoRows + twoRows + twoRows + dottedLine;
 
+  for (Bitboard b = pieces(); b; )
+  {
+      Square s = pop_lsb(&b);
+      brd[513 - 68 * rank_of(s) + 4 * file_of(s)] = PieceToChar[piece_on(s)];
+  }
+
   std::ostringstream ss;
 
   if (move)
       ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
          << move_to_san(*const_cast<Position*>(this), move);
 
   std::ostringstream ss;
 
   if (move)
       ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
          << move_to_san(*const_cast<Position*>(this), move);
 
-  for (Square sq = SQ_A1; sq <= SQ_H8; sq++)
-      if (piece_on(sq) != NO_PIECE)
-          brd[513 - 68*rank_of(sq) + 4*file_of(sq)] = PieceToChar[piece_on(sq)];
-
   ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
      << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
 
   ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
      << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";