X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpsqt.cpp;h=76e4e7decdf439838f2569cafe4b5ac1836dd676;hp=913d03530b263ee4ad37c05b17348f3314398539;hb=e082112cfeb6a40ca592a15983cdedb0210daf3a;hpb=d4af15f682c1967450233ab62cba1a6c5d601df6 diff --git a/src/psqt.cpp b/src/psqt.cpp index 913d0353..76e4e7de 100644 --- a/src/psqt.cpp +++ b/src/psqt.cpp @@ -18,8 +18,14 @@ along with this program. If not, see . */ +#include + #include "types.h" +Value PieceValue[PHASE_NB][PIECE_NB] = { +{ VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg }, +{ VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } }; + namespace PSQT { #define S(mg, eg) make_score(mg, eg) @@ -34,9 +40,9 @@ const Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S( 0, 0), S( 0, 0), S( 0, 0), S( 0, 0) }, { S(-19, 5), S( 1,-4), S( 7, 8), S( 3,-2) }, { S(-26,-6), S( -7,-5), S( 19, 5), S(24, 4) }, - { S(-25, 1), S(-14, 3), S( 16,-8), S(31,-3) }, - { S(-14, 6), S( 0, 9), S( -1, 7), S(17,-6) }, - { S(-14, 6), S(-13,-5), S(-10, 2), S(-6, 4) }, + { S(-25, 1), S(-14, 3), S( 20,-8), S(35,-3) }, + { S(-14, 6), S( 0, 9), S( 3, 7), S(21,-6) }, + { S(-14, 6), S(-13,-5), S( -6, 2), S(-2, 4) }, { S(-12, 1), S( 15,-9), S( -8, 1), S(-4,18) }, { S( 0, 0), S( 0, 0), S( 0, 0), S( 0, 0) } }, @@ -96,7 +102,7 @@ const Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { Score psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB]; -// init() initializes piece square tables: the white halves of the tables are +// init() initializes piece-square tables: the white halves of the tables are // copied from Bonus[] adding the piece value, then the black halves of the // tables are initialized by flipping and changing the sign of the white scores. void init() { @@ -110,8 +116,9 @@ void init() { for (Square s = SQ_A1; s <= SQ_H8; ++s) { - int edgeDistance = file_of(s) < FILE_E ? file_of(s) : FILE_H - file_of(s); - psq[BLACK][pt][~s] = -(psq[WHITE][pt][s] = v + Bonus[pt][rank_of(s)][edgeDistance]); + File f = std::min(file_of(s), FILE_H - file_of(s)); + psq[WHITE][pt][ s] = v + Bonus[pt][rank_of(s)][f]; + psq[BLACK][pt][~s] = -psq[WHITE][pt][s]; } } }