mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08: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:
@@ -407,14 +407,15 @@ const string Position::pretty(Move move) const {
|
|||||||
if (piece_on(sq) != NO_PIECE)
|
if (piece_on(sq) != NO_PIECE)
|
||||||
brd[513 - 68*rank_of(sq) + 4*file_of(sq)] = PieceToChar[piece_on(sq)];
|
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: ";
|
||||||
|
|
||||||
if (checkers())
|
|
||||||
{
|
|
||||||
ss << "\nCheckers: ";
|
|
||||||
for (Bitboard b = checkers(); b; )
|
for (Bitboard b = checkers(); b; )
|
||||||
ss << square_to_string(pop_lsb(&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()) << " ";
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user