]> git.sesse.net Git - stockfish/blob - src/psqtab.h
Stockfish 1.8
[stockfish] / src / psqtab.h
1 /*
2   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3   Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4   Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
5
6   Stockfish is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   Stockfish is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #if !defined(PSQTAB_H_INCLUDED)
22 #define PSQTAB_H_INCLUDED
23
24 ////
25 //// Includes
26 ////
27
28 #include "value.h"
29
30
31 ////
32 //// Values tuned by Joona Kiiski
33 ////
34
35 static const int MgPST[][64] = { // [piece][square]
36   {},
37   { // Pawn
38       4,    5,    7,    8,    8,    7,    5,    4,
39     162,  183,  194,  204,  204,  194,  183,  162,
40     164,  185,  201,  227,  227,  201,  185,  164,
41     165,  186,  210,  247,  247,  210,  186,  165,
42     166,  187,  211,  229,  229,  211,  187,  166,
43     167,  188,  204,  209,  209,  204,  188,  167,
44     168,  189,  200,  210,  210,  200,  189,  168,
45       8,    9,   11,   12,   12,   11,    9,    8
46   },
47   { // Knight
48     675,  709,  742,  759,  759,  742,  709,  675,
49     721,  752,  785,  802,  802,  785,  752,  721,
50     765,  797,  827,  841,  841,  827,  797,  765,
51     794,  823,  853,  869,  869,  853,  823,  794,
52     808,  834,  865,  881,  881,  865,  834,  808,
53     807,  833,  864,  879,  879,  864,  833,  807,
54     764,  794,  823,  837,  837,  823,  794,  764,
55     624,  752,  783,  799,  799,  783,  752,  624
56   },
57   { // Bishop
58     795,  792,  796,  800,  800,  796,  792,  795,
59     824,  845,  841,  844,  844,  841,  845,  824,
60     830,  841,  855,  848,  848,  855,  841,  830,
61     835,  844,  848,  867,  867,  848,  844,  835,
62     834,  843,  847,  866,  866,  847,  843,  834,
63     827,  838,  852,  845,  845,  852,  838,  827,
64     821,  841,  837,  840,  840,  837,  841,  821,
65     821,  820,  824,  830,  830,  824,  820,  821
66   },
67   { // Rook
68     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
69     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
70     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
71     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
72     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
73     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
74     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
75     1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258
76   },
77   { // Queen
78     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
79     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
80     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
81     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
82     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
83     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
84     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
85     2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529
86   },
87   { // King
88     287,  311,  262,  214,  214,  262,  311,  287,
89     262,  287,  238,  190,  190,  238,  287,  262,
90     214,  238,  190,  142,  142,  190,  238,  214,
91     190,  214,  167,  119,  119,  167,  214,  190,
92     167,  190,  142,   94,   94,  142,  190,  167,
93     142,  167,  119,   69,   69,  119,  167,  142,
94     119,  142,   94,   46,   46,   94,  142,  119,
95      94,  119,   69,   21,   21,   69,  119,   94
96   }
97 };
98
99 static const int EgPST[][64] = { // [piece][square]
100   {},
101   { // Pawn
102       2,    0,   -2,   -4,   -4,   -2,    0,    2,
103     253,  251,  249,  247,  247,  249,  251,  253,
104     253,  251,  249,  247,  247,  249,  251,  253,
105     253,  251,  249,  247,  247,  249,  251,  253,
106     254,  252,  250,  248,  248,  250,  252,  254,
107     254,  252,  250,  248,  248,  250,  252,  254,
108     254,  252,  250,  248,  248,  250,  252,  254,
109       4,    2,    0,   -2,   -2,    0,    2,    4
110   },
111   { // Knight
112     741,  765,  791,  806,  806,  791,  765,  741,
113     766,  790,  818,  834,  834,  818,  790,  766,
114     790,  816,  844,  858,  858,  844,  816,  790,
115     803,  830,  855,  873,  873,  855,  830,  803,
116     803,  830,  855,  873,  873,  855,  830,  803,
117     790,  816,  844,  858,  858,  844,  816,  790,
118     766,  790,  818,  834,  834,  818,  790,  766,
119     741,  765,  791,  806,  806,  791,  765,  741
120   },
121   { // Bishop
122     798,  816,  826,  836,  836,  826,  816,  798,
123     814,  831,  841,  849,  849,  841,  831,  814,
124     820,  838,  847,  856,  856,  847,  838,  820,
125     829,  845,  855,  865,  865,  855,  845,  829,
126     830,  846,  856,  866,  866,  856,  846,  830,
127     821,  840,  850,  859,  859,  850,  840,  821,
128     815,  833,  844,  853,  853,  844,  833,  815,
129     798,  817,  828,  839,  839,  828,  817,  798
130   },
131   { // Rook
132     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
133     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
134     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
135     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
136     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
137     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
138     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
139     1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281
140   },
141   { // Queen
142     2478, 2504, 2516, 2528, 2528, 2516, 2504, 2478,
143     2504, 2528, 2540, 2552, 2552, 2540, 2528, 2504,
144     2516, 2540, 2552, 2564, 2564, 2552, 2540, 2516,
145     2528, 2552, 2564, 2576, 2576, 2564, 2552, 2528,
146     2528, 2552, 2564, 2576, 2576, 2564, 2552, 2528,
147     2516, 2540, 2552, 2564, 2564, 2552, 2540, 2516,
148     2504, 2528, 2540, 2552, 2552, 2540, 2528, 2504,
149     2478, 2504, 2516, 2528, 2528, 2516, 2504, 2478
150   },
151   { // King
152      18,   77,  105,  135,  135,  105,   77,   18,
153      77,  135,  165,  193,  193,  165,  135,   77,
154     105,  165,  193,  222,  222,  193,  165,  105,
155     135,  193,  222,  251,  251,  222,  193,  135,
156     135,  193,  222,  251,  251,  222,  193,  135,
157     105,  165,  193,  222,  222,  193,  165,  105,
158      77,  135,  165,  193,  193,  165,  135,   77,
159      18,   77,  105,  135,  135,  105,   77,   18
160   }
161 };
162
163 #endif // !defined(PSQTAB_H_INCLUDED)