rustenginelib/
constants.rs

1use crate::bitboard::*;
2use crate::piece::*;
3use crate::square::*;
4use crate::state::*;
5
6/// BISHOP_MAGIC_UNITS tells the total number of bishop lookup table items
7pub const BISHOP_MAGIC_UNITS: usize = 18976;
8/// ROOK_MAGIC_UNITS tells the total number of rook lookup table items
9pub const ROOK_MAGIC_UNITS: usize = 387072;
10
11/// NUM_LANCERS tells the number of possible lancer direction variations
12pub const NUM_LANCERS: usize = 8;
13
14/// PAWN_START_RANKS tells the pawn start rank for color
15pub const PAWN_START_RANKS: [Rank; 2] = [RANK_7, RANK_2];
16
17/// LANCER_DELTAS lists lancer deltas by direction
18pub const LANCER_DELTAS: [Delta; NUM_LANCERS] = [
19    Delta::N,
20    Delta::NE,
21    Delta::E,
22    Delta::SE,
23    Delta::S,
24    Delta::SW,
25    Delta::W,
26    Delta::NW,
27];
28
29/// SQUARE_SIZE_IN_BITS tells the number of bits used to represent a square
30pub const SQUARE_SIZE_IN_BITS: usize = 6;
31
32/// SQUARE_MASK can be used to mask the bits representing a square
33pub const SQUARE_MASK: u32 = (1 << SQUARE_SIZE_IN_BITS) - 1;
34
35/// FROM_SQ_SHIFT is the shift of from square in Move
36pub const FROM_SQ_SHIFT: usize = 0;
37/// TO_SQ_SHIFT is the shift of to square in Move
38pub const TO_SQ_SHIFT: usize = SQUARE_SIZE_IN_BITS;
39
40/// EMPTY_CASTLING_RIGHT represents an empty castling right
41pub const EMPTY_CASTLING_RIGHT: CastlingRight = CastlingRight { can_castle: false };
42
43/// EMPTY_COLOR_CASTLING_RIGHTS represents empty castling rights for a color
44pub const EMPTY_COLOR_CASTLING_RIGHTS: ColorCastlingRights = ColorCastlingRights {
45    rights: [EMPTY_CASTLING_RIGHT, EMPTY_CASTLING_RIGHT],
46};
47
48/// KING_SIDE is the index for king side castling right
49pub const KING_SIDE: usize = 0;
50/// QUEEN_SIDE is the index for queen side castling right
51pub const QUEEN_SIDE: usize = 1;
52
53/// NUM_VARIANTS tells the number of possible variants
54pub const NUM_VARIANTS: usize = 3;
55
56/// VARIANT_STANDARD is the index for Standard variant
57pub const VARIANT_STANDARD: Variant = 0;
58/// VARIANT_EIGHTPIECE is the index for Eightpiece variant
59pub const VARIANT_EIGHTPIECE: Variant = 1;
60/// VARIANT_ATOMIC is the index for Atomic variant
61pub const VARIANT_ATOMIC: Variant = 2;
62
63/// DEFAULT_VARIANT tells the default variant
64pub const DEFAULT_VARIANT: Variant = VARIANT_EIGHTPIECE;
65
66/// VARIANT_INFOS records information for all variants
67pub const VARIANT_INFOS: [VariantInfo; NUM_VARIANTS] = [
68    VariantInfo {
69        // standard
70        start_fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
71        display_name: "Standard",
72    },
73    VariantInfo {
74        // eightpiece
75        start_fen: "jlsesqkbnr/pppppppp/8/8/8/8/PPPPPPPP/JLneSQKBNR w KQkq - 0 1 -",
76        display_name: "Eightpiece",
77    },
78    VariantInfo {
79        // atomic
80        start_fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
81        display_name: "Atomic",
82    },
83];
84
85/// MAX_STATES tells the maximum number of states in a LinearGaeme
86pub const MAX_STATES: usize = 100;
87
88/// EMPTRY_REP represents and empty chess board
89pub const EMPTY_REP: [Piece; BOARD_AREA] = [
90    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
91    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92];
93
94/// FIGURE_ARRAY_SIZE tells the number of possible figures
95pub const FIGURE_ARRAY_SIZE: usize = 18;
96
97/// EMTPY_FIGURE_BITBOARDS represents an empty bitboard for all possible figures
98pub const EMTPY_FIGURE_BITBOARDS: [Bitboard; FIGURE_ARRAY_SIZE] =
99    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
100
101/// BITBOARD_MIDDLE represents the bitboard for the middle of the board
102pub const BITBOARD_MIDDLE: Bitboard = 0x007E7E7E7E7E7E00;
103/// BITBOARD_RANK_8 represents the bitboard for the 8th rank of the board
104pub const BITBOARD_RANK_8: Bitboard = 0xff00000000000000;
105/// BITBOARD_RANK_8_MIDDLE represents the bitboard for the middle of the 8th rank of the board
106pub const BITBOARD_RANK_8_MIDDLE: Bitboard = 0x7E00000000000000;
107/// BITBOARD_RANK_1 represents the bitboard for the 1st rank of the board
108pub const BITBOARD_RANK_1: Bitboard = 0x00000000000000ff;
109/// BITBOARD_RANK_1_MIDDLE represents the bitboard for the middle of the 1st rank of the board
110pub const BITBOARD_RANK_1_MIDDLE: Bitboard = 0x000000000000007E;
111/// BITBOARD_FILE_A represents file 'a' of the board
112pub const BITBOARD_FILE_A: Bitboard = 0x8080808080808080;
113/// BITBOARD_FILE_A_MIDDLE represents the middle of file 'a' of the board
114pub const BITBOARD_FILE_A_MIDDLE: Bitboard = 0x0080808080808000;
115/// BITBOARD_FILE_H represents file 'h' of the board
116pub const BITBOARD_FILE_H: Bitboard = 0x0101010101010101;
117/// BITBOARD_FILE_H_MIDDLE represents the middle of file 'h' of the board
118pub const BITBOARD_FILE_H_MIDDLE: Bitboard = 0x0001010101010100;
119
120/// BLACK represents black chess color
121pub const BLACK: Color = 0;
122/// WHITE represents white chess color
123pub const WHITE: Color = 1;
124
125/// PIECE_FEN_SYMBOLS maps a piece to its fen symbol
126pub const PIECE_FEN_SYMBOLS: [&str; 36] = [
127    ".", ".", "p", "P", "n", "N", "b", "B", "r", "R", "q", "Q", "k", "K", "l", "L", "ln", "Ln",
128    "lne", "Lne", "le", "Le", "lse", "Lse", "ls", "Ls", "lsw", "Lsw", "lw", "Lw", "lnw", "Lnw",
129    "s", "S", "j", "J",
130];
131
132/// NO_FIGURE represents no piece on a given square
133pub const NO_PIECE: Piece = 0;
134
135/// NO_FIGURE represents no figure on a given square
136pub const NO_FIGURE: Figure = 0;
137/// PAWN represents chess figure 'pawn'
138pub const PAWN: Figure = 1;
139/// KNIGHT represents chess figure 'knight'
140pub const KNIGHT: Figure = 2;
141/// BISHOP represents chess figure 'bishop'
142pub const BISHOP: Figure = 3;
143/// ROOK represents chess figure 'rook'
144pub const ROOK: Figure = 4;
145/// QUEEN represents chess figure 'queen'
146pub const QUEEN: Figure = 5;
147/// KING represents chess figure 'king'
148pub const KING: Figure = 6;
149/// LANCER represents chess figure 'lancer'
150pub const LANCER: Figure = 7;
151/// LANCERN represents chess figure 'lancern'
152pub const LANCERN: Figure = 8;
153/// LANCERNE represents chess figure 'lancerne'
154pub const LANCERNE: Figure = 9;
155/// LANCERE represents chess figure 'lancere'
156pub const LANCERE: Figure = 10;
157/// LANCERSE represents chess figure 'lancerse'
158pub const LANCERSE: Figure = 11;
159/// LANCERS represents chess figure 'lancers'
160pub const LANCERS: Figure = 12;
161/// LANCERSW represents chess figure 'lancersw'
162pub const LANCERSW: Figure = 13;
163/// LANCERW represents chess figure 'lancerw'
164pub const LANCERW: Figure = 14;
165/// LANCERNW represents chess figure 'lancernw'
166pub const LANCERNW: Figure = 15;
167/// SENTRY represents chess figure 'sentry'
168pub const SENTRY: Figure = 16;
169/// JAILER represents chess figure 'jailer'
170pub const JAILER: Figure = 17;
171
172/// LANCER_MIN tells the lowest lancer
173pub const LANCER_MIN: Figure = LANCERN;
174/// LANCER_MAX tells the highest lancer
175pub const LANCER_MAX: Figure = LANCERNW;
176
177/// FIG_MIN tells the lowest non empty figure
178pub const FIG_MIN: Figure = PAWN;
179/// FIG_MAX tells the highest non empty figure
180pub const FIG_MAX: Figure = JAILER;
181
182/// FIGURE_FEN_SYMBOLS maps a figure to its fen symbol
183pub const FIGURE_FEN_SYMBOLS: [&str; 18] = [
184    ".", "p", "n", "b", "r", "q", "k", "l", "ln", "lne", "le", "lse", "ls", "lsw", "lw", "lnw",
185    "s", "j",
186];
187
188/// FIGURE_SAN_LETTERS maps a figure to its san letter
189pub const FIGURE_SAN_LETTERS: [&str; 18] = [
190    ".", "P", "N", "B", "R", "Q", "K", "L", "L", "L", "L", "L", "L", "L", "L", "L", "S", "J",
191];
192
193/// NUM_RANKS tells the number of ranks of a chess board
194pub const NUM_RANKS: usize = 8;
195/// LAST_RANK tells the last rank of a chess board
196pub const LAST_RANK: Rank = NUM_RANKS - 1;
197/// ONE_BEFORE_LAST_RANK tells the rank before last rank
198pub const ONE_BEFORE_LAST_RANK: Rank = LAST_RANK - 1;
199/// TWO_BEFORE_LAST_RANK tells the rank two before last rank
200pub const TWO_BEFORE_LAST_RANK: Rank = LAST_RANK - 2;
201/// NUM_RANKS tells the number of files of a chess board
202pub const NUM_FILES: usize = 8;
203/// LAST_FILE tells the last file of a chess board
204pub const LAST_FILE: File = NUM_FILES - 1;
205/// ONE_BEFORE_LAST_FILE tells the file before last file
206pub const ONE_BEFORE_LAST_FILE: File = LAST_FILE - 1;
207/// TWO_BEFORE_LAST_FILE tells the file two before last file
208pub const TWO_BEFORE_LAST_FILE: File = LAST_FILE - 2;
209/// BOARD_AREA tells the size of the board in squares
210pub const BOARD_AREA: usize = NUM_RANKS * NUM_FILES;
211
212/// KNIGHT_DELTAS lists the possible deltas of a knight
213pub const KNIGHT_DELTAS: [Delta; 8] = [
214    Delta::NNE,
215    Delta::NEE,
216    Delta::SEE,
217    Delta::SSE,
218    Delta::SSW,
219    Delta::SWW,
220    Delta::NWW,
221    Delta::NNW,
222];
223
224/// BISHOP_DELTAS lists the possible deltas of a bishop
225pub const BISHOP_DELTAS: [Delta; 4] = [Delta::NE, Delta::SE, Delta::SW, Delta::NW];
226
227/// ROOK_DELTAS lists the possible deltas of a rook
228pub const ROOK_DELTAS: [Delta; 4] = [Delta::N, Delta::E, Delta::S, Delta::W];
229
230/// QUEEN_DELTAS lists the possible deltas of a queen
231pub const QUEEN_DELTAS: [Delta; 8] = [
232    Delta::N,
233    Delta::NE,
234    Delta::E,
235    Delta::SE,
236    Delta::S,
237    Delta::SW,
238    Delta::W,
239    Delta::NW,
240];
241
242/// RANK_SHIFT tells the position of the rank in bits within a square
243pub const RANK_SHIFT: usize = 3;
244/// FILE_MASK is a mask that has bits set that represent the file within a square
245pub const FILE_MASK: usize = (1 << RANK_SHIFT) - 1;
246
247/// RANK_1 represents rank '1' of a chess board
248pub const RANK_1: Rank = 0;
249/// RANK_2 represents rank '2' of a chess board
250pub const RANK_2: Rank = 1;
251/// RANK_3 represents rank '3' of a chess board
252pub const RANK_3: Rank = 2;
253/// RANK_4 represents rank '4' of a chess board
254pub const RANK_4: Rank = 3;
255/// RANK_5 represents rank '5' of a chess board
256pub const RANK_5: Rank = 4;
257/// RANK_6 represents rank '6' of a chess board
258pub const RANK_6: Rank = 5;
259/// RANK_7 represents rank '7' of a chess board
260pub const RANK_7: Rank = 6;
261/// RANK_8 represents rank '8' of a chess board
262pub const RANK_8: Rank = 7;
263
264/// FILE_A represents file 'a' of a chess board
265pub const FILE_A: File = 0;
266/// FILE_B represents file 'b' of a chess board
267pub const FILE_B: File = 1;
268/// FILE_C represents file 'c' of a chess board
269pub const FILE_C: File = 2;
270/// FILE_D represents file 'd' of a chess board
271pub const FILE_D: File = 3;
272/// FILE_E represents file 'e' of a chess board
273pub const FILE_E: File = 4;
274/// FILE_F represents file 'f' of a chess board
275pub const FILE_F: File = 5;
276/// FILE_G represents file 'g' of a chess board
277pub const FILE_G: File = 6;
278/// FILE_H represents file 'h' of a chess board
279pub const FILE_H: File = 7;
280
281/// SQUARE_A1 represents square 'a1' of a chess board
282pub const SQUARE_A1: Square = 0;
283/// SQUARE_B1 represents square 'b1' of a chess board
284pub const SQUARE_B1: Square = 1;
285/// SQUARE_C1 represents square 'c1' of a chess board
286pub const SQUARE_C1: Square = 2;
287/// SQUARE_D1 represents square 'd1' of a chess board
288pub const SQUARE_D1: Square = 3;
289/// SQUARE_E1 represents square 'e1' of a chess board
290pub const SQUARE_E1: Square = 4;
291/// SQUARE_F1 represents square 'f1' of a chess board
292pub const SQUARE_F1: Square = 5;
293/// SQUARE_G1 represents square 'g1' of a chess board
294pub const SQUARE_G1: Square = 6;
295/// SQUARE_H1 represents square 'h1' of a chess board
296pub const SQUARE_H1: Square = 7;
297/// SQUARE_A2 represents square 'a2' of a chess board
298pub const SQUARE_A2: Square = 8;
299/// SQUARE_B2 represents square 'b2' of a chess board
300pub const SQUARE_B2: Square = 9;
301/// SQUARE_C2 represents square 'c2' of a chess board
302pub const SQUARE_C2: Square = 10;
303/// SQUARE_D2 represents square 'd2' of a chess board
304pub const SQUARE_D2: Square = 11;
305/// SQUARE_E2 represents square 'e2' of a chess board
306pub const SQUARE_E2: Square = 12;
307/// SQUARE_F2 represents square 'f2' of a chess board
308pub const SQUARE_F2: Square = 13;
309/// SQUARE_G2 represents square 'g2' of a chess board
310pub const SQUARE_G2: Square = 14;
311/// SQUARE_H2 represents square 'h2' of a chess board
312pub const SQUARE_H2: Square = 15;
313/// SQUARE_A3 represents square 'a3' of a chess board
314pub const SQUARE_A3: Square = 16;
315/// SQUARE_B3 represents square 'b3' of a chess board
316pub const SQUARE_B3: Square = 17;
317/// SQUARE_C3 represents square 'c3' of a chess board
318pub const SQUARE_C3: Square = 18;
319/// SQUARE_D3 represents square 'd3' of a chess board
320pub const SQUARE_D3: Square = 19;
321/// SQUARE_E3 represents square 'e3' of a chess board
322pub const SQUARE_E3: Square = 20;
323/// SQUARE_F3 represents square 'f3' of a chess board
324pub const SQUARE_F3: Square = 21;
325/// SQUARE_G3 represents square 'g3' of a chess board
326pub const SQUARE_G3: Square = 22;
327/// SQUARE_H3 represents square 'h3' of a chess board
328pub const SQUARE_H3: Square = 23;
329/// SQUARE_A4 represents square 'a4' of a chess board
330pub const SQUARE_A4: Square = 24;
331/// SQUARE_B4 represents square 'b4' of a chess board
332pub const SQUARE_B4: Square = 25;
333/// SQUARE_C4 represents square 'c4' of a chess board
334pub const SQUARE_C4: Square = 26;
335/// SQUARE_D4 represents square 'd4' of a chess board
336pub const SQUARE_D4: Square = 27;
337/// SQUARE_E4 represents square 'e4' of a chess board
338pub const SQUARE_E4: Square = 28;
339/// SQUARE_F4 represents square 'f4' of a chess board
340pub const SQUARE_F4: Square = 29;
341/// SQUARE_G4 represents square 'g4' of a chess board
342pub const SQUARE_G4: Square = 30;
343/// SQUARE_H4 represents square 'h4' of a chess board
344pub const SQUARE_H4: Square = 31;
345/// SQUARE_A5 represents square 'a5' of a chess board
346pub const SQUARE_A5: Square = 32;
347/// SQUARE_B5 represents square 'b5' of a chess board
348pub const SQUARE_B5: Square = 33;
349/// SQUARE_C5 represents square 'c5' of a chess board
350pub const SQUARE_C5: Square = 34;
351/// SQUARE_D5 represents square 'd5' of a chess board
352pub const SQUARE_D5: Square = 35;
353/// SQUARE_E5 represents square 'e5' of a chess board
354pub const SQUARE_E5: Square = 36;
355/// SQUARE_F5 represents square 'f5' of a chess board
356pub const SQUARE_F5: Square = 37;
357/// SQUARE_G5 represents square 'g5' of a chess board
358pub const SQUARE_G5: Square = 38;
359/// SQUARE_H5 represents square 'h5' of a chess board
360pub const SQUARE_H5: Square = 39;
361/// SQUARE_A6 represents square 'a6' of a chess board
362pub const SQUARE_A6: Square = 40;
363/// SQUARE_B6 represents square 'b6' of a chess board
364pub const SQUARE_B6: Square = 41;
365/// SQUARE_C6 represents square 'c6' of a chess board
366pub const SQUARE_C6: Square = 42;
367/// SQUARE_D6 represents square 'd6' of a chess board
368pub const SQUARE_D6: Square = 43;
369/// SQUARE_E6 represents square 'e6' of a chess board
370pub const SQUARE_E6: Square = 44;
371/// SQUARE_F6 represents square 'f6' of a chess board
372pub const SQUARE_F6: Square = 45;
373/// SQUARE_G6 represents square 'g6' of a chess board
374pub const SQUARE_G6: Square = 46;
375/// SQUARE_H6 represents square 'h6' of a chess board
376pub const SQUARE_H6: Square = 47;
377/// SQUARE_A7 represents square 'a7' of a chess board
378pub const SQUARE_A7: Square = 48;
379/// SQUARE_B7 represents square 'b7' of a chess board
380pub const SQUARE_B7: Square = 49;
381/// SQUARE_C7 represents square 'c7' of a chess board
382pub const SQUARE_C7: Square = 50;
383/// SQUARE_D7 represents square 'd7' of a chess board
384pub const SQUARE_D7: Square = 51;
385/// SQUARE_E7 represents square 'e7' of a chess board
386pub const SQUARE_E7: Square = 52;
387/// SQUARE_F7 represents square 'f7' of a chess board
388pub const SQUARE_F7: Square = 53;
389/// SQUARE_G7 represents square 'g7' of a chess board
390pub const SQUARE_G7: Square = 54;
391/// SQUARE_H7 represents square 'h7' of a chess board
392pub const SQUARE_H7: Square = 55;
393/// SQUARE_A8 represents square 'a8' of a chess board
394pub const SQUARE_A8: Square = 56;
395/// SQUARE_B8 represents square 'b8' of a chess board
396pub const SQUARE_B8: Square = 57;
397/// SQUARE_C8 represents square 'c8' of a chess board
398pub const SQUARE_C8: Square = 58;
399/// SQUARE_D8 represents square 'd8' of a chess board
400pub const SQUARE_D8: Square = 59;
401/// SQUARE_E8 represents square 'e8' of a chess board
402pub const SQUARE_E8: Square = 60;
403/// SQUARE_F8 represents square 'f8' of a chess board
404pub const SQUARE_F8: Square = 61;
405/// SQUARE_G8 represents square 'g8' of a chess board
406pub const SQUARE_G8: Square = 62;
407/// SQUARE_H8 represents square 'h8' of a chess board
408pub const SQUARE_H8: Square = 63;
409
410/// FILE_NAMES maps a file to a file name
411pub const FILE_NAMES: [char; 8] = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
412
413/// EMPTY_ATTACK_TABLE defines an empty attack table, useful for initializing attack tables
414pub const EMPTY_ATTACK_TABLE: AttackTable = [
415    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
416    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
417];
418
419/// BISHOP_MAGICS records bishop magics
420pub const BISHOP_MAGICS: [MagicInfo; BOARD_AREA] = [
421    MagicInfo {
422        sq: SQUARE_A1,
423        magic: 0x0EEEE053F756C577,
424        shift: 7,
425    },
426    MagicInfo {
427        sq: SQUARE_B1,
428        magic: 0x20A1752D5294E8AA,
429        shift: 6,
430    },
431    MagicInfo {
432        sq: SQUARE_C1,
433        magic: 0xFFAE7DCBB67E2AD8,
434        shift: 6,
435    },
436    MagicInfo {
437        sq: SQUARE_D1,
438        magic: 0x95E20936ACF52029,
439        shift: 6,
440    },
441    MagicInfo {
442        sq: SQUARE_E1,
443        magic: 0x8659660ABA92446A,
444        shift: 6,
445    },
446    MagicInfo {
447        sq: SQUARE_F1,
448        magic: 0xCB2205A8F212E3CD,
449        shift: 6,
450    },
451    MagicInfo {
452        sq: SQUARE_G1,
453        magic: 0x63095C5766AEAC33,
454        shift: 6,
455    },
456    MagicInfo {
457        sq: SQUARE_H1,
458        magic: 0x6A0A2CDED7FD32B6,
459        shift: 7,
460    },
461    MagicInfo {
462        sq: SQUARE_A2,
463        magic: 0xF7AA6799A42C1974,
464        shift: 6,
465    },
466    MagicInfo {
467        sq: SQUARE_B2,
468        magic: 0x0EEBFAAE2308CDE6,
469        shift: 6,
470    },
471    MagicInfo {
472        sq: SQUARE_C2,
473        magic: 0x62F5D4C232917A29,
474        shift: 6,
475    },
476    MagicInfo {
477        sq: SQUARE_D2,
478        magic: 0x6511DA45FB6E605B,
479        shift: 6,
480    },
481    MagicInfo {
482        sq: SQUARE_E2,
483        magic: 0x1C1020709501F819,
484        shift: 6,
485    },
486    MagicInfo {
487        sq: SQUARE_F2,
488        magic: 0x9713D67F067E5B55,
489        shift: 6,
490    },
491    MagicInfo {
492        sq: SQUARE_G2,
493        magic: 0x4A9B28CAC8388396,
494        shift: 6,
495    },
496    MagicInfo {
497        sq: SQUARE_H2,
498        magic: 0x0D80340307A89DE3,
499        shift: 6,
500    },
501    MagicInfo {
502        sq: SQUARE_A3,
503        magic: 0xDFE4E245340681A7,
504        shift: 6,
505    },
506    MagicInfo {
507        sq: SQUARE_B3,
508        magic: 0x086E282C294CE76A,
509        shift: 6,
510    },
511    MagicInfo {
512        sq: SQUARE_C3,
513        magic: 0x7940D0C20066331C,
514        shift: 8,
515    },
516    MagicInfo {
517        sq: SQUARE_D3,
518        magic: 0xB268CBA3523295A2,
519        shift: 8,
520    },
521    MagicInfo {
522        sq: SQUARE_E3,
523        magic: 0xFA6472E0AEE3A9CD,
524        shift: 8,
525    },
526    MagicInfo {
527        sq: SQUARE_F3,
528        magic: 0x4AB90CCE21C05AC4,
529        shift: 8,
530    },
531    MagicInfo {
532        sq: SQUARE_G3,
533        magic: 0x19BBE314DB87C5A2,
534        shift: 6,
535    },
536    MagicInfo {
537        sq: SQUARE_H3,
538        magic: 0x2D8420D15430341A,
539        shift: 5,
540    },
541    MagicInfo {
542        sq: SQUARE_A4,
543        magic: 0x002064D946035D06,
544        shift: 6,
545    },
546    MagicInfo {
547        sq: SQUARE_B4,
548        magic: 0x8F7EFC3826FCBC9E,
549        shift: 6,
550    },
551    MagicInfo {
552        sq: SQUARE_C4,
553        magic: 0xA5EFF6F3B79E13AC,
554        shift: 9,
555    },
556    MagicInfo {
557        sq: SQUARE_D4,
558        magic: 0x979736BB1A2BBF3F,
559        shift: 12,
560    },
561    MagicInfo {
562        sq: SQUARE_E4,
563        magic: 0x47EF601CFFC5AA96,
564        shift: 11,
565    },
566    MagicInfo {
567        sq: SQUARE_F4,
568        magic: 0xCBB12ECFB3AB9886,
569        shift: 9,
570    },
571    MagicInfo {
572        sq: SQUARE_G4,
573        magic: 0x9F3DE5985071281C,
574        shift: 6,
575    },
576    MagicInfo {
577        sq: SQUARE_H4,
578        magic: 0xF7F070016C4BB3B1,
579        shift: 6,
580    },
581    MagicInfo {
582        sq: SQUARE_A5,
583        magic: 0x5B257CF070A81662,
584        shift: 6,
585    },
586    MagicInfo {
587        sq: SQUARE_B5,
588        magic: 0xDDDDF92F252AC221,
589        shift: 6,
590    },
591    MagicInfo {
592        sq: SQUARE_C5,
593        magic: 0x03B272448E17640F,
594        shift: 8,
595    },
596    MagicInfo {
597        sq: SQUARE_D5,
598        magic: 0x344929A251A4A2B4,
599        shift: 11,
600    },
601    MagicInfo {
602        sq: SQUARE_E5,
603        magic: 0xC59870B586EE336E,
604        shift: 12,
605    },
606    MagicInfo {
607        sq: SQUARE_F5,
608        magic: 0x0D10F3CD6C346800,
609        shift: 8,
610    },
611    MagicInfo {
612        sq: SQUARE_G5,
613        magic: 0x6C4A636CFAEE0FC3,
614        shift: 6,
615    },
616    MagicInfo {
617        sq: SQUARE_H5,
618        magic: 0x1B7C2059AA3C501E,
619        shift: 5,
620    },
621    MagicInfo {
622        sq: SQUARE_A6,
623        magic: 0xF44FA78502E05C46,
624        shift: 6,
625    },
626    MagicInfo {
627        sq: SQUARE_B6,
628        magic: 0xA605295DB4D8A494,
629        shift: 6,
630    },
631    MagicInfo {
632        sq: SQUARE_C6,
633        magic: 0x57293F7EEA9072FC,
634        shift: 8,
635    },
636    MagicInfo {
637        sq: SQUARE_D6,
638        magic: 0x7A4B502FE080693E,
639        shift: 8,
640    },
641    MagicInfo {
642        sq: SQUARE_E6,
643        magic: 0x840FE3E0F7C37EFD,
644        shift: 8,
645    },
646    MagicInfo {
647        sq: SQUARE_F6,
648        magic: 0xC6553AE93DE5DEEB,
649        shift: 8,
650    },
651    MagicInfo {
652        sq: SQUARE_G6,
653        magic: 0x186E0A1720748471,
654        shift: 5,
655    },
656    MagicInfo {
657        sq: SQUARE_H6,
658        magic: 0x344586BD3800F615,
659        shift: 6,
660    },
661    MagicInfo {
662        sq: SQUARE_A7,
663        magic: 0xDA81874F48DE2873,
664        shift: 6,
665    },
666    MagicInfo {
667        sq: SQUARE_B7,
668        magic: 0xE750DB951630E01C,
669        shift: 6,
670    },
671    MagicInfo {
672        sq: SQUARE_C7,
673        magic: 0x8D7AC01104BE4239,
674        shift: 5,
675    },
676    MagicInfo {
677        sq: SQUARE_D7,
678        magic: 0xD069455082F020EF,
679        shift: 6,
680    },
681    MagicInfo {
682        sq: SQUARE_E7,
683        magic: 0x0B12D09BE0A80D3B,
684        shift: 5,
685    },
686    MagicInfo {
687        sq: SQUARE_F7,
688        magic: 0xF66D45FADE4750BF,
689        shift: 6,
690    },
691    MagicInfo {
692        sq: SQUARE_G7,
693        magic: 0xDEE2FEF5608BB86B,
694        shift: 6,
695    },
696    MagicInfo {
697        sq: SQUARE_H7,
698        magic: 0x3BC4110C30BC372E,
699        shift: 5,
700    },
701    MagicInfo {
702        sq: SQUARE_A8,
703        magic: 0x030D2624DC9C2FAB,
704        shift: 7,
705    },
706    MagicInfo {
707        sq: SQUARE_B8,
708        magic: 0x3BA0C0EE6C2C0185,
709        shift: 5,
710    },
711    MagicInfo {
712        sq: SQUARE_C8,
713        magic: 0x0B7687D6A30FCDB0,
714        shift: 6,
715    },
716    MagicInfo {
717        sq: SQUARE_D8,
718        magic: 0x1A17F24EB26AC5B9,
719        shift: 6,
720    },
721    MagicInfo {
722        sq: SQUARE_E8,
723        magic: 0x70266A5B055D77F6,
724        shift: 6,
725    },
726    MagicInfo {
727        sq: SQUARE_F8,
728        magic: 0x8498203F0163A952,
729        shift: 6,
730    },
731    MagicInfo {
732        sq: SQUARE_G8,
733        magic: 0xC4E6130B3DBE1E26,
734        shift: 6,
735    },
736    MagicInfo {
737        sq: SQUARE_H8,
738        magic: 0x9CB76E818B87114C,
739        shift: 7,
740    },
741];
742
743/// ROOK_MAGICS records rook magics
744pub const ROOK_MAGICS: [MagicInfo; BOARD_AREA] = [
745    MagicInfo {
746        sq: SQUARE_A1,
747        magic: 0xEB5BFB1511B7C572,
748        shift: 14,
749    },
750    MagicInfo {
751        sq: SQUARE_B1,
752        magic: 0xC8608D0688E7A11A,
753        shift: 13,
754    },
755    MagicInfo {
756        sq: SQUARE_C1,
757        magic: 0x3CE72520084C5AD7,
758        shift: 13,
759    },
760    MagicInfo {
761        sq: SQUARE_D1,
762        magic: 0xB1CD151D5279C4E2,
763        shift: 13,
764    },
765    MagicInfo {
766        sq: SQUARE_E1,
767        magic: 0x145254517D0A38C5,
768        shift: 13,
769    },
770    MagicInfo {
771        sq: SQUARE_F1,
772        magic: 0x890F78296C5C6B67,
773        shift: 14,
774    },
775    MagicInfo {
776        sq: SQUARE_G1,
777        magic: 0x535154D37FDA3758,
778        shift: 13,
779    },
780    MagicInfo {
781        sq: SQUARE_H1,
782        magic: 0x6F10FA4A53DDDD67,
783        shift: 14,
784    },
785    MagicInfo {
786        sq: SQUARE_A2,
787        magic: 0xFCF4667B997AD49A,
788        shift: 13,
789    },
790    MagicInfo {
791        sq: SQUARE_B2,
792        magic: 0xB381EE06B8D760C9,
793        shift: 12,
794    },
795    MagicInfo {
796        sq: SQUARE_C2,
797        magic: 0xF49744D7EA7A7F45,
798        shift: 12,
799    },
800    MagicInfo {
801        sq: SQUARE_D2,
802        magic: 0x2FDDB993EF98801C,
803        shift: 12,
804    },
805    MagicInfo {
806        sq: SQUARE_E2,
807        magic: 0x52893ECADF61693E,
808        shift: 12,
809    },
810    MagicInfo {
811        sq: SQUARE_F2,
812        magic: 0x0CACE9126E294884,
813        shift: 12,
814    },
815    MagicInfo {
816        sq: SQUARE_G2,
817        magic: 0x780E224E32B8259B,
818        shift: 12,
819    },
820    MagicInfo {
821        sq: SQUARE_H2,
822        magic: 0x4ED7F0F359C79D1D,
823        shift: 13,
824    },
825    MagicInfo {
826        sq: SQUARE_A3,
827        magic: 0x58FF574A6B17102C,
828        shift: 13,
829    },
830    MagicInfo {
831        sq: SQUARE_B3,
832        magic: 0xC18E42DF30B60108,
833        shift: 12,
834    },
835    MagicInfo {
836        sq: SQUARE_C3,
837        magic: 0x82615CC2DC1619E7,
838        shift: 12,
839    },
840    MagicInfo {
841        sq: SQUARE_D3,
842        magic: 0x0AA0CFFF3CAB034F,
843        shift: 12,
844    },
845    MagicInfo {
846        sq: SQUARE_E3,
847        magic: 0x3AA209B910A2A2C0,
848        shift: 12,
849    },
850    MagicInfo {
851        sq: SQUARE_F3,
852        magic: 0x7D6D42D864ED4744,
853        shift: 12,
854    },
855    MagicInfo {
856        sq: SQUARE_G3,
857        magic: 0x1F49AC2C1FDA6D5B,
858        shift: 12,
859    },
860    MagicInfo {
861        sq: SQUARE_H3,
862        magic: 0x3B6D1A3A4AF92D50,
863        shift: 13,
864    },
865    MagicInfo {
866        sq: SQUARE_A4,
867        magic: 0xE7C3B1D0B8EDF3A8,
868        shift: 13,
869    },
870    MagicInfo {
871        sq: SQUARE_B4,
872        magic: 0xE01E4C628A791328,
873        shift: 12,
874    },
875    MagicInfo {
876        sq: SQUARE_C4,
877        magic: 0xD9918490A8516264,
878        shift: 12,
879    },
880    MagicInfo {
881        sq: SQUARE_D4,
882        magic: 0x4AFFDBD9881440CE,
883        shift: 13,
884    },
885    MagicInfo {
886        sq: SQUARE_E4,
887        magic: 0x29D9E1F13D9B48A5,
888        shift: 12,
889    },
890    MagicInfo {
891        sq: SQUARE_F4,
892        magic: 0xD2647A2309B70AF5,
893        shift: 12,
894    },
895    MagicInfo {
896        sq: SQUARE_G4,
897        magic: 0xF9978681E00B17E0,
898        shift: 12,
899    },
900    MagicInfo {
901        sq: SQUARE_H4,
902        magic: 0xF1F3DDFDAF83D405,
903        shift: 13,
904    },
905    MagicInfo {
906        sq: SQUARE_A5,
907        magic: 0x954BA31977E062BA,
908        shift: 13,
909    },
910    MagicInfo {
911        sq: SQUARE_B5,
912        magic: 0xD52B1274D43F1A9C,
913        shift: 12,
914    },
915    MagicInfo {
916        sq: SQUARE_C5,
917        magic: 0xBE43F8A40D902543,
918        shift: 12,
919    },
920    MagicInfo {
921        sq: SQUARE_D5,
922        magic: 0x8866A7F07B184CA5,
923        shift: 12,
924    },
925    MagicInfo {
926        sq: SQUARE_E5,
927        magic: 0xF219EF680D77619C,
928        shift: 12,
929    },
930    MagicInfo {
931        sq: SQUARE_F5,
932        magic: 0x9BB75C3B8476F746,
933        shift: 12,
934    },
935    MagicInfo {
936        sq: SQUARE_G5,
937        magic: 0xAD1EE18B5B780265,
938        shift: 12,
939    },
940    MagicInfo {
941        sq: SQUARE_H5,
942        magic: 0xB6B44224206E74E5,
943        shift: 13,
944    },
945    MagicInfo {
946        sq: SQUARE_A6,
947        magic: 0x649CDC1F34AEA2F6,
948        shift: 13,
949    },
950    MagicInfo {
951        sq: SQUARE_B6,
952        magic: 0xFF83A9859BA534C4,
953        shift: 12,
954    },
955    MagicInfo {
956        sq: SQUARE_C6,
957        magic: 0x37CA319A4D50C97E,
958        shift: 12,
959    },
960    MagicInfo {
961        sq: SQUARE_D6,
962        magic: 0x858715E0CC1F8F7A,
963        shift: 12,
964    },
965    MagicInfo {
966        sq: SQUARE_E6,
967        magic: 0xE729AA5F024DF2C0,
968        shift: 12,
969    },
970    MagicInfo {
971        sq: SQUARE_F6,
972        magic: 0x1274960D5333E983,
973        shift: 12,
974    },
975    MagicInfo {
976        sq: SQUARE_G6,
977        magic: 0x4E78A790882C2806,
978        shift: 12,
979    },
980    MagicInfo {
981        sq: SQUARE_H6,
982        magic: 0x7C27B241F8825A5B,
983        shift: 13,
984    },
985    MagicInfo {
986        sq: SQUARE_A7,
987        magic: 0x0DFC0F9386834FD8,
988        shift: 12,
989    },
990    MagicInfo {
991        sq: SQUARE_B7,
992        magic: 0x87342325FE073668,
993        shift: 12,
994    },
995    MagicInfo {
996        sq: SQUARE_C7,
997        magic: 0x850AE96248D88210,
998        shift: 12,
999    },
1000    MagicInfo {
1001        sq: SQUARE_D7,
1002        magic: 0x8A8D8EA6E640F8F7,
1003        shift: 12,
1004    },
1005    MagicInfo {
1006        sq: SQUARE_E7,
1007        magic: 0xC6AC009AB7852C97,
1008        shift: 12,
1009    },
1010    MagicInfo {
1011        sq: SQUARE_F7,
1012        magic: 0x6D9B84E49D05E5D8,
1013        shift: 12,
1014    },
1015    MagicInfo {
1016        sq: SQUARE_G7,
1017        magic: 0xF598D5B0F5881D70,
1018        shift: 11,
1019    },
1020    MagicInfo {
1021        sq: SQUARE_H7,
1022        magic: 0x1238BF08A6F9C38D,
1023        shift: 12,
1024    },
1025    MagicInfo {
1026        sq: SQUARE_A8,
1027        magic: 0xCFC8C410148D3AF6,
1028        shift: 13,
1029    },
1030    MagicInfo {
1031        sq: SQUARE_B8,
1032        magic: 0x234F1593282FADBC,
1033        shift: 12,
1034    },
1035    MagicInfo {
1036        sq: SQUARE_C8,
1037        magic: 0x6BCC4CA147847096,
1038        shift: 13,
1039    },
1040    MagicInfo {
1041        sq: SQUARE_D8,
1042        magic: 0xA7FF3C5F35FFF73A,
1043        shift: 13,
1044    },
1045    MagicInfo {
1046        sq: SQUARE_E8,
1047        magic: 0x6A4F4F1EC85934C6,
1048        shift: 13,
1049    },
1050    MagicInfo {
1051        sq: SQUARE_F8,
1052        magic: 0x7E23DAD717AC6081,
1053        shift: 13,
1054    },
1055    MagicInfo {
1056        sq: SQUARE_G8,
1057        magic: 0x7211D918B0800852,
1058        shift: 12,
1059    },
1060    MagicInfo {
1061        sq: SQUARE_H8,
1062        magic: 0x8588AC87AA8CA46A,
1063        shift: 13,
1064    },
1065];