@@ -124,24 +124,8 @@ namespace {
124124 S ( 94 , 99 ), S ( 96 ,100 ), S (99 ,111 ), S (99 ,112 ) }
125125 };
126126
127- // Outpost[Bishop/Knight][Square] contains bonuses for knights and bishops
128- // outposts, indexed by piece type and square (from white's point of view).
129- const Value Outpost[][SQUARE_NB] = {
130- {// A B C D E F G H
131- V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), // Knights
132- V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ),
133- V (0 ), V (0 ), V (3 ), V (9 ), V (9 ), V (3 ), V (0 ), V (0 ),
134- V (0 ), V (4 ),V (18 ),V (25 ),V (25 ),V (18 ), V (4 ), V (0 ),
135- V (4 ), V (9 ),V (29 ),V (38 ),V (38 ),V (29 ), V (9 ), V (4 ),
136- V (2 ), V (9 ),V (19 ),V (15 ),V (15 ),V (19 ), V (9 ), V (2 ) },
137- {
138- V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), // Bishops
139- V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ), V (0 ),
140- V (2 ), V (4 ), V (3 ), V (8 ), V (8 ), V (3 ), V (4 ), V (2 ),
141- V (1 ), V (9 ), V (9 ),V (13 ),V (13 ), V (9 ), V (9 ), V (1 ),
142- V (2 ), V (8 ),V (21 ),V (24 ),V (24 ),V (21 ), V (8 ), V (2 ),
143- V (0 ), V (4 ), V (6 ), V (6 ), V (6 ), V (6 ), V (4 ), V (0 ) }
144- };
127+ // Outpost[knight/bishop][supported by pawn]
128+ const Score Outpost[2 ][2 ] = {{S (28 ,7 ), S (42 ,11 )}, {S (12 ,3 ), S (18 ,5 )}};
145129
146130 // Threat[defended/weak][minor/major attacking][attacked PieceType] contains
147131 // bonuses according to which piece type attacks which one.
@@ -235,33 +219,6 @@ namespace {
235219 }
236220
237221
238- // evaluate_outpost() evaluates bishop and knight outpost squares
239-
240- template <PieceType Pt, Color Us>
241- Score evaluate_outpost (const Position& pos, const EvalInfo& ei, Square s) {
242-
243- const Color Them = (Us == WHITE ? BLACK : WHITE);
244-
245- assert (Pt == BISHOP || Pt == KNIGHT);
246-
247- // Initial bonus based on square
248- Value bonus = Outpost[Pt == BISHOP][relative_square (Us, s)];
249-
250- // Increase bonus if supported by pawn, especially if the opponent has
251- // no minor piece which can trade with the outpost piece.
252- if (bonus && (ei.attackedBy [Us][PAWN] & s))
253- {
254- if ( !pos.pieces (Them, KNIGHT)
255- && !(squares_of_color (s) & pos.pieces (Them, BISHOP)))
256- bonus += bonus + bonus / 2 ;
257- else
258- bonus += bonus / 2 ;
259- }
260-
261- return make_score (bonus * 2 , bonus / 2 );
262- }
263-
264-
265222 // evaluate_pieces() assigns bonuses and penalties to the pieces of a given color
266223
267224 template <PieceType Pt, Color Us, bool Trace>
@@ -310,8 +267,9 @@ namespace {
310267 if (Pt == BISHOP || Pt == KNIGHT)
311268 {
312269 // Bonus for outpost square
313- if (!(pos.pieces (Them, PAWN) & pawn_attack_span (Us, s)))
314- score += evaluate_outpost<Pt, Us>(pos, ei, s);
270+ if ( relative_rank (Us, s) >= RANK_4
271+ && !(pos.pieces (Them, PAWN) & pawn_attack_span (Us, s)))
272+ score += Outpost[Pt == BISHOP][!!(ei.attackedBy [Us][PAWN] & s)];
315273
316274 // Bonus when behind a pawn
317275 if ( relative_rank (Us, s) < RANK_5
0 commit comments