From defd74fb634500c113ed59c3f09dca7e0f6a8b5b Mon Sep 17 00:00:00 2001 From: Arthur Bols Date: Thu, 22 Dec 2022 10:34:07 +0100 Subject: [PATCH] [Board] Move DefinedBoards to BitBoard --- BitBoard.h | 18 ++++++++++++++++++ Board.hpp | 15 --------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/BitBoard.h b/BitBoard.h index 4679fe2..e69089e 100644 --- a/BitBoard.h +++ b/BitBoard.h @@ -3,9 +3,27 @@ #include #include +#include "Square.hpp" + +enum DefinedBoards : uint64_t { + AFile = 0x0101010101010101, + BFile = AFile << 1, + CFile = AFile << 2, + DFile = AFile << 3, + EFile = AFile << 4, + FFile = AFile << 5, + GFile = AFile << 6, + HFile = AFile << 7, + WhiteCastlingRank = (1ULL << A2) - 1, + BlackCastlingRank = (~1ULL << H7), + CastlingRanks = WhiteCastlingRank | BlackCastlingRank, + CastlingSquares = (WhiteCastlingRank | BlackCastlingRank) & (CFile | GFile), +}; class BitBoard final { + public: + using U64 = uint64_t; BitBoard(U64 v = 0); diff --git a/Board.hpp b/Board.hpp index 085c37a..ee9dccb 100644 --- a/Board.hpp +++ b/Board.hpp @@ -44,21 +44,6 @@ private: CastlingRights mCR = CastlingRights::None; std::optional mEPS; - enum DefinedBoards : uint64_t { - AFile = 0x0101010101010101, - BFile = AFile << 1, - CFile = AFile << 2, - DFile = AFile << 3, - EFile = AFile << 4, - FFile = AFile << 5, - GFile = AFile << 6, - HFile = AFile << 7, - WhiteCastlingRank = (1ULL << A2) - 1, - BlackCastlingRank = (~1ULL << H7), - CastlingRanks = WhiteCastlingRank | BlackCastlingRank, - CastlingSquares = (WhiteCastlingRank | BlackCastlingRank) & (CFile | GFile), - }; - void handleCastlingRights(const Piece &piece, const BitBoard &bb); // Check if the move is castling without checking the rights or validity. static bool isMoveCastling(const BitBoard &from, const BitBoard &to, const Piece &piece);