[Board] Move DefinedBoards to BitBoard
This commit is contained in:
18
BitBoard.h
18
BitBoard.h
@@ -3,9 +3,27 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#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 {
|
class BitBoard final {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using U64 = uint64_t;
|
using U64 = uint64_t;
|
||||||
|
|
||||||
BitBoard(U64 v = 0);
|
BitBoard(U64 v = 0);
|
||||||
|
15
Board.hpp
15
Board.hpp
@@ -44,21 +44,6 @@ private:
|
|||||||
CastlingRights mCR = CastlingRights::None;
|
CastlingRights mCR = CastlingRights::None;
|
||||||
std::optional<Square> mEPS;
|
std::optional<Square> 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);
|
void handleCastlingRights(const Piece &piece, const BitBoard &bb);
|
||||||
// Check if the move is castling without checking the rights or validity.
|
// Check if the move is castling without checking the rights or validity.
|
||||||
static bool isMoveCastling(const BitBoard &from, const BitBoard &to, const Piece &piece);
|
static bool isMoveCastling(const BitBoard &from, const BitBoard &to, const Piece &piece);
|
||||||
|
Reference in New Issue
Block a user