1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

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.
This commit is contained in:
Marco Costalba 2012-12-27 11:08:20 +01:00
parent e9ab7353de
commit f78b68b7ff

View 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)];
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();
}