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:
parent
9f0485e343
commit
de2ba70830
1 changed files with 6 additions and 9 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue