};
// Pawn storm open file bonuses by file
- const int16_t KStormOpenFileBonus[8] = { 31, 31, 18, 0, 0, 0, 0, 0 };
- const int16_t QStormOpenFileBonus[8] = { 0, 0, 0, 0, 0, 26, 42, 26 };
+ const int16_t QStormOpenFileBonus[8] = { 31, 31, 18, 0, 0, 0, 0, 0 };
+ const int16_t KStormOpenFileBonus[8] = { 0, 0, 0, 0, 0, 26, 42, 26 };
// Pawn storm lever bonuses by file
const int StormLeverBonus[8] = { -8, -8, -13, 0, 0, -13, -8, -8 };
assert(pos.is_ok());
Key key = pos.get_pawn_key();
- int index = int(key & (size - 1));
+ unsigned index = unsigned(key & (size - 1));
PawnInfo* pi = entries + index;
// If pi->key matches the position's pawn hash key, it means that we
pi->qsStormValue[Us] += QStormTable[relative_square(Us, s)] + bonus;
// Our rank plus previous one. Used for chain detection.
- b = rank_bb(r) | rank_bb(r + (Us == WHITE ? -1 : 1));
+ b = rank_bb(r) | rank_bb(Us == WHITE ? r - 1 : r + 1);
// Passed, isolated, doubled or member of a pawn
// chain (but not the backward one) ?
// Test for backward pawn
//
+ backward = false;
+
// If the pawn is passed, isolated, or member of a pawn chain
// it cannot be backward. If can capture an enemy pawn or if
// there are friendly pawns behind on neighboring files it cannot
// be backward either.
- if ( (passed | isolated | chain)
- || (ourPawns & outpost_mask(opposite_color(Us), s))
- || (pos.attacks_from<PAWN>(s, Us) & theirPawns))
- backward = false;
- else
+ if ( !(passed | isolated | chain)
+ && !(ourPawns & attack_span_mask(opposite_color(Us), s))
+ && !(pos.attacks_from<PAWN>(s, Us) & theirPawns))
{
// We now know that there are no friendly pawns beside or behind this
// pawn on neighboring files. We now check whether the pawn is
backward = (b | (Us == WHITE ? b << 8 : b >> 8)) & theirPawns;
}
- assert(passed | opposed | (outpost_mask(Us, s) & theirPawns));
+ assert(passed | opposed | (attack_span_mask(Us, s) & theirPawns));
// Test for candidate passed pawn
candidate = !(opposed | passed)
- && (b = outpost_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
- && count_1s_max_15(b) >= count_1s_max_15(outpost_mask(Us, s) & theirPawns);
+ && (b = attack_span_mask(opposite_color(Us), s + pawn_push(Us)) & ourPawns) != EmptyBoardBB
+ && count_1s_max_15(b) >= count_1s_max_15(attack_span_mask(Us, s) & theirPawns);
// In order to prevent doubled passed pawns from receiving a too big
// bonus, only the frontmost passed pawn on each file is considered as
if (isolated)
{
value -= IsolatedPawnPenalty[f];
- if (!(theirPawns & file_bb(f)))
+ if (!opposed)
value -= IsolatedPawnPenalty[f] / 2;
}
if (doubled)
if (backward)
{
value -= BackwardPawnPenalty[f];
- if (!(theirPawns & file_bb(f)))
+ if (!opposed)
value -= BackwardPawnPenalty[f] / 2;
}
if (chain)
const int K = (Side == KingSide ? 2 : 4);
const File RookFile = (Side == KingSide ? FILE_H : FILE_A);
- Bitboard b = outpost_mask(Us, s) & theirPawns & StormFilesBB;
+ Bitboard b = attack_span_mask(Us, s) & theirPawns & StormFilesBB;
int bonus = 0;
while (b)