-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluation.h
127 lines (117 loc) · 3.51 KB
/
evaluation.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
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
#ifndef _EVALUATION_H_
#define _EVALUATION_H_
#include "pieces.h"
#include "magic.h"
#include "hash.h"
#define NORAND
///////////////////////////////////////////////////////////////
// Scoring magic
#define PAWN_SCORE 100
#define KNIGHT_SCORE 310
#define BISHOP_SCORE 305
#define ROOK_SCORE 500
#define QUEEN_SCORE 850
#define KING_SCORE 64000
const int PieceScore[6] =
{
PAWN_SCORE, KNIGHT_SCORE, BISHOP_SCORE,
ROOK_SCORE, QUEEN_SCORE, KING_SCORE
};
const int AttackScore[64] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 8, 8, 8, 8, 1, 0,
0, 1, 8, 25, 25, 8, 1, 0,
0, 1, 8, 25, 25, 8, 1, 0,
0, 1, 8, 8, 8, 8, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
const int IsolatedPawnPenalty[8] = {10, 12, 14, 18, 18, 14, 12, 10};
const int PiecePositionScore[7][64] =
{
// Pawn scores White
{
0, 0, 0, 0, 0, 0, 0, 0,
20, 26, 26, 28, 28, 26, 26, 20,
12, 14, 16, 21, 21, 16, 14, 12,
8, 10, 12, 18, 18, 12, 10, 8,
4, 6, 8, 16, 16, 8, 6, 4,
2, 2, 4, 6, 6, 4, 2, 2,
0, 0, 0, -4, -4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// Knight scores White
{
-40, -10, - 5, - 5, - 5, - 5, -10, -40,
- 5, 5, 5, 5, 5, 5, 5, - 5,
- 5, 5, 10, 15, 15, 10, 5, - 5,
- 5, 5, 10, 15, 15, 10, 5, - 5,
- 5, 5, 10, 15, 15, 10, 5, - 5,
- 5, 5, 8, 8, 8, 8, 5, - 5,
- 5, 0, 5, 5, 5, 5, 0, - 5,
-50, -20, -10, -10, -10, -10, -20, -50,
},
// Bishop scores White
{
-40, -20, -15, -15, -15, -15, -20, -40,
0, 5, 5, 5, 5, 5, 5, 0,
0, 10, 10, 18, 18, 10, 10, 0,
0, 10, 10, 18, 18, 10, 10, 0,
0, 5, 10, 18, 18, 10, 5, 0,
0, 0, 5, 5, 5, 5, 0, 0,
0, 5, 0, 0, 0, 0, 5, 0,
-50, -20, -10, -20, -20, -10, -20, -50
},
// Rook scores White
{
10, 10, 10, 10, 10, 10, 10, 10,
5, 5, 5, 10, 10, 5, 5, 5,
0, 0, 5, 10, 10, 5, 0, 0,
0, 0, 5, 10, 10, 5, 0, 0,
0, 0, 5, 10, 10, 5, 0, 0,
0, 0, 5, 10, 10, 5, 0, 0,
0, 0, 5, 10, 10, 5, 0, 0,
0, 0, 5, 10, 10, 5, 0, 0,
},
// Queen scores White
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 10, 10, 10, 10, 0, 0,
0, 0, 10, 15, 15, 10, 0, 0,
0, 0, 10, 15, 15, 10, 0, 0,
0, 0, 10, 10, 10, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// King scores White
{
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,
12, 8, 4, 0, 0, 4, 8, 12,
16, 12, 8, 4, 4, 8, 12, 16,
24, 20, 16, 12, 12, 16, 20, 24,
24, 24, 24, 16, 16, 6, 32, 32
},
// King end-game scores White
{
-30, -5, 0, 0, 0, 0, -5, -30,
-5, 0, 0, 0, 0, 0, 0, -5,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 5, 5, 0, 0, 0,
0, 0, 0, 5, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
-10, 0, 0, 0, 0, 0, 0, -10,
-40,-10, -5, -5, -5, -5, -10, -40
}
};
inline void evalPieces(const Board &cboard, int &wscore, int &bscore);
inline void evalPawn(const Board &cboard, const int gameStage, int &wscore, int &bscore);
inline void evalKing(const Board &cboard, const bool gameStage, int &wscore, int &bscore);
int CalculateScore(const Board &cboard);
int SCalculateScore(const Board &cboard);
#endif