mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Simplify evaluate_passed_pawns
From a suggestion by David Zar. No functional change.
This commit is contained in:
parent
67a5e1ecf9
commit
896bd917f8
1 changed files with 10 additions and 14 deletions
|
@ -574,22 +574,18 @@ namespace {
|
||||||
// If the pawn is free to advance, then increase the bonus
|
// If the pawn is free to advance, then increase the bonus
|
||||||
if (pos.empty(blockSq))
|
if (pos.empty(blockSq))
|
||||||
{
|
{
|
||||||
squaresToQueen = forward_bb(Us, s);
|
// If there is a rook or queen attacking/defending the pawn from behind,
|
||||||
|
// consider all the squaresToQueen. Otherwise consider only the squares
|
||||||
|
// in the pawn's path attacked or occupied by the enemy.
|
||||||
|
defendedSquares = unsafeSquares = squaresToQueen = forward_bb(Us, s);
|
||||||
|
|
||||||
// If there is an enemy rook or queen attacking the pawn from behind,
|
Bitboard bb = forward_bb(Them, s) & pos.pieces(ROOK, QUEEN) & pos.attacks_from<ROOK>(s);
|
||||||
// add all X-ray attacks by the rook or queen. Otherwise consider only
|
|
||||||
// the squares in the pawn's path attacked or occupied by the enemy.
|
|
||||||
if ( unlikely(forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN))
|
|
||||||
&& (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s)))
|
|
||||||
unsafeSquares = squaresToQueen;
|
|
||||||
else
|
|
||||||
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
|
|
||||||
|
|
||||||
if ( unlikely(forward_bb(Them, s) & pos.pieces(Us, ROOK, QUEEN))
|
if (!(pos.pieces(Us) & bb))
|
||||||
&& (forward_bb(Them, s) & pos.pieces(Us, ROOK, QUEEN) & pos.attacks_from<ROOK>(s)))
|
defendedSquares &= ei.attackedBy[Us][ALL_PIECES];
|
||||||
defendedSquares = squaresToQueen;
|
|
||||||
else
|
if (!(pos.pieces(Them) & bb))
|
||||||
defendedSquares = squaresToQueen & ei.attackedBy[Us][ALL_PIECES];
|
unsafeSquares &= ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them);
|
||||||
|
|
||||||
// If there aren't any enemy attacks, assign a big bonus. Otherwise
|
// If there aren't any enemy attacks, assign a big bonus. Otherwise
|
||||||
// assign a smaller bonus if the block square isn't attacked.
|
// assign a smaller bonus if the block square isn't attacked.
|
||||||
|
|
Loading…
Add table
Reference in a new issue