Refactor BitBoard

This commit is contained in:
2022-12-22 00:15:13 +01:00
parent 11c84472d4
commit d54ffbc7fa
5 changed files with 249 additions and 24 deletions

View File

@@ -196,25 +196,7 @@ bool Board::isMoveCastling(const BitBoard &from, const BitBoard &to, const Piece
return (from & indexToBitBoard(E1));
}
return (from & indexToBitBoard(E8));
}
void Board::printBitBoard(const Board::BitBoard &bb) {
// 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 (bb & (1ULL << (rank + j))) {
std::cout << 1;
} else {
std::cout << '.';
}
std::cout << ' ';
}
std::cout << '\n';
}
return from & indexToBitBoard(E8);
}
std::ostream &operator<<(std::ostream &os, const Board &board) {