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
+15 -15
+15 -15
View File
@@ -3,20 +3,20 @@
#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::cout << "+---+---+---+---+---+---+---+---+\n";
std::bitset<8> currentRank = ((this->m_board & mask.m_board) >> (7 - i) * 8); std::cout << "| ";
std::cout << "+---+---+---+---+---+---+---+---+\n"; for (int file = 0; file < 8; file++) {
std::cout << "| "; int square = rank * 8 + file;
for (int j = 0; j < 8; j++) {
std::cout << currentRank[j] << " | "; 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";
} }
@@ -60,4 +60,4 @@ Bitboard Bitboard::operator>>(int other) {
Bitboard Bitboard::operator~() { Bitboard Bitboard::operator~() {
return ~(this->m_board); return ~(this->m_board);
} }