-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.shl
More file actions
74 lines (61 loc) · 1.05 KB
/
constants.shl
File metadata and controls
74 lines (61 loc) · 1.05 KB
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
67
68
69
70
71
72
73
74
EMPTY = 0
PAWN = 1
KNIGHT = 2
BISHOP = 3
ROOK = 4
QUEEN = 5
KING = 6
WHITE = 8
BLACK = 16
A8 = 0
B8 = 1
C8 = 2
D8 = 3
E8 = 4
F8 = 5
G8 = 6
H8 = 7
A1 = 56
B1 = 57
C1 = 58
D1 = 59
E1 = 60
F1 = 61
G1 = 62
H1 = 63
to get_piece_color p
if p == EMPTY
give 0
if p < BLACK
give WHITE
else
give BLACK
to get_piece_type p
if p == EMPTY
give EMPTY
if p < BLACK
give p - WHITE
else
give p - BLACK
# Deterministic 64-bit LCG
lcg_state = [123456789]
to next_random
lcg_state[0] = (lcg_state[0] * 6364136223846793005 + 1442695040888963407) % 18446744073709551616
give lcg_state[0]
ZOBRIST_PIECES = []
ZOBRIST_TURN = []
ZOBRIST_CASTLING = []
ZOBRIST_EP = []
to init_zobrist
repeat 1472 times
r_val = next_random()
add r_val to ZOBRIST_PIECES
r_val = next_random()
add r_val to ZOBRIST_TURN
repeat 4 times
r_val = next_random()
add r_val to ZOBRIST_CASTLING
repeat 8 times
r_val = next_random()
add r_val to ZOBRIST_EP
init_zobrist()