Skip to content

Commit 9612397

Browse files
authored
Merge pull request #2 from bctboi23/tapered-eval
Tapered eval
2 parents 993a14c + b11b92b commit 9612397

File tree

9 files changed

+270
-115
lines changed

9 files changed

+270
-115
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
# SeeChess
1+
# CeeChess
22
Hi! I am a bot written in C, heavily inspired by the Vice engine and video series done by Bluefever! If you want to try your hand at facing me, I am on lichess at https://lichess.org/@/seeChessBot!
33

44
**Rating:**
5+
Version 1.2 Rating:
56
```
67
Rank Name Elo + - games score oppo. draws
78
1 SeeChess_v1.2 : 2212 21 21 802 60.5 % 2139 28.9 %
89
2 MORA_1.1.0 : 2207 35 35 268 49.1 % 2213 31.0 %
910
3 Raven0.50 : 2139 37 37 267 39.5 % 2213 24.3 %
1011
4 Vice10-64 : 2066 36 36 267 30.0 % 2213 31.5 %
1112
```
13+
Version 1.3 Rating:
14+
```
15+
Rank Name Elo + - games
16+
1 CeeChess-v1.3 : 2310 19 19 1000
17+
2 SeeChessTapered: 2238 17 17 1000
18+
3 SeeChess-v1.2 : 2212 17 17 1000
19+
```
1220

1321
# Engine Features
1422

@@ -35,14 +43,14 @@ The Engine searches with a Principal Variation Search inside a Negamax framework
3543

3644
**Evaluation:**
3745
- Material
38-
- PSQT (Piece Square Tables)
46+
- PSQT (Midgame and Endgame, from Lyudmil)
3947
- Bishop pair heuristic
4048
- Simple Passed Pawn evaluation
4149
- Isolated pawn heuristic
4250
- Open file heuristics (for Rook and Queen)
51+
- Tapered evaluation
4352

4453
**Planned Improvements (ordered by percieved feasibility):**
45-
- Tapered Evaluation
4654
- Polyglot Opening Book
4755
- Syzygy Tablebases
4856
- Mobility

bin/CeeChess-v1.3.exe

84.5 KB
Binary file not shown.

bin/seeChess-v1.2.exe

-81 KB
Binary file not shown.

