1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 17:19:36 +00:00

Simplify Bitboards::pretty

No functional change.
This commit is contained in:
Marco Costalba 2014-03-01 13:05:55 +01:00
parent 9f0485e343
commit de2ba70830

View file

@ -18,8 +18,7 @@
*/ */
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring> // For memset
#include <sstream>
#include "bitboard.h" #include "bitboard.h"
#include "bitcount.h" #include "bitcount.h"
@ -130,19 +129,17 @@ Square msb(Bitboard b) {
const std::string Bitboards::pretty(Bitboard b) { const std::string Bitboards::pretty(Bitboard b) {
std::ostringstream ss; std::string s = "+---+---+---+---+---+---+---+---+\n";
for (Rank rank = RANK_8; rank >= RANK_1; --rank) for (Rank rank = RANK_8; rank >= RANK_1; --rank)
{ {
ss << "+---+---+---+---+---+---+---+---+" << '\n';
for (File file = FILE_A; file <= FILE_H; ++file) for (File file = FILE_A; file <= FILE_H; ++file)
ss << "| " << (b & (file | rank) ? "X " : " "); s.append(b & (file | rank) ? "| X " : "| ");
ss << "|\n"; s.append("|\n+---+---+---+---+---+---+---+---+\n");
} }
ss << "+---+---+---+---+---+---+---+---+";
return ss.str(); return s;
} }