]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Store pawn attacks in PawnInfo
[stockfish] / src / evaluate.cpp
index a5868f504b0b827af8e7320b780f57e6a2c2f656..acd5f0bdd18a43a528a1ae926d8e9b40ac0e0a7c 100644 (file)
@@ -207,8 +207,8 @@ namespace {
     ((1ULL << SQ_A8) | (1ULL << SQ_H8))
   };
 
-  // The SpaceMask[color] contains area of the board which is consdered by
-  // the space evaluation. In the middle game, each side is given a bonus
+  // The SpaceMask[color] contains the area of the board which is consdered 
+  // by the space evaluation. In the middle game, each side is given a bonus
   // based on how many squares inside this area are safe and available for
   // friendly minor pieces.
   const Bitboard SpaceMask[2] = {
@@ -344,8 +344,8 @@ Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) {
   ei.kingZone[BLACK] = ei.attackedBy[WHITE][KING] | (ei.attackedBy[WHITE][KING] << 8);
 
   // Initialize pawn attack bitboards for both sides
-  ei.attackedBy[WHITE][PAWN] = ((pos.pieces(PAWN, WHITE) << 9) & ~FileABB) | ((pos.pieces(PAWN, WHITE) << 7) & ~FileHBB);
-  ei.attackedBy[BLACK][PAWN] = ((pos.pieces(PAWN, BLACK) >> 7) & ~FileABB) | ((pos.pieces(PAWN, BLACK) >> 9) & ~FileHBB);
+  ei.attackedBy[WHITE][PAWN] = ei.pi->pawn_attacks(WHITE);
+  ei.attackedBy[BLACK][PAWN] = ei.pi->pawn_attacks(BLACK);
   Bitboard b1 = ei.attackedBy[WHITE][PAWN] & ei.attackedBy[BLACK][KING];
   Bitboard b2 = ei.attackedBy[BLACK][PAWN] & ei.attackedBy[WHITE][KING];
   if (b1)