X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=aa41c2cd8150b6baf86809d8e43832bacd7f2e25;hp=f06b1283d418a529e8196150a5de85e8b934bd02;hb=564ed5b38cb2b99e8770ed1c0ceee7c3e769eb0a;hpb=e4277c06bfb783b5ec78001eeef06fa9feae033f diff --git a/src/pawns.cpp b/src/pawns.cpp index f06b1283..aa41c2cd 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -193,6 +193,10 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) { Value mgValue[2] = {Value(0), Value(0)}; Value egValue[2] = {Value(0), Value(0)}; + // Calculate pawn attacks + pi->pawnAttacks[WHITE] = ((pos.pieces(PAWN, WHITE) << 9) & ~FileABB) | ((pos.pieces(PAWN, WHITE) << 7) & ~FileHBB); + pi->pawnAttacks[BLACK] = ((pos.pieces(PAWN, BLACK) >> 7) & ~FileABB) | ((pos.pieces(PAWN, BLACK) >> 9) & ~FileHBB); + // Loop through the pawns for both colors for (Color us = WHITE; us <= BLACK; us++) { @@ -299,12 +303,11 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) { // 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. + bool backward; - if ( passed - || isolated - || chain - || (pos.attacks_from(s, us) & theirPawns) - || (ourPawns & behind_bb(us, r) & neighboring_files_bb(f))) + if ( (passed | isolated | chain) + || (ourPawns & behind_bb(us, r) & neighboring_files_bb(f)) + || (pos.attacks_from(s, us) & theirPawns)) backward = false; else {