along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <algorithm>
#include <cassert>
#include "bitboard.h"
// Flag the pawn
opposed = theirPawns & forward_file_bb(Us, s);
- stoppers = theirPawns & passed_pawn_mask(Us, s);
+ stoppers = theirPawns & passed_pawn_span(Us, s);
lever = theirPawns & PawnAttacks[Us][s];
leverPush = theirPawns & PawnAttacks[Us][s + Up];
doubled = ourPawns & (s - Up);
// which could become passed after one or two pawn pushes when are
// not attacked more times than defended.
if ( !(stoppers ^ lever ^ leverPush)
- && popcount(support) >= popcount(lever) - 1
- && popcount(phalanx) >= popcount(leverPush))
+ && (support || !more_than_one(lever))
+ && popcount(phalanx) >= popcount(leverPush))
e->passedPawns[Us] |= s;
- else if ( stoppers == SquareBB[s + Up]
+ else if ( stoppers == square_bb(s + Up)
&& relative_rank(Us, s) >= RANK_5)
{
b = shift<Up>(support) & ~theirPawns;
e->key = key;
e->scores[WHITE] = evaluate<WHITE>(pos, e);
e->scores[BLACK] = evaluate<BLACK>(pos, e);
- e->asymmetry = popcount( (e->passedPawns[WHITE] | e->passedPawns[BLACK])
- | (e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]));
+ e->passedCount= popcount(e->passedPawns[WHITE] | e->passedPawns[BLACK]);
return e;
}
Value safety = (shift<Down>(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ?
Value(374) : Value(5);
- File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq)));
+ File center = clamp(file_of(ksq), FILE_B, FILE_G);
for (File f = File(center - 1); f <= File(center + 1); ++f)
{
b = ourPawns & file_bb(f);