From f011a5af116ed3331c7f6fb36a57d9e6de8a3ae6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Oster?= Date: Sun, 20 Oct 2013 20:59:48 +0200 Subject: [PATCH] Penalty for Knight when enemy pawns are few This seems more a material imbalance topic, anyhow test is good and so patch is applied as is. Passed both short TC: LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 17391 W: 3548 L: 3393 D: 10450 And long TC: LLR: 3.00 (-2.94,2.94) [0.00,6.00] Total: 34660 W: 5972 L: 5700 D: 22988 bench: 8291883 --- src/evaluate.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 787004b4..1ff2dea7 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -172,6 +172,7 @@ namespace { const Score RookOpenFile = make_score(43, 21); const Score RookSemiopenFile = make_score(19, 10); const Score BishopPawns = make_score( 8, 12); + const Score KnightPawns = make_score( 8, 4); const Score MinorBehindPawn = make_score(16, 0); const Score UndefendedMinor = make_score(25, 10); const Score TrappedRook = make_score(90, 0); @@ -529,6 +530,10 @@ Value do_evaluate(const Position& pos, Value& margin) { if (Piece == BISHOP) score -= BishopPawns * ei.pi->pawns_on_same_color_squares(Us, s); + // Penalty for knight when there are few enemy pawns + if (Piece == KNIGHT) + score -= KnightPawns * std::max(5 - pos.count(Them), 0); + if (Piece == BISHOP || Piece == KNIGHT) { // Bishop and knight outposts squares -- 2.39.2