bb: Implement Bitboards::pretty()

This commit is contained in:
Calcitem 2020-12-28 09:29:15 +08:00
parent 460aec58fe
commit 632bfc36ad
1 changed files with 4 additions and 4 deletions

View File

@ -29,18 +29,18 @@ Bitboard SquareBB[SQ_32];
Bitboard StarSquareBB9;
Bitboard StarSquareBB12;
/// Bitboards::pretty() returns an ASCII representation of a bitboard suitable
/// to be printed to standard output. Useful for debugging.
// TODO: Pretty
const std::string Bitboards::pretty(Bitboard b)
{
std::string str = "+---+---+---+---+---+---+---+---+\n";
for (File file = FILE_A; file <= FILE_C; ++file) {
for (Rank rank = RANK_1; rank <= RANK_8; ++rank) {
for (Rank rank = RANK_1; rank <= RANK_8; rank = (Rank)(rank + 1)) {
for (File file = FILE_A; file <= FILE_C; file = (File)(file + 1))
str += b & make_square(file, rank) ? "| X " : "| ";
}
str += "|\n+---+---+---+---+---+---+---+---+\n";
}