-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiece_attack_table.h
70 lines (53 loc) · 2 KB
/
piece_attack_table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include "bitboard.h"
constexpr int BISHOP_RELEVANT_BITS_TABLE[64] =
{
6, 5, 5, 5, 5, 5, 5, 6,
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 7, 7, 7, 7, 5, 5,
5, 5, 7, 9, 9, 7, 5, 5,
5, 5, 7, 9, 9, 7, 5, 5,
5, 5, 7, 7, 7, 7, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
6, 5, 5, 5, 5, 5, 5, 6
};
constexpr int ROOK_RELEVANT_BITS_TABLE[64] =
{
12, 11, 11, 11, 11, 11, 11, 12,
11, 10, 10, 10, 10, 10, 10, 11,
11, 10, 10, 10, 10, 10, 10, 11,
11, 10, 10, 10, 10, 10, 10, 11,
11, 10, 10, 10, 10, 10, 10, 11,
11, 10, 10, 10, 10, 10, 10, 11,
11, 10, 10, 10, 10, 10, 10, 11,
12, 11, 11, 11, 11, 11, 11, 12
};
extern Bitboard PAWN_ATTACK_TABLE[2][64];
extern Bitboard KNIGHT_ATTACK_TABLE[64];
extern Bitboard KING_ATTACK_TABLE[64];
extern Bitboard BISHOP_ATTACK_MASK_TABLE[64];
extern Bitboard ROOK_ATTACK_MASK_TABLE[64];
extern Bitboard BISHOP_ATTACK_TABLE[64][512]; //[square][magic index]
extern Bitboard ROOK_ATTACK_TABLE[64][4096]; //[square][magic index]
Bitboard MaskPawnAttack(int side, int square);
Bitboard MaskKnightAttack(int square);
Bitboard MaskKingAttack(int square);
Bitboard MaskBishopAttack(int square);
Bitboard MaskRookAttack(int square);
Bitboard MaskOccupancy(Bitboard attack_mask, int index_filter_mask);
Bitboard MaskBishopAttackOnFly(int square, Bitboard occupancy);
Bitboard MaskRookAttackOnFly(int square, Bitboard occupancy);
void InitSliderAttackTable();
void InitLeaperAttackTable();
//use these functions to access the real attack table
Bitboard GetPawnAttackExact(int attack_side, int square);
Bitboard GetKnightAttackExact(int square);
Bitboard GetKingAttackExact(int square);
Bitboard GetBishopAttackExact(int square, Bitboard occupancy);
Bitboard GetRookAttackExact(int square, Bitboard occupancy);
Bitboard GetQueenAttackExact(int square, Bitboard occupancy);
extern U64 ISOLATED_PAWN_MASK_TABLE[64];
extern U64 PASSED_PAWN_MASK_TABLE[2][64];
extern U64 BACKWARD_PAWN_MASK_TABLE[2][64];
void InitIsolatedPawnMaskTable();
void InitPassedPawnMaskTable();