Skip to content

Commit 97015af

Browse files
Ralph Stößermcostalba
authored andcommitted
Further improve chain pawn evaluation
Passed both short TC: LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 28299 W: 5854 L: 5667 D: 16778 And long TC: LLR: 2.96 (-2.94,2.94) [0.00,6.00] Total: 9738 W: 1797 L: 1644 D: 6297 bench: 9294116
1 parent f22a63c commit 97015af

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/pawns.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,16 @@ namespace {
5252
S(33, 31), S(33, 31), S(29, 31), S(20, 28) }};
5353

5454
// Pawn chain membership bonus by file
55-
const Score ChainMember[FILE_NB] = {
56-
S(11,-1), S(13,-1), S(13,-1), S(14,-1),
57-
S(14,-1), S(13,-1), S(13,-1), S(11,-1)
58-
};
55+
const Score ChainMember[FILE_NB][RANK_NB] = {
56+
{ S(0, 0), S(14, 0), S(16, 4), S(18, 9), S(56, 56), S(104, 208), S(236, 472) },
57+
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(60, 60), S(108, 216), S(240, 480) },
58+
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(60, 60), S(108, 216), S(240, 480) },
59+
{ S(0, 0), S(17, 0), S(19, 6), S(22, 11), S(66, 66), S(118, 236), S(254, 508) },
60+
{ S(0, 0), S(17, 0), S(19, 6), S(22, 11), S(66, 66), S(118, 236), S(254, 508) },
61+
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(60, 60), S(108, 216), S(240, 480) },
62+
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(60, 60), S(108, 216), S(240, 480) },
63+
{ S(0, 0), S(14, 0), S(16, 4), S(18, 9), S(56, 56), S(104, 208), S(236, 472) }
64+
};
5965

6066
// Candidate passed pawn bonus by rank
6167
const Score CandidatePassed[RANK_NB] = {
@@ -92,6 +98,7 @@ namespace {
9298
Bitboard b;
9399
Square s;
94100
File f;
101+
Rank r;
95102
bool passed, isolated, doubled, opposed, chain, backward, candidate;
96103
Score value = SCORE_ZERO;
97104
const Square* pl = pos.list<PAWN>(Us);
@@ -112,6 +119,7 @@ namespace {
112119
assert(pos.piece_on(s) == make_piece(Us, PAWN));
113120

114121
f = file_of(s);
122+
r = relative_rank(Us, s);
115123

116124
// This file cannot be semi-open
117125
e->semiopenFiles[Us] &= ~(1 << f);
@@ -176,11 +184,11 @@ namespace {
176184
value -= Backward[opposed][f];
177185

178186
if (chain)
179-
value += ChainMember[f] + CandidatePassed[relative_rank(Us, s)] / 2;
187+
value += opposed ? ChainMember[f][r] / 2 : ChainMember[f][r];
180188

181189
if (candidate)
182190
{
183-
value += CandidatePassed[relative_rank(Us, s)];
191+
value += CandidatePassed[r];
184192

185193
if (!doubled)
186194
e->candidatePawns[Us] |= s;

0 commit comments

Comments
 (0)