From f78b68b7ffd05888bd663acdf400276913126cd5 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Thu, 27 Dec 2012 11:08:20 +0100 Subject: [PATCH] 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. --- src/position.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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(); } -- 2.39.2