1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Add attacked by 2 pawns to attackedBy2 (#2074)

Add squares attacked by 2 pawns to the attackedBy2 array

STC :
LLR: -2.95 (-2.94,2.94) [0.50,4.50]
Total: 132722 W: 29583 L: 29090 D: 74049
http://tests.stockfishchess.org/tests/view/5ca231ba0ebc5925cf000794

LTC :
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 94589 W: 16161 L: 15718 D: 62710
http://tests.stockfishchess.org/tests/view/5ca25d180ebc5925cf000ba4

Bench: 3337864
This commit is contained in:
Moez Jellouli 2019-04-04 08:49:35 +02:00 committed by Marco Costalba
parent 82ad9ce9cf
commit aa0166fba6

View file

@ -228,6 +228,8 @@ namespace {
const Square ksq = pos.square<KING>(Us);
Bitboard dblAttackByPawn = pawn_double_attacks_bb<Us>(pos.pieces(Us, PAWN));
// Find our pawns that are blocked or on the first two ranks
Bitboard b = pos.pieces(Us, PAWN) & (shift<Down>(pos.pieces()) | LowRanks);
@ -239,7 +241,8 @@ namespace {
attackedBy[Us][KING] = pos.attacks_from<KING>(ksq);
attackedBy[Us][PAWN] = pe->pawn_attacks(Us);
attackedBy[Us][ALL_PIECES] = attackedBy[Us][KING] | attackedBy[Us][PAWN];
attackedBy2[Us] = attackedBy[Us][KING] & attackedBy[Us][PAWN];
attackedBy2[Us] = (attackedBy[Us][KING] & attackedBy[Us][PAWN])
| dblAttackByPawn;
// Init our king safety tables
kingRing[Us] = attackedBy[Us][KING];
@ -256,7 +259,7 @@ namespace {
kingAttacksCount[Them] = kingAttackersWeight[Them] = 0;
// Remove from kingRing[] the squares defended by two pawns
kingRing[Us] &= ~pawn_double_attacks_bb<Us>(pos.pieces(Us, PAWN));
kingRing[Us] &= ~dblAttackByPawn;
}