src/seeChess.c renamed to src/CeeChess.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main() {
2121
setbuf(stdin, NULL);
2222
setbuf(stdout, NULL);
2323

24-
printf("Welcome to seeChess! Type 'seeChess' for console mode...\n");
24+
printf("Welcome to CeeChess! Type 'CeeChess' for console mode...\n");
2525

2626
char line[256];
2727
while (TRUE) {
@@ -40,7 +40,7 @@ int main() {
4040
XBoard_Loop(pos, info);
4141
if(info->quit == TRUE) break;
4242
continue;
43-
} else if (!strncmp(line, "seeChess",8)) {
43+
} else if (!strncmp(line, "CeeChess",8)) {
4444
Console_Loop(pos, info);
4545
if(info->quit == TRUE) break;
4646
continue;

src/defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exit(1);}
2323

2424
typedef unsigned long long U64;
2525

26-
#define NAME "SeeChess_v1.2"
26+
#define NAME "CeeChess_v1.3"
2727
#define BRD_SQ_NUM 120
2828

2929
#define MAXGAMEMOVES 2048

src/eval.h

Lines changed: 151 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,170 @@
11
#ifndef EVAL_H
22
#define EVAL_H
33

4-
// Evaluation constants
4+
// Game phase constants
5+
const int minorPhase = 1;
6+
const int rookPhase = 2;
7+
const int queenPhase = 4;
8+
const int totalPhase = minorPhase * 8 + rookPhase * 4 + queenPhase * 2;
9+
10+
// Midgame constants
11+
const int BishopPairMG = 20;
12+
const int PawnPassedMG[8] = { 0, 5, 10, 20, 35, 50, 75, 150 };
13+
14+
// Endgame constants
15+
const int BishopPairEG = 35;
16+
const int PawnPassedEG[8] = { 0, 5, 15, 30, 50, 75, 125, 250 };
17+
18+
// Full game constants
519
const int PawnIsolated = -10;
6-
const int PawnPassed[8] = { 0, 5, 10, 20, 35, 60, 100, 200 };
7-
const int RookOpenFile = 10;
8-
const int RookSemiOpenFile = 5;
920
const int QueenOpenFile = 5;
1021
const int QueenSemiOpenFile = 3;
11-
const int BishopPair = 30;
12-
13-
// Piece Square Tables
14-
const int PawnTable[64] = {
15-
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
16-
10 , 10 , 0 , -10 , -10 , 0 , 10 , 10 ,
17-
5 , 0 , 0 , 5 , 5 , 0 , 0 , 5 ,
18-
0 , 0 , 10 , 20 , 20 , 10 , 0 , 0 ,
19-
5 , 5 , 5 , 10 , 10 , 5 , 5 , 5 ,
20-
10 , 10 , 10 , 20 , 20 , 10 , 10 , 10 ,
21-
20 , 20 , 20 , 30 , 30 , 20 , 20 , 20 ,
22-
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
22+
const int RookOpenFile = 10;
23+
const int RookSemiOpenFile = 5;
24+
25+
// Piece Square Tables (by Lyudmil)
26+
const int PawnMG[64] =
27+
{
28+
0, 0, 0, 0, 0, 0, 0, 0,
29+
-5, -2, 4, 5, 5, 4, -2, -5,
30+
-4, -2, 5, 7, 7, 5, -2, -4,
31+
-2, -1, 9, 13, 13, 9, -1, -2,
32+
2, 4, 13, 21, 21, 13, 4, 2,
33+
10, 21, 25, 29, 29, 25, 21, 10,
34+
1, 2, 5, 9, 9, 5, 2, 1, // Pawns 7 Rank
35+
0, 0, 0, 0, 0, 0, 0, 0
36+
};
37+
38+
const int PawnEG[64] =
39+
{
40+
0, 0, 0, 0, 0, 0, 0, 0,
41+
-3, -1, 2, 3, 3, 2, -1, -3,
42+
-2, -1, 3, 4, 4, 3, -1, -2,
43+
-1, 0, 4, 7, 7, 4, 0, -1,
44+
1, 2, 7, 11, 11, 7, 2, 1,
45+
5, 11, 13, 14, 14, 13, 11, 5,
46+
0, 1, 3, 5, 5, 3, 1, 0, // Pawns 7 Rank
47+
0, 0, 0, 0, 0, 0, 0, 0
48+
};
49+
50+
const int KnightMG[64] =
51+
{
52+
-31, -23, -20, -16, -16, -20, -23, -31,
53+
-23, -16, -12, -8, -8, -12, -16, -23,
54+
-8, -4, 0, 8, 8, 0, -4, -8,
55+
-4, 8, 12, 16, 16, 12, 8, -4,
56+
8, 16, 20, 23, 23, 20, 16, 8,
57+
23, 27, 31, 35, 35, 31, 27, 23,
58+
4, 8, 12, 16, 16, 12, 8, 4,
59+
4, 4, 4, 4, 4, 4, 4, 4,
60+
};
61+
62+
const int KnightEG[64] =
63+
{
64+
-39, -27, -23, -20, -20, -23, -27, -39,
65+
-27, -20, -12, -8, -8, -12, -20, -27,
66+
-8, -4, 0, 8, 8, 0, -4, -8,
67+
-4, 8, 12, 16, 16, 12, 8, -4,
68+
8, 16, 20, 23, 23, 20, 16, 8,
69+
12, 23, 27, 31, 31, 27, 23, 12,
70+
-2, 2, 4, 8, 8, 4, 2, -2,
71+
-16, -8, -4, -4, -4, -4, -8, -16,
72+
};
73+
74+
const int BishopMG[64] =
75+
{
76+
-31, -23, -20, -16, -16, -20, -23, -31,
77+
-23, -16, -12, -8, -8, -12, -16, -23,
78+
-8, -4, 0, 8, 8, 0, -4, -8,
79+
-4, 8, 12, 16, 16, 12, 8, -4,
80+
8, 16, 20, 23, 23, 20, 16, 8,
81+
23, 27, 31, 35, 35, 31, 27, 23,
82+
4, 8, 12, 16, 16, 12, 8, 4,
83+
4, 4, 4, 4, 4, 4, 4, 4,
84+
};
85+
86+
const int BishopEG[64] =
87+
{
88+
-39, -27, -23, -20, -20, -23, -27, -39,
89+
-27, -20, -12, -8, -8, -12, -20, -27,
90+
-8, -4, 0, 8, 8, 0, -4, -8,
91+
-4, 8, 12, 16, 16, 12, 8, -4,
92+
8, 16, 20, 23, 23, 20, 16, 8,
93+
12, 23, 27, 31, 31, 27, 23, 12,
94+
-2, 2, 4, 8, 8, 4, 2, -2,
95+
-16, -8, -4, -4, -4, -4, -8, -16,
96+
};
97+
98+
const int RookMG[64] =
99+
{
100+
-10, -8, -6, -4, -4, -6, -8, -10,
101+
-8, -6, -4, -2, -2, -4, -6, -8,
102+
-4, -2, 0, 4, 4, 0, -2, -4,
103+
-2, 2, 4, 8, 8, 4, 2, -2,
104+
2, 4, 8, 12, 12, 8, 4, 2,
105+
4, 8, 12, 16, 16, 12, 8, 4,
106+
20, 21, 23, 23, 23, 23, 21, 20,
107+
18, 18, 20, 20, 20, 20, 18, 18,
23108
};
24109

25-
const int KnightTable[64] = {
26-
0 , -10 , 0 , 0 , 0 , 0 , -10 , 0 ,
27-
0 , 0 , 0 , 5 , 5 , 0 , 0 , 0 ,
28-
0 , 0 , 10 , 10 , 10 , 10 , 0 , 0 ,
29-
0 , 0 , 10 , 20 , 20 , 10 , 5 , 0 ,
30-
5 , 10 , 15 , 20 , 20 , 15 , 10 , 5 ,
31-
5 , 10 , 10 , 20 , 20 , 10 , 10 , 5 ,
32-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
33-
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
110+
const int RookEG[64] =
111+
{
112+
-10, -8, -6, -4, -4, -6, -8, -10,
113+
-8, -6, -4, -2, -2, -4, -6, -8,
114+
-4, -2, 0, 4, 4, 0, -2, -4,
115+
-2, 2, 4, 8, 8, 4, 2, -2,
116+
2, 4, 8, 12, 12, 8, 4, 2,
117+
4, 8, 12, 16, 16, 12, 8, 4,
118+
20, 21, 23, 23, 23, 23, 21, 20,
119+
18, 18, 20, 20, 20, 20, 18, 18,
34120
};
35121

36-
const int BishopTable[64] = {
37-
0 , 0 , -10 , 0 , 0 , -10 , 0 , 0 ,
38-
0 , 0 , 0 , 10 , 10 , 0 , 0 , 0 ,
39-
0 , 0 , 10 , 15 , 15 , 10 , 0 , 0 ,
40-
0 , 10 , 15 , 20 , 20 , 15 , 10 , 0 ,
41-
0 , 10 , 15 , 20 , 20 , 15 , 10 , 0 ,
42-
0 , 0 , 10 , 15 , 15 , 10 , 0 , 0 ,
43-
0 , 0 , 0 , 10 , 10 , 0 , 0 , 0 ,
44-
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
122+
const int QueenMG[64] =
123+
{
124+
-23, -20, -16, -12, -12, -16, -20, -23,
125+
-18, -14, -12, -8, -8, -12, -14, -18,
126+
-16, -8, 0, 8, 8, 0, -8, -16,
127+
-8, 0, 12, 16, 16, 12, 0, -8,
128+
4, 12, 16, 23, 23, 16, 12, 4,
129+
16, 23, 27, 31, 31, 27, 23, 16,
130+
4, 12, 16, 23, 23, 16, 12, 4,
131+
2, 8, 12, 12, 12, 12, 8, 2,
45132
};
46133

47-
const int RookTable[64] = {
48-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
49-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
50-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
51-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
52-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
53-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0 ,
54-
25 , 25 , 25 , 25 , 25 , 25 , 25 , 25 ,
55-
0 , 0 , 5 , 10 , 10 , 5 , 0 , 0
134+
const int QueenEG[64] =
135+
{
136+
-23, -20, -16, -12, -12, -16, -20, -23,
137+
-18, -14, -12, -8, -8, -12, -14, -18,
138+
-16, -8, 0, 8, 8, 0, -8, -16,
139+
-8, 0, 12, 16, 16, 12, 0, -8,
140+
4, 12, 16, 23, 23, 16, 12, 4,
141+
16, 23, 27, 31, 31, 27, 23, 16,
142+
4, 12, 16, 23, 23, 16, 12, 4,
143+
2, 8, 12, 12, 12, 12, 8, 2,
56144
};
57145

58-
const int KingE[64] = {
59-
-50 , -10 , 0 , 0 , 0 , 0 , -10 , -50 ,
60-
-10, 0 , 10 , 10 , 10 , 10 , 0 , -10 ,
61-
0 , 10 , 20 , 20 , 20 , 20 , 10 , 0 ,
62-
0 , 10 , 20 , 40 , 40 , 20 , 10 , 0 ,
63-
0 , 10 , 20 , 40 , 40 , 20 , 10 , 0 ,
64-
0 , 10 , 20 , 20 , 20 , 20 , 10 , 0 ,
65-
-10, 0 , 10 , 10 , 10 , 10 , 0 , -10 ,
66-
-50 , -10 , 0 , 0 , 0 , 0 , -10 , -50
146+
const int KingMG[64] =
147+
{
148+
40, 50, 30, 10, 10, 30, 50, 40,
149+
30, 40, 20, 0, 0, 20, 40, 30,
150+
10, 20, 0, -20, -20, 0, 20, 10,
151+
0, 10, -10, -30, -30, -10, 10, 0,
152+
-10, 0, -20, -40, -40, -20, 0, -10,
153+
-20, -10, -30, -50, -50, -30, -10, -20,
154+
-30, -20, -40, -60, -60, -40, -20, -30,
155+
-40, -30, -50, -70, -70, -50, -30, -40 ,
67156
};
68157

69-
const int KingO[64] = {
70-
0 , 5 , 5 , -10 , -10 , 0 , 10 , 5 ,
71-
-30 , -30 , -30 , -30 , -30 , -30 , -30 , -30 ,
72-
-50 , -50 , -50 , -50 , -50 , -50 , -50 , -50 ,
73-
-70 , -70 , -70 , -70 , -70 , -70 , -70 , -70 ,
74-
-70 , -70 , -70 , -70 , -70 , -70 , -70 , -70 ,
75-
-70 , -70 , -70 , -70 , -70 , -70 , -70 , -70 ,
76-
-70 , -70 , -70 , -70 , -70 , -70 , -70 , -70 ,
77-
-70 , -70 , -70 , -70 , -70 , -70 , -70 , -70
158+
const int KingEG[64] =
159+
{
160+
-34, -30, -28, -27, -27, -28, -30, -34,
161+
-17, -13, -11, -10, -10, -11, -13, -17,
162+
-2, 2, 4, 5, 5, 4, 2, -2,
163+
11, 15, 17, 18, 18, 17, 15, 11,
164+
22, 26, 28, 29, 29, 28, 26, 22,
165+
31, 34, 37, 38, 38, 37, 34, 31,
166+
38, 41, 44, 45, 45, 44, 41, 38,
167+
42, 46, 48, 50, 50, 48, 46, 42,
78168
};
79169

80170
#endif

0 commit comments

Comments
 (0)