X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.cpp;h=08b43ad8a5b111406af4a0cf3b8ea21e14f630b0;hp=8be7cea4b6ae6b098dfa2537904d0885ed2daa8f;hb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83;hpb=0446fc85dec483d1887adc22a3d729b0cacd8328 diff --git a/src/bitboard.cpp b/src/bitboard.cpp index 8be7cea4..08b43ad8 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -45,6 +45,7 @@ Bitboard ThisAndAdjacentFilesBB[8]; Bitboard InFrontBB[2][8]; Bitboard StepAttacksBB[16][64]; Bitboard BetweenBB[64][64]; +Bitboard DistanceRingsBB[64][8]; Bitboard ForwardBB[2][64]; Bitboard PassedPawnMask[2][64]; Bitboard AttackSpanMask[2][64]; @@ -142,7 +143,7 @@ void Bitboards::print(Bitboard b) { std::cout << "+---+---+---+---+---+---+---+---+" << '\n'; for (File file = FILE_A; file <= FILE_H; file++) - std::cout << "| " << (b & make_square(file, rank) ? "X " : " "); + std::cout << "| " << (b & (file | rank) ? "X " : " "); std::cout << "|\n"; } @@ -195,6 +196,12 @@ void Bitboards::init() { for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++) SquareDistance[s1][s2] = std::max(file_distance(s1, s2), rank_distance(s1, s2)); + for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++) + for (int d = 1; d < 8; d++) + for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++) + if (SquareDistance[s1][s2] == d) + DistanceRingsBB[s1][d - 1] |= s2; + for (int i = 0; i < 64; i++) if (!Is64Bit) // Matt Taylor's folding trick for 32 bit systems {