1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Don't increase mobility if attacked piece is defended by a pawn

If an enemy piece is defended by a pawn don't give the
extra mobility bonus in case we attack it.

Joona says that "Paralyzing pawn" is usually worth of nothing.

On Joona QUAD after 964 games:
Orig - Patch_2: 191 - 218 - 555 (+ 10 elo)

On my PC after 999 games at 1+0:
Mod vs Orig +227 =550 -222 50.25%  502.0/999  +2 ELO

In both cases we tested against the original version (without
increased mobility), not against the previous patch that instead
seems to fail on Joona QUAD:
Orig vs. Prev.Patch: 237 - 217 - 627 (-6 elo)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-09-30 16:04:51 +01:00
parent cff9ff2198
commit 3713bb26ef

View file

@ -550,16 +550,15 @@ namespace {
ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);
}
// The squares occupied by enemy pieces will be counted two times instead
// of one. The shift (almost) guarantees that intersection with b is zero
// so when we 'or' the two bitboards togheter and count we get the correct
// sum of '1' in b and attacked bitboards.
Bitboard attacked = Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
: ((b & pos.pieces_of_color(Them)) << 1);
// Remove squares protected by enemy pawns or occupied by our pieces
b &= ~(ei.attackedBy[Them][PAWN] | pos.pieces_of_color(Us));
// The squares occupied by enemy pieces (not defended by pawns) will be
// counted two times instead of one. The shift (almost) guarantees that
// intersection with b is zero so when we 'or' the two bitboards togheter
// and count we get the correct sum of '1' in b and attacked bitboards.
Bitboard attacked = Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
: ((b & pos.pieces_of_color(Them)) << 1);
// Mobility
int mob = (Piece != QUEEN ? count_1s_max_15<HasPopCnt>(b | attacked)
: count_1s<HasPopCnt>(b | attacked));