X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fpawns.cpp;h=8f5e18904f7503f5e9b81fd42fa6073e387b0de7;hb=18cd83a38042a3993678e88bc8163ceb1cbd62b4;hp=71b1738cc253f8b3b5bafc215d7d160ea71c8c01;hpb=9f28d8a854d05c6c6edcd6f8911b352477f82c91;p=stockfish diff --git a/src/pawns.cpp b/src/pawns.cpp index 71b1738c..8f5e1890 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++) { @@ -303,7 +307,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) { if ( passed || isolated || chain - || (pos.pawn_attacks(us, s) & theirPawns) + || (pos.attacks_from(s, us) & theirPawns) || (ourPawns & behind_bb(us, r) & neighboring_files_bb(f))) backward = false; else @@ -312,7 +316,7 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) { // pawn on neighboring files. We now check whether the pawn is // backward by looking in the forward direction on the neighboring // files, and seeing whether we meet a friendly or an enemy pawn first. - Bitboard b = pos.pawn_attacks(us, s); + Bitboard b = pos.attacks_from(s, us); if (us == WHITE) { for ( ; !(b & (ourPawns | theirPawns)); b <<= 8);