Simplified PrintBoard function

This commit is contained in:
rektdie authored and GitHub committed 2024-02-27 09:14:30 +01:00
1 parent e46c9bb21f
commit 1cc466c09c
1 file changed
+8 -8
+8 -8
View File
@@ -3,19 +3,19 @@
#include <bitset> #include <bitset>
void Bitboard::PrintBoard() const { void Bitboard::PrintBoard() const {
Bitboard mask = 0xff00000000000000; for (int rank = 7; rank >= 0; rank--) {
for (int i = 0; i < 8; i++) {
std::bitset<8> currentRank = ((this->m_board & mask.m_board) >> (7 - i) * 8);
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+\n";
std::cout << "| "; std::cout << "| ";
for (int j = 0; j < 8; j++) {
std::cout << currentRank[j] << " | "; for (int file = 0; file < 8; file++) {
int square = rank * 8 + file;
std::cout << IsSet << " | ";
} }
std::cout << ' ' << 8 - i << '\n'; std::cout << ' ' << rank + 1<< '\n';
mask.m_board = (mask.m_board >> 8);
} }
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+\n";
std::cout << " a b c d e f g h\n\n"; std::cout << " a b c d e f g h\n\n";
} }