Unfortunately, it did not seem to help. It was decently promising in 16k games at 5ply fixed depth matches, showing +3-4 elo. Due to the loss of speed, this didn't carry over to timed matches that I could see.
The current version of the modification for Stockfish is below. I really like that Marco has posted Stockfish on github! Forking and playing around with the code is so easy. I should note that the branch of the fork is available here: https://github.com/glinscott/Stockfish/ ... ded_pieces.
Code: Select all
const Score UndefendedPenalty[] = {
S(0, 0), S(3, 0), S(12, 2), S(12, 2), S(25, 6), S(45, 15)
};
// Enemy pieces not defended by a pawn
Bitboard weakEnemies = pos.pieces(Them)
& ~ei.attackedBy[Them][PAWN];
Bitboard undefended = weakEnemies & ~ei.attackedBy[Them][0] & ~(Rank1BB | Rank8BB);
if (undefended)
{
const int multipliers[] = { 0, 1, 3, 6, 12, 22, 36, 36, 36, 36, 36, 36, 36, 36, 36 };
int undefendedCount = 0;
while (undefended)
{
Square s = pop_1st_bit(&undefended);
PieceType pt = type_of(pos.piece_on(s));
if (pt != KING)
{
score += UndefendedPenalty[pt];
if (pt != PAWN)
undefendedCount++;
}
}
score = (multipliers[undefendedCount] * score) / 32;
}