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