Skip to content

Commit

Permalink
Further improve chain pawn evaluation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ralph Stößer authored and mcostalba committed Oct 20, 2013
1 parent f22a63c commit 97015af
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/pawns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ namespace {
S(33, 31), S(33, 31), S(29, 31), S(20, 28) }};

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

// Candidate passed pawn bonus by rank
const Score CandidatePassed[RANK_NB] = {
Expand Down Expand Up @@ -92,6 +98,7 @@ namespace {
Bitboard b;
Square s;
File f;
Rank r;
bool passed, isolated, doubled, opposed, chain, backward, candidate;
Score value = SCORE_ZERO;
const Square* pl = pos.list<PAWN>(Us);
Expand All @@ -112,6 +119,7 @@ namespace {
assert(pos.piece_on(s) == make_piece(Us, PAWN));

f = file_of(s);
r = relative_rank(Us, s);

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

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

if (candidate)
{
value += CandidatePassed[relative_rank(Us, s)];
value += CandidatePassed[r];

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

0 comments on commit 97015af

Please sign in to comment.