From e9ab7353de074a0a970d334ac98b391e2222f77d Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Wed, 26 Dec 2012 18:22:56 +0100 Subject: [PATCH 1/1] Add checkers info to Position::pretty() In case current position is under check, list the squares of the checker(s) pieces. This should satisfy a specific user request. No functional change. --- src/position.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index e69528ad..de5d04c1 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -400,14 +400,21 @@ const string Position::pretty(Move move) const { std::ostringstream ss; if (move) - ss << "\nMove is: " << (sideToMove == BLACK ? ".." : "") + ss << "\nMove: " << (sideToMove == BLACK ? ".." : "") << move_to_san(*const_cast(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 is: " << fen() << "\nKey is: " << st->key; + ss << brd << "\nFen: " << fen() << "\nKey: " << st->key; + + if (checkers()) + { + ss << "\nCheckers: "; + for (Bitboard b = checkers(); b; ) + ss << square_to_string(pop_lsb(&b)) << " "; + } return ss.str(); } -- 2.39.2