From 3c92f849ab940fd9ac70e838e6d941827fc69cb6 Mon Sep 17 00:00:00 2001 From: protonspring Date: Sat, 12 Jan 2019 19:30:56 -0700 Subject: [PATCH] Change outposts to single value #1946 This is a functional simplification of the Outposts array moving it to a single value. This is a duplicate PR because I couldn't figure out how to fix the original one. The idea is from @31m059 with formatting recommendations by @snicolet. See #1940 for additional information. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 23933 W: 5279 L: 5162 D: 13492 http://tests.stockfishchess.org/tests/view/5c3575800ebc596a450c5ecb LTC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 41718 W: 6919 L: 6831 D: 27968 http://tests.stockfishchess.org/tests/view/5c358c440ebc596a450c6117 bench 3783543 --- src/evaluate.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index fce0835e..98082c4c 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -117,14 +117,6 @@ namespace { S(106,184), S(109,191), S(113,206), S(116,212) } }; - // Outpost[knight/bishop][supported by pawn] contains bonuses for minor - // pieces if they occupy or can reach an outpost square, bigger if that - // square is supported by a pawn. - constexpr Score Outpost[][2] = { - { S(22, 6), S(36,12) }, // Knight - { S( 9, 2), S(15, 5) } // Bishop - }; - // RookOnFile[semiopen/open] contains bonuses for each rook when there is // no (friendly) pawn on the rook file. constexpr Score RookOnFile[] = { S(18, 7), S(44, 20) }; @@ -171,6 +163,7 @@ namespace { constexpr Score TrappedRook = S( 47, 4); constexpr Score WeakQueen = S( 49, 15); constexpr Score WeakUnopposedPawn = S( 12, 23); + constexpr Score Outpost = S( 9, 3); #undef S @@ -324,10 +317,12 @@ namespace { // Bonus if piece is on an outpost square or can reach one bb = OutpostRanks & ~pe->pawn_attacks_span(Them); if (bb & s) - score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & s)] * 2; + score += Outpost * (Pt == KNIGHT ? 4 : 2) + * (1 + bool(attackedBy[Us][PAWN] & s)); else if (bb &= b & ~pos.pieces(Us)) - score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & bb)]; + score += Outpost * (Pt == KNIGHT ? 2 : 1) + * (1 + bool(attackedBy[Us][PAWN] & bb)); // Knight and Bishop bonus for being right behind a pawn if (shift(pos.pieces(PAWN)) & s) -- 2.39.2