X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpsqt.cpp;h=7fa36ac83dd4a4d5b0e8e19f96f59f5699a4a049;hp=6469c43a1dbdbc8f3b77d4bca09ddfde934247fe;hb=86ee4eb84d54dac3f9de5b455ba41909c7722173;hpb=3804effb341b3008326a1613923177eb83d02826 diff --git a/src/psqt.cpp b/src/psqt.cpp index 6469c43a..7fa36ac8 100644 --- a/src/psqt.cpp +++ b/src/psqt.cpp @@ -2,7 +2,7 @@ Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad - Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + Copyright (C) 2015-2020 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,11 +21,7 @@ #include #include "types.h" - -Value PieceValue[PHASE_NB][PIECE_NB] = { - { VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg }, - { VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } -}; +#include "bitboard.h" namespace PSQT { @@ -59,14 +55,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-48,-46), S( 1,-42), S(-14,-37), S(-23,-24) } }, { // Rook - { S(-26, -7), S(-19,-15), S( -8,-10), S(-1,-10) }, - { S(-21,-19), S(-24, -7), S( -6, 0), S( 5, -1) }, - { S(-29, -1), S(-20, -4), S( 6, 8), S(12,-19) }, - { S(-14, -1), S( -1, -3), S(-12, -8), S(-7, 10) }, - { S(-37, 1), S( -6, 13), S( 0, 14), S(10, 4) }, - { S(-16, 9), S( -1, 15), S( 4, -8), S( 1, 16) }, - { S( -1, 2), S( 10, 4), S( 13, 23), S(23, -4) }, - { S( -2, 21), S(-21, -3), S( 4, 26), S(-1, 20) } + { S(-31, -9), S(-20,-13), S(-14,-10), S(-5, -9) }, + { S(-21,-12), S(-13, -9), S( -8, -1), S( 6, -2) }, + { S(-25, 6), S(-11, -8), S( -1, -2), S( 3, -6) }, + { S(-13, -6), S( -5, 1), S( -4, -9), S(-6, 7) }, + { S(-27, -5), S(-15, 8), S( -4, 7), S( 3, -6) }, + { S(-22, 6), S( -2, 1), S( 6, -7), S(12, 10) }, + { S( -2, 4), S( 12, 5), S( 16, 20), S(18, -5) }, + { S(-17, 18), S(-19, 0), S( -1, 19), S( 9, 13) } }, { // Queen { S( 3,-69), S(-5,-57), S(-5,-47), S( 4,-26) }, @@ -79,8 +75,8 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-2,-75), S(-2,-52), S( 1,-43), S(-2,-36) } }, { // King - { S(271, 1), S(327, 45), S(270, 85), S(192, 76) }, - { S(278, 53), S(303,100), S(230,133), S(174,135) }, + { S(271, 1), S(327, 45), S(271, 85), S(198, 76) }, + { S(278, 53), S(303,100), S(234,133), S(179,135) }, { S(195, 88), S(258,130), S(169,169), S(120,175) }, { S(164,103), S(190,156), S(138,172), S( 98,172) }, { S(154, 96), S(179,166), S(105,199), S( 70,199) }, @@ -112,17 +108,14 @@ void init() { for (Piece pc = W_PAWN; pc <= W_KING; ++pc) { - PieceValue[MG][~pc] = PieceValue[MG][pc]; - PieceValue[EG][~pc] = PieceValue[EG][pc]; - Score score = make_score(PieceValue[MG][pc], PieceValue[EG][pc]); for (Square s = SQ_A1; s <= SQ_H8; ++s) { - File f = map_to_queenside(file_of(s)); + File f = File(edge_distance(file_of(s))); psq[ pc][ s] = score + (type_of(pc) == PAWN ? PBonus[rank_of(s)][file_of(s)] : Bonus[pc][rank_of(s)][f]); - psq[~pc][~s] = -psq[pc][s]; + psq[~pc][flip_rank(s)] = -psq[pc][s]; } } }