diff --git a/src/bitboard.cpp b/src/bitboard.cpp index cd4bf920..1cad9eec 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -28,6 +28,9 @@ uint8_t SquareDistance[SQ_32][SQ_32]; Bitboard SquareBB[SQ_32]; Bitboard LineBB[EFFECTIVE_SQUARE_NB][SQ_32]; +Bitboard StarSquare9BB; +Bitboard StarSquare12BB; + /// Bitboards::pretty() returns an ASCII representation of a bitboard suitable /// to be printed to standard output. Useful for debugging. @@ -59,6 +62,9 @@ void Bitboards::init() for (Square s = SQ_BEGIN; s < SQ_END; ++s) SquareBB[s] = (1UL << s); + StarSquare9BB = square_bb(SQ_16) | square_bb(SQ_18) | square_bb(SQ_20) | square_bb(SQ_22); + StarSquare12BB = square_bb(SQ_17) | square_bb(SQ_19) | square_bb(SQ_21) | square_bb(SQ_23); + for (Square s1 = SQ_A1; s1 <= SQ_C8; ++s1) for (Square s2 = SQ_A1; s2 <= SQ_C8; ++s2) SquareDistance[s1][s2] = std::max(distance<File>(s1, s2), distance<Rank>(s1, s2)); diff --git a/src/bitboard.h b/src/bitboard.h index 1525bc18..875c7e75 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -35,7 +35,6 @@ const std::string pretty(Bitboard b); } constexpr Bitboard AllSquares = ~Bitboard(0); -//constexpr Bitboard starSquares12 = 0xAA55AA55AA55AA55UL; // TODO constexpr Bitboard FileABB = 0x0000FF00; constexpr Bitboard FileBBB = FileABB << (8 * 1); @@ -56,9 +55,8 @@ extern uint8_t SquareDistance[SQ_32][SQ_32]; extern Bitboard SquareBB[SQ_32]; extern Bitboard LineBB[EFFECTIVE_SQUARE_NB][SQ_32]; -// TODO -const Bitboard Star9 = SquareBB[17] | SquareBB[19] | SquareBB[21] | SquareBB[23]; -const Bitboard Star12 = SquareBB[16] | SquareBB[18] | SquareBB[20] | SquareBB[22]; +extern Bitboard StarSquare9BB; +extern Bitboard StarSquare12BB; inline Bitboard square_bb(Square s) { @@ -66,6 +64,15 @@ inline Bitboard square_bb(Square s) return SquareBB[s]; } +inline Bitboard star_square_bb_9() +{ + return StarSquare9BB; +} + +inline Bitboard star_square_bb_12() +{ + return StarSquare12BB; +} /// Overloads of bitwise operators between a Bitboard and a Square for testing /// whether a given bit is set in a bitboard, and for setting and clearing bits.