Skip to content

Commit 537804d

Browse files
committed
Changing eval
Cleaning up evaluation constants + code for eventual transition to tapered eval
1 parent bebd886 commit 537804d

File tree

5 files changed

+85
-79
lines changed

5 files changed

+85
-79
lines changed

eval.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#ifndef EVAL_H
2+
#define EVAL_H
3+
4+
// Evaluation constants
5+
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;
9+
const int QueenOpenFile = 5;
10+
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
23+
};
24+
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
34+
};
35+
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
45+
};
46+
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
56+
};
57+
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
67+
};
68+
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
78+
};
79+
80+
#endif

evaluate.c

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,8 @@
22

33
#include "stdio.h"
44
#include "defs.h"
5+
#include "eval.h"
56

6-
static const int PawnIsolated = -10;
7-
static const int PawnPassed[8] = { 0, 5, 10, 20, 35, 60, 100, 200 };
8-
static const int RookOpenFile = 10;
9-
static const int RookSemiOpenFile = 5;
10-
static const int QueenOpenFile = 5;
11-
static const int QueenSemiOpenFile = 3;
12-
static const int BishopPair = 30;
13-
14-
static 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
23-
};
24-
25-
static 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
34-
};
35-
36-
static 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
45-
};
46-
47-
static 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
56-
};
57-
58-
static 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
67-
};
68-
69-
static 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
78-
};
79-
// sjeng 11.2
80-
//8/6R1/2k5/6P1/8/8/4nP2/6K1 w - - 1 41
817
static int MaterialDraw(const S_BOARD *pos) {
828

839
ASSERT(CheckBoard(pos));

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
all:
2-
gcc xboard.c seeChess.c uci.c evaluate.c pvtable.c init.c bitboards.c hashkeys.c board.c data.c attack.c io.c movegen.c validate.c makemove.c perft.c search.c misc.c -o seeChess -O3 -s
2+
gcc xboard.c seeChess.c uci.c evaluate.c eval.h pvtable.c init.c bitboards.c hashkeys.c board.c data.c attack.c io.c movegen.c validate.c makemove.c perft.c search.c misc.c -o seeChess -O3 -s

seeChess.exe

0 Bytes
Binary file not shown.

uci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ void Uci_Loop(S_BOARD *pos, S_SEARCHINFO *info) {
115115
setbuf(stdout, NULL);
116116

117117
char line[INPUTBUFFER];
118-
printf("id name %s\n",NAME);
119-
printf("id author Bctboi23\n");
118+
printf("id name %s\n",NAME);
119+
printf("id author Bctboi23\n");
120120
printf("option name Hash type spin default 256 min 4 max %d\n",MAX_HASH);
121-
printf("uciok\n");
121+
printf("uciok\n\n");
122122

123123
int MB = 256;
124124

0 commit comments

Comments
 (0)