-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBANK_EVAL.asm
181 lines (130 loc) · 5.05 KB
/
BANK_EVAL.asm
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
SLOT 2
NEWRAMBANK BANK_EVAL
NEWBANK EVAL
; see https://www.chessprogramming.org/Simplified_Evaluation_Function
MAC VEQU
VALUE_{1} = {2}
ENDM
MAC LOBYTE
.byte <{2}
ENDM
MAC HIBYTE
.byte >{2}
ENDM
MAC VALUETABLE
{1} BLANK, 0
{1} PAWN, 100 ; white
{1} PAWN, 100 ; black
{1} KNIGHT, 320
{1} BISHOP, 375
{1} ROOK, 575
{1} QUEEN, 900
{1} KING, 10000
ENDM
VALUETABLE VEQU
DEF PieceValueLO
VALUETABLE LOBYTE
DEF PieceValueHI
VALUETABLE HIBYTE
;---------------------------------------------------------------------------------------------------
; Vectors to the position value tables for each piece
MAC POSVAL
.byte 0
.byte {1}(PositionalValue_PAWN - 22)
.byte {1}(PositionalValue_PAWN - 22)
.byte {1}(PositionalValue_KNIGHT - 22)
.byte {1}(PositionalValue_BISHOP - 22)
.byte {1}(PositionalValue_ROOK - 22)
.byte {1}(PositionalValue_QUEEN - 22)
.byte {1}(PositionalValue_KING_MIDGAME - 22)
ENDM
ALLOCATE PosValVecLO, 8
POSVAL <
ALLOCATE PosValVecHI, 8
POSVAL >
BZ = 50
MAC PVAL ;{ 10 entries }
.byte BZ + {1}
.byte BZ + {2}
.byte BZ + {3}
.byte BZ + {4}
.byte BZ + {5}
.byte BZ + {6}
.byte BZ + {7}
.byte BZ + {8}
.byte BZ
.byte BZ
ENDM
;---------------------------------------------------------------------------------------------------
PositionalValue_PAWN
PVAL 0, 0, 0, 0, 0, 0, 0, 0
PVAL 15, 10, 0, -20, -20, 0, 10, 15
PVAL 5, -5, -10, 0, 0, -10, -5, 5
PVAL 0, 0, 0, 10, 40, 0, 0, 0
PVAL 15, 15, 20, 20, 50, 20, 15, 15
PVAL 30, 30, 40, 50, 50, 40, 30, 30
PVAL 40, 50, 60, 70, 70, 60, 50, 40
PVAL 0, 0, 0, 0, 0, 0, 0, 0
;---------------------------------------------------------------------------------------------------
PositionalValue_KNIGHT
PVAL -50, -40, -30, -30, -30, -30, -40, -50
PVAL -40, -20, 0, 5, 5, 0, -20, -40
PVAL -30, 0, 20, 15, 15, 20, 0, -30
PVAL -30, 0, 15, 30, 30, 15, 0, -30
PVAL -30, 5, 15, 30, 30, 15, 5, -30
PVAL -30, 0, 10, 15, 15, 10, 0, -30
PVAL -40, -20, 30, 0, 0, 30, -20, -40
PVAL -50, -20, -30, -30, -30, -30, -20, -50
;---------------------------------------------------------------------------------------------------
PositionalValue_BISHOP
PVAL -20, -10, -50, -10, -10, -50, -10, -20
PVAL -10, 5, 0, 0, 0, 0, 5, -10
PVAL -10, 10, 10, 10, 10, 10, 10, -10
PVAL -10, 0, 10, 20, 20, 10, 0, -10
PVAL -10, 5, 5, 20, 20, 5, 5, -10
PVAL -10, 0, 5, 10, 10, 5, 0, -10
PVAL -10, 0, 0, 0, 0, 0, 0, -10
PVAL -20, -10, -10, -10, -10, -10, -10, -20
;---------------------------------------------------------------------------------------------------
PositionalValue_ROOK
PVAL -120, -10, 10, 25, 25, 10, -10, -200
PVAL -75, 0, 0, 0, 0, 0, 0, -200
PVAL -75, 0, 0, 0, 0, 0, 0, -150
PVAL -50, 0, 0, 0, 0, 0, 0, -100
PVAL -5, 0, 0, 0, 0, 0, 0, -50
PVAL -5, 0, 30, 30, 30, 30, 0, -5
PVAL 5, 10, 50, 50, 50, 50, 10, 5
PVAL 0, 0, 0, 0, 0, 0, 0, 0
;---------------------------------------------------------------------------------------------------
PositionalValue_QUEEN
PVAL -20, -10, -5, -5, -5, -10, -10, -20
PVAL -10, 0, 5, 0, 0, 0, 0, -10
PVAL -10, 5, 5, 5, 5, 25, 0, -10
PVAL -10, 0, 5, 25, 25, 25, 0, -10
PVAL -5, 0, 15, 55, 55, 55, 0, -5
PVAL -10, 0, 25, 75, 75, 75, 0, -10
PVAL -10, 0, 0, 0, 0, 0, 0, -10
PVAL -20, -10, -10, -5, -5, -10, -10, -20
;---------------------------------------------------------------------------------------------------
PositionalValue_KING_MIDGAME
PVAL 0, 0, 30, -20, 0, 10, 40, 10
PVAL 20, 20, 0, -10, -10, 0, 20, 20
PVAL -10, -20, -20, -20, -20, -20, -20, -10
PVAL -20, -30, -30, -40, -40, -30, -30, -20
PVAL -30, -40, -40, -50, -50, -40, -40, -30
PVAL -30, -40, -40, -50, -50, -40, -40, -30
PVAL -30, -40, -40, -50, -50, -40, -40, -30
PVAL -30, -40, -40, -50, -50, -40, -40, -30
;---------------------------------------------------------------------------------------------------
PositionalValue_KING_ENDGAME
PVAL -50, -30, -30, -30, -30, -30, -30, -50
PVAL -30, -30, 0, 0, 0, 0, -30, -30
PVAL -30, -10, 20, 30, 30, 20, -10, -30
PVAL -30, -10, 30, 40, 40, 30, -10, -30
PVAL -30, -10, 30, 40, 40, 30, -10, -30
PVAL -30, -10, 20, 30, 30, 20, -10, -30
PVAL -30, -20, -10, 0, 0, -10, -20, -30
PVAL -50, -40, -30, -20,- 20, -30, -40, -50
CHECK_BANK_SIZE "BANK_EVAL"
;---------------------------------------------------------------------------------------------------
; EOF