From: Marco Costalba Date: Thu, 27 Dec 2012 10:08:20 +0000 (+0100) Subject: Add list of legal moves to Position::pretty() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=f78b68b7ffd05888bd663acdf400276913126cd5;hp=e9ab7353de074a0a970d334ac98b391e2222f77d Add list of legal moves to Position::pretty() Along the same lines of previous patch now we add the list of the legal moves in the given position. No functional change. --- diff --git a/src/position.cpp b/src/position.cpp index de5d04c1..c814e765 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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)]; - 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 ml(*this); !ml.end(); ++ml) + ss << move_to_san(*const_cast(this), ml.move()) << " "; - if (checkers()) - { - ss << "\nCheckers: "; - for (Bitboard b = checkers(); b; ) - ss << square_to_string(pop_lsb(&b)) << " "; - } return ss.str(); }