X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpsqt.cpp;h=41a9b499b4c4611dc1f8bd9ec7cfde46db3d104f;hp=60180adfb860b4d7ef43f903cf825615ffc9c3ef;hb=d4abf54247dbb4be611861acd21265cbbb16fce4;hpb=16c603ce9baa464c2f59cbd001987ec3a7cbc01f diff --git a/src/psqt.cpp b/src/psqt.cpp index 60180adf..41a9b499 100644 --- a/src/psqt.cpp +++ b/src/psqt.cpp @@ -23,8 +23,9 @@ #include "types.h" Value PieceValue[PHASE_NB][PIECE_NB] = { -{ VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg }, -{ VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } }; + { VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg }, + { VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } +}; namespace PSQT { @@ -99,25 +100,25 @@ const Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { #undef S -Score psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB]; +Score psq[PIECE_NB][SQUARE_NB]; // 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() { - for (PieceType pt = PAWN; pt <= KING; ++pt) + for (Piece pc = W_PAWN; pc <= W_KING; ++pc) { - PieceValue[MG][make_piece(BLACK, pt)] = PieceValue[MG][pt]; - PieceValue[EG][make_piece(BLACK, pt)] = PieceValue[EG][pt]; + PieceValue[MG][~pc] = PieceValue[MG][pc]; + PieceValue[EG][~pc] = PieceValue[EG][pc]; - Score v = make_score(PieceValue[MG][pt], PieceValue[EG][pt]); + Score v = make_score(PieceValue[MG][pc], PieceValue[EG][pc]); for (Square s = SQ_A1; s <= SQ_H8; ++s) { 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]; + psq[ pc][ s] = v + Bonus[pc][rank_of(s)][f]; + psq[~pc][~s] = -psq[pc][s]; } } }