No functional chnage.
enum { Defended, Weak };
enum { Minor, Major };
- Bitboard b, weak, defended, safe_pawns, safe_pawn_threats, unsafe_pawn_threats;
+ Bitboard b, weak, defended, safeThreats;
Score score = SCORE_ZERO;
- // Pawn Threats
- b = ei.attackedBy[Us][PAWN] & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
+ // Non-pawn enemies attacked by a pawn
+ weak = (pos.pieces(Them) ^ pos.pieces(Them, PAWN)) & ei.attackedBy[Us][PAWN];
- if (b)
+ if (weak)
{
- safe_pawns = pos.pieces(Us, PAWN) & (~ei.attackedBy[Them][ALL_PIECES] | ei.attackedBy[Us][ALL_PIECES]);
- safe_pawn_threats = (shift_bb<Right>(safe_pawns) | shift_bb<Left>(safe_pawns)) & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
- unsafe_pawn_threats = b ^ safe_pawn_threats;
+ b = pos.pieces(Us, PAWN) & ( ~ei.attackedBy[Them][ALL_PIECES]
+ | ei.attackedBy[Us][ALL_PIECES]);
+
+ safeThreats = (shift_bb<Right>(b) | shift_bb<Left>(b)) & weak;
- // Unsafe pawn threats
- if (unsafe_pawn_threats)
+ if (weak ^ safeThreats)
score += ThreatenedByHangingPawn;
- // Evaluate safe pawn threats
- while (safe_pawn_threats)
- score += ThreatenedByPawn[type_of(pos.piece_on(pop_lsb(&safe_pawn_threats)))];
+ while (safeThreats)
+ score += ThreatenedByPawn[type_of(pos.piece_on(pop_lsb(&safeThreats)))];
}
// Non-pawn enemies defended by a pawn
// Score this pawn
if (isolated)
score -= Isolated[opposed][f];
+
else if (backward)
score -= Backward[opposed][f];
+
else if (!supported)
score -= UnsupportedPawnPenalty;
if (connected)
score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)];
-
+
if (doubled)
score -= Doubled[f] / distance<Rank>(s, frontmost_sq(Us, doubled));
-
+
if (lever)
score += Lever[relative_rank(Us, s)];
}
CounterMovesHistory.clear();
Gains.clear();
Countermoves.clear();
-
+
size_t multiPV = Options["MultiPV"];
Skill skill(Options["Skill Level"]);
if ( (!PvNode && cutNode)
|| History[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO
- || CounterMovesHistory[pos.piece_on(prevMoveSq)][prevMoveSq][pos.piece_on(to_sq(move))][to_sq(move)]
- + History[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO)
+ || ( History[pos.piece_on(to_sq(move))][to_sq(move)]
+ + CounterMovesHistory[pos.piece_on(prevMoveSq)][prevMoveSq]
+ [pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO))
ss->reduction += ONE_PLY;
if (move == countermoves[0] || move == countermoves[1])
cmh.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus);
}
+ // Extra penalty for TT move in previous ply when it gets refuted
if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
{
Square prevPrevSq = to_sq((ss-2)->currentMove);
-
- // Extra penalty for TT move in previous ply when it gets refuted
HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];
ttMoveCmh.update(pos.piece_on(prevSq), prevSq, -bonus - 2 * depth / ONE_PLY - 1);
}