Files
cpl_cpp-project/BitBoard.cpp
2022-12-22 00:52:35 +01:00

26 lines
622 B
C++

#include "BitBoard.h"
BitBoard::BitBoard(uint64_t v) {
mBoard = v;
}
std::ostream &operator<<(std::ostream &os, const BitBoard &board) {
// For debugging only, performance isn't important
for (int i = 7; i >= 0; i--) {
int rank = i * 8;
for (int j = 0; j < 8; j++) {
// Get the piece for this index. Assume it exists.
// Print piece, otherwise '.';
if (board.mBoard & (1ULL << (rank + j))) {
os << 1;
} else {
os << '.';
}
os << ' ';
}
os << '\n';
}
return os;
}