#include #include "board.h" int pop_count(Bitboard bb){ if (bb == 0) return 0; return pop_count(bb >> 1) + (bb & 1); } void print_bitboard(Bitboard bb) { for (U64 index = 0; index < 64; index++) { printf("%lu", (bb >> index) & 1); if ((index + 1) % 8 == 0) printf("\n"); } printf("\n\n"); } void precompute_knight_attack_table(Bitboard attacks[64]) { for (int index = 0; index < 64; index++) { U64 position = (U64)1 << index; attacks[index] = ((position & notAFile & notBFile) << 6) | ((position & notGFile & notHFile) << 10) | ((position & notAFile) << 15) | ((position & notHFile) << 17) | ((position & notGFile & notHFile) >> 6) | ((position & notAFile & notBFile) >> 10) | ((position & notHFile) >> 15) | ((position & notAFile) >> 17); } }