Use relative values in piece square tables
[glaurung_clone.git] / src / psqtab.h
blob14156ecd6ced0e843814dbd0b89b70cb22b77574
1 /*
2 Glaurung, a UCI chess playing engine.
3 Copyright (C) 2004-2008 Tord Romstad
5 Glaurung is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 Glaurung is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #if !defined(PSQTAB_H_INCLUDED)
21 #define PSQTAB_H_INCLUDED
23 ////
24 //// Includes
25 ////
27 #include "position.h"
28 #include "value.h"
31 ////
32 //// Variables
33 ////
35 static const Value MP = PawnValueMidgame;
36 static const Value MK = KnightValueMidgame;
37 static const Value MB = BishopValueMidgame;
38 static const Value MR = RookValueMidgame;
39 static const Value MQ = QueenValueMidgame;
41 static const int MgPST[][64] = {
42 { },
43 {// Pawn
44 // A B C D E F G H
45 0, 0, 0, 0, 0, 0, 0, 0,
46 MP-38, MP-12, MP- 0, MP+12, MP+12, MP- 0, MP-12, MP-38,
47 MP-38, MP-12, MP+ 6, MP+38, MP+38, MP+ 6, MP-12, MP-38,
48 MP-38, MP-12, MP+16, MP+64, MP+64, MP+16, MP-12, MP-38,
49 MP-38, MP-12, MP+16, MP+38, MP+38, MP+16, MP-12, MP-38,
50 MP-38, MP-12, MP+ 6, MP+12, MP+12, MP+ 6, MP-12, MP-38,
51 MP-38, MP-12, MP- 0, MP+12, MP+12, MP- 0, MP-12, MP-38,
52 0, 0, 0, 0, 0, 0, 0, 0
54 {// Knight
55 // A B C D E F G H
56 MK-128, MK-102, MK-76, MK-64, MK-64, MK-76, MK-102, MK-128,
57 MK- 89, MK- 64, MK-38, MK-25, MK-25, MK-38, MK- 64, MK- 89,
58 MK- 51, MK- 25, MK- 0, MK+12, MK+12, MK- 0, MK- 25, MK- 51,
59 MK- 25, MK- 0, MK+25, MK+38, MK+38, MK+25, MK- 0, MK- 25,
60 MK- 12, MK+ 12, MK+38, MK+51, MK+51, MK+38, MK+ 12, MK- 12,
61 MK- 12, MK+ 12, MK+38, MK+51, MK+51, MK+38, MK+ 12, MK- 12,
62 MK- 51, MK- 25, MK- 0, MK+12, MK+12, MK- 0, MK- 25, MK- 51,
63 MK-182, MK- 64, MK-38, MK-25, MK-25, MK-38, MK- 64, MK-182
65 {// Bishop
66 // A B C D E F G H
67 MB-46, MB-46, MB-40, MB-35, MB-35, MB-40, MB-46, MB-46,
68 MB-20, MB- 0, MB- 5, MB- 0, MB- 0, MB- 5, MB- 0, MB-20,
69 MB-15, MB- 5, MB+10, MB+ 5, MB+ 5, MB+10, MB- 5, MB-15,
70 MB-10, MB- 0, MB+ 5, MB+20, MB+20, MB+ 5, MB- 0, MB-10,
71 MB-10, MB- 0, MB+ 5, MB+20, MB+20, MB+ 5, MB- 0, MB-10,
72 MB-15, MB- 5, MB+10, MB+ 5, MB+ 5, MB+10, MB- 5, MB-15,
73 MB-20, MB- 0, MB- 5, MB- 0, MB- 0, MB- 5, MB- 0, MB-20,
74 MB-20, MB-20, MB-15, MB-10, MB-10, MB-15, MB-20, MB-20
76 {// Rook
77 // A B C D E F G H
78 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
79 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
80 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
81 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
82 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
83 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
84 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18,
85 MR-18, MR-10, MR-3, MR+4, MR+4, MR-3, MR-10, MR-18
87 {// Queen
88 //A B C D E F G H
89 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
90 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
91 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
92 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
93 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
94 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
95 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ,
96 MQ, MQ, MQ, MQ, MQ, MQ, MQ, MQ
98 {// King
99 //A B C D E F G H
100 302, 328, 276, 225, 225, 276, 328, 302,
101 276, 302, 251, 200, 200, 251, 302, 276,
102 225, 251, 200, 149, 149, 200, 251, 225,
103 200, 225, 175, 124, 124, 175, 225, 200,
104 175, 200, 149, 98, 98, 149, 200, 175,
105 149, 175, 124, 72, 72, 124, 175, 149,
106 124, 149, 98, 47, 47, 98, 149, 124,
107 98, 124, 72, 21, 21, 72, 124, 98
111 static const Value EP = PawnValueEndgame;
112 static const Value EK = KnightValueEndgame;
113 static const Value EB = BishopValueEndgame;
114 static const Value ER = RookValueEndgame;
115 static const Value EQ = QueenValueEndgame;
117 static const int EgPST[][64] = {
118 { },
119 {// Pawn
120 //A B C D E F G H
121 0, 0, 0, 0, 0, 0, 0, 0,
122 EP, EP, EP, EP, EP, EP, EP, EP,
123 EP, EP, EP, EP, EP, EP, EP, EP,
124 EP, EP, EP, EP, EP, EP, EP, EP,
125 EP, EP, EP, EP, EP, EP, EP, EP,
126 EP, EP, EP, EP, EP, EP, EP, EP,
127 EP, EP, EP, EP, EP, EP, EP, EP,
128 0, 0, 0, 0, 0, 0, 0, 0
130 {// Knight
131 // A B C D E F G H
132 EK-102, EK-76, EK-51, EK-38, EK-38, EK-51, EK-76, EK-102,
133 EK- 76, EK-51, EK-25, EK-12, EK-12, EK-25, EK-51, EK-76,
134 EK- 51, EK-25, EK- 0, EK+12, EK+12, EK- 0, EK-25, EK-51,
135 EK- 38, EK-12, EK+12, EK+25, EK+25, EK+12, EK-12, EK-38,
136 EK- 38, EK-12, EK+12, EK+25, EK+25, EK+12, EK-12, EK-38,
137 EK- 51, EK-25, EK- 0, EK+12, EK+12, EK- 0, EK-25, EK-51,
138 EK- 76, EK-51, EK-25, EK-12, EK-12, EK-25, EK-51, EK-76,
139 EK-102, EK-76, EK-51, EK-38, EK-38, EK-51, EK-76, EK-102
141 {// Bishop
142 // A B C D E F G H
143 EB-46, EB-30, EB-23, EB-15, EB-15, EB-23, EB-30, EB-46,
144 EB-30, EB-15, EB- 7, EB- 0, EB- 0, EB- 7, EB-15, EB-30,
145 EB-23, EB- 7, EB- 0, EB+ 7, EB+ 7, EB- 0, EB- 7, EB-23,
146 EB-15, EB- 0, EB+ 7, EB+15, EB+15, EB+ 7, EB- 0, EB-15,
147 EB-15, EB- 0, EB+ 7, EB+15, EB+15, EB+ 7, EB- 0, EB-15,
148 EB-23, EB- 7, EB- 0, EB+ 7, EB+ 7, EB- 0, EB- 7, EB-23,
149 EB-30, EB-15, EB- 7, EB- 0, EB- 0, EB- 7, EB-15, EB-30,
150 EB-46, EB-30, EB-23, EB-15, EB-15, EB-23, EB-30, EB-46
152 {// Rook
153 // A B C D E F G H
154 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
155 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
156 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
157 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
158 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
159 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
160 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3,
161 ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3, ER-3
163 {// Queen
164 // A B C D E F G H
165 EQ-61, EQ-40, EQ-30, EQ-20, EQ-20, EQ-30, EQ-40, EQ-61,
166 EQ-40, EQ-20, EQ-10, EQ- 0, EQ- 0, EQ-10, EQ-20, EQ-40,
167 EQ-30, EQ-10, EQ- 0, EQ+10, EQ+10, EQ- 0, EQ-10, EQ-30,
168 EQ-20, EQ- 0, EQ+10, EQ+20, EQ+20, EQ+10, EQ- 0, EQ-20,
169 EQ-20, EQ- 0, EQ+10, EQ+20, EQ+20, EQ+10, EQ- 0, EQ-20,
170 EQ-30, EQ-10, EQ- 0, EQ+10, EQ+10, EQ- 0, EQ-10, EQ-30,
171 EQ-40, EQ-20, EQ-10, EQ- 0, EQ- 0, EQ-10, EQ-20, EQ-40,
172 EQ-61, EQ-40, EQ-30, EQ-20, EQ-20, EQ-30, EQ-40, EQ-61
174 {// King
175 //A B C D E F G H
176 16, 78, 108, 139, 139, 108, 78, 16,
177 78, 139, 170, 200, 200, 170, 139, 78,
178 108, 170, 200, 230, 230, 200, 170, 108,
179 139, 200, 230, 261, 261, 230, 200, 139,
180 139, 200, 230, 261, 261, 230, 200, 139,
181 108, 170, 200, 230, 230, 200, 170, 108,
182 78, 139, 170, 200, 200, 170, 139, 78,
183 16, 78, 108, 139, 139, 108, 78, 16
188 #endif // !defined(PSQTAB_H_INCLUDED)