Skip to content

Commit

Permalink
Simplify Bitboards::pretty
Browse files Browse the repository at this point in the history
No functional change.
  • Loading branch information
mcostalba committed Mar 1, 2014
1 parent 9f0485e commit de2ba70
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/bitboard.cpp
Expand Up @@ -18,8 +18,7 @@
*/

#include <algorithm>
#include <cstring>
#include <sstream>
#include <cstring> // For memset

#include "bitboard.h"
#include "bitcount.h"
Expand Down Expand Up @@ -130,19 +129,17 @@ Square msb(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)
{
ss << "+---+---+---+---+---+---+---+---+" << '\n';

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;
}


Expand Down

0 comments on commit de2ba70

Please sign in to comment.