ei.kingAdjacentZoneAttacksCount[Us] += popcount<Max15>(bb);
}
- int mob = popcount<Piece == QUEEN ? Full : Max15>(b & mobilityArea);
+ int mob = Piece != QUEEN ? popcount<Max15>(b & mobilityArea)
+ : popcount<Full >(b & mobilityArea);
+
mobility += MobilityBonus[Piece][mob];
// Decrease score if we are attacked by an enemy pawn. Remaining part
// Bishop and knight outposts squares
if ( (Piece == BISHOP || Piece == KNIGHT)
- && !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s)))
+ && !(pos.pieces(Them, PAWN) & pawn_attack_span(Us, s)))
score += evaluate_outposts<Piece, Us>(pos, ei, s);
if ( (Piece == ROOK || Piece == QUEEN)
if (ei.pi->semiopen(Us, file_of(s)))
score += ei.pi->semiopen(Them, file_of(s)) ? RookOpenFile : RookSemiopenFile;
- if (mob > 6 || ei.pi->semiopen(Us, file_of(s)))
+ if (mob > 3 || ei.pi->semiopen(Us, file_of(s)))
continue;
Square ksq = pos.king_square(Us);
// If there is an enemy rook or queen attacking the pawn from behind,
// 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 (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s))
+ if ( (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN)) // Unlikely
+ && (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));
// black pawns: a4, b4 white: b2 then pawn in b4 is giving support.
if (!opposed)
{
- b2 = supporters & in_front_bb(winnerSide, blockSq + pawn_push(winnerSide));
+ b2 = supporters & in_front_bb(winnerSide, rank_of(blockSq + pawn_push(winnerSide)));
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
{
}
// Check pawns that can be sacrificed against the blocking pawn
- b2 = attack_span_mask(winnerSide, blockSq) & candidates & ~(1ULL << s);
+ b2 = pawn_attack_span(winnerSide, blockSq) & candidates & ~(1ULL << s);
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
{
stream.str("");
stream << std::showpoint << std::showpos << std::fixed << std::setprecision(2);
- memset(scores, 0, 2 * (TOTAL + 1) * sizeof(Score));
+ std::memset(scores, 0, 2 * (TOTAL + 1) * sizeof(Score));
Value margin;
do_evaluate<true>(pos, margin);