Skip to content

Commit

Permalink
Don't include backward pawns in space evaluation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbootsector committed Jun 16, 2017
1 parent 659990b commit 55dbf76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ namespace {
& (ei.attackedBy[Us][ALL_PIECES] | ~ei.attackedBy[Them][ALL_PIECES]);

// Find all squares which are at most three squares behind some friendly pawn
Bitboard behind = pos.pieces(Us, PAWN);
Bitboard behind = pos.pieces(Us, PAWN) ^ ei.pe->backwardPawns[Us];
behind |= (Us == WHITE ? behind >> 8 : behind << 8);
behind |= (Us == WHITE ? behind >> 16 : behind << 16);

Expand Down
5 changes: 4 additions & 1 deletion src/pawns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace {
Bitboard ourPawns = pos.pieces(Us , PAWN);
Bitboard theirPawns = pos.pieces(Them, PAWN);

e->passedPawns[Us] = e->pawnAttacksSpan[Us] = 0;
e->backwardPawns[Us] = e->passedPawns[Us] = e->pawnAttacksSpan[Us] = 0;
e->semiopenFiles[Us] = 0xFF;
e->kingSquares[Us] = SQ_NONE;
e->pawnAttacks[Us] = shift<Right>(ourPawns) | shift<Left>(ourPawns);
Expand Down Expand Up @@ -177,7 +177,10 @@ namespace {
score -= Isolated[opposed];

else if (backward)
{
score -= Backward[opposed];
e->backwardPawns[Us] |= s;
}

else if (!supported)
score -= Unsupported;
Expand Down
1 change: 1 addition & 0 deletions src/pawns.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct Entry {
Bitboard passedPawns[COLOR_NB];
Bitboard pawnAttacks[COLOR_NB];
Bitboard pawnAttacksSpan[COLOR_NB];
Bitboard backwardPawns[COLOR_NB];
Square kingSquares[COLOR_NB];
Score kingSafety[COLOR_NB];
int castlingRights[COLOR_NB];
Expand Down

0 comments on commit 55dbf76

Please sign in to comment.