- const int MagicBoosters[][8] = { { 3191, 2184, 1310, 3618, 2091, 1308, 2452, 3996 },
- { 1059, 3608, 605, 3234, 3326, 38, 2029, 3043 } };
+ // init_magic_bitboards() computes all rook and bishop magics at startup.
+ // Magic bitboards are used to look up attacks of sliding pieces. As reference
+ // see chessprogramming.wikispaces.com/Magic+Bitboards. In particular, here we
+ // use the so called "fancy" approach.
+
+ void init_magic_bitboards(PieceType pt, Bitboard* attacks[], Bitboard magics[],
+ Bitboard masks[], int shifts[]) {
+
+ int MagicBoosters[][8] = { { 3191, 2184, 1310, 3618, 2091, 1308, 2452, 3996 },
+ { 1059, 3608, 605, 3234, 3326, 38, 2029, 3043 } };