Skip to content

Commit

Permalink
Penalty for bad bishop with blocked central files
Browse files Browse the repository at this point in the history
We increase the penalty for bad bishops by a factor proportional
to the number of our blocked pawns in the center files C, D, E or F.

STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 8868 W: 1870 L: 1700 D: 5298
http://tests.stockfishchess.org/html/live_elo.html?5ae7674f0ebc590e39268b34

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 5813 W: 950 L: 808 D: 4055
http://tests.stockfishchess.org/html/live_elo.html?5ae77bae0ebc5926dba90dd9

Closes official-stockfish#1573

Bench: 5364190
  • Loading branch information
MJZ1977 authored and snicolet committed May 1, 2018
1 parent 213166b commit 5a7cdad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -85,6 +85,7 @@ Michel Van den Bergh (vdbergh)
Mikael Bäckman (mbootsector)
Mike Whiteley (protonspring)
Miroslav Fontán (Hexik)
Moez Jellouli (MJZ1977)
Mohammed Li (tthsqe12)
Nathan Rugg (nmrugg)
Nicklas Persson (NicklasPersson)
Expand Down
13 changes: 9 additions & 4 deletions src/evaluate.cpp
Expand Up @@ -162,7 +162,7 @@ namespace {
constexpr Score KingProtector[] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1) };

// Assorted bonuses and penalties
constexpr Score BishopPawns = S( 8, 12);
constexpr Score BishopPawns = S( 3, 5);
constexpr Score CloseEnemies = S( 7, 0);
constexpr Score Connectivity = S( 3, 1);
constexpr Score CorneredBishop = S( 50, 50);
Expand Down Expand Up @@ -293,7 +293,8 @@ namespace {
template<Tracing T> template<Color Us, PieceType Pt>
Score Evaluation<T>::pieces() {

constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
constexpr Bitboard OutpostRanks = (Us == WHITE ? Rank4BB | Rank5BB | Rank6BB
: Rank5BB | Rank4BB | Rank3BB);
const Square* pl = pos.squares<Pt>(Us);
Expand Down Expand Up @@ -349,8 +350,12 @@ namespace {

if (Pt == BISHOP)
{
// Penalty according to number of pawns on the same color square as the bishop
score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s);
// Penalty according to number of pawns on the same color square as the
// bishop, bigger when the center files are blocked with pawns.
Bitboard blocked = pos.pieces(Us, PAWN) & shift<Down>(pos.pieces());

score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s)
* (1 + popcount(blocked & CenterFiles));

// Bonus for bishop on a long diagonal which can "see" both center squares
if (more_than_one(Center & (attacks_bb<BISHOP>(s, pos.pieces(PAWN)) | s)))
Expand Down

0 comments on commit 5a7cdad

Please sign in to comment.