]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Add list of legal moves to Position::pretty()
[stockfish] / src / position.cpp
index de5d04c13ac8982368fcd10edf0eab96168058ec..c814e7657a7e8505d557ff77c673e03889d580c4 100644 (file)
@@ -407,14 +407,15 @@ const string Position::pretty(Move move) const {
       if (piece_on(sq) != NO_PIECE)
           brd[513 - 68*rank_of(sq) + 4*file_of(sq)] = PieceToChar[piece_on(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: " << st->key;
+  ss << brd << "\nFen: " << fen() << "\nKey: " << st->key << "\nCheckers: ";
+
+  for (Bitboard b = checkers(); b; )
+      ss << square_to_string(pop_lsb(&b)) << " ";
+
+  ss << "\nLegal moves: ";
+  for (MoveList<LEGAL> ml(*this); !ml.end(); ++ml)
+      ss << move_to_san(*const_cast<Position*>(this), ml.move()) << " ";
 
 
-  if (checkers())
-  {
-      ss << "\nCheckers: ";
-      for (Bitboard b = checkers(); b; )
-          ss << square_to_string(pop_lsb(&b)) << " ";
-  }
   return ss.str();
 }
 
   return ss.str();
 }