From: Marco Costalba Date: Mon, 19 Jul 2010 06:13:50 +0000 (+0100) Subject: Small rewrite of backward pawn test X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=95388a952b5882a4e32c0af49b3a7fd1251df85b Small rewrite of backward pawn test No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/pawns.cpp b/src/pawns.cpp index 34c25959..b5c377ef 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -214,7 +214,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns, 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) ? @@ -226,15 +226,15 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns, // 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 & attack_span_mask(opposite_color(Us), s)) - || (pos.attacks_from(s, Us) & theirPawns)) - backward = false; - else + if ( !(passed | isolated | chain) + && !(ourPawns & attack_span_mask(opposite_color(Us), s)) + && !(pos.attacks_from(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