X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.cpp;h=84405411555430c30eb091f5a6243d611fb1a65a;hp=a6502330ab7b23105c4ba917f5e502f91a712d68;hb=f99cb3dc27719021e126690b7fd5aa5f43663ed8;hpb=034a2b04f2fc1017721b4f3fc12895e5f8a190bd diff --git a/src/bitboard.cpp b/src/bitboard.cpp index a6502330..84405411 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -19,11 +19,10 @@ #include #include -#include +#include #include "bitboard.h" #include "bitcount.h" -#include "misc.h" #include "rkiss.h" CACHE_LINE_ALIGNMENT @@ -126,23 +125,24 @@ Square msb(Bitboard b) { #endif // ifndef USE_BSFQ -/// Bitboards::print() prints a bitboard in an easily readable format to the -/// standard output. This is sometimes useful for debugging. +/// Bitboards::pretty() returns an ASCII representation of a bitboard to be +/// printed to standard output. This is sometimes useful for debugging. -void Bitboards::print(Bitboard b) { +const std::string Bitboards::pretty(Bitboard b) { - sync_cout; + std::ostringstream ss; for (Rank rank = RANK_8; rank >= RANK_1; --rank) { - std::cout << "+---+---+---+---+---+---+---+---+" << '\n'; + ss << "+---+---+---+---+---+---+---+---+" << '\n'; for (File file = FILE_A; file <= FILE_H; ++file) - std::cout << "| " << (b & (file | rank) ? "X " : " "); + ss << "| " << (b & (file | rank) ? "X " : " "); - std::cout << "|\n"; + ss << "|\n"; } - std::cout << "+---+---+---+---+---+---+---+---+" << sync_endl; + ss << "+---+---+---+---+---+---+---+---+"; + return ss.str(); }