+/// PawnInfoTable::evaluate_pawn_storm() evaluates each pawn which seems
+/// to have good chances of creating an open file by exchanging itself
+/// against an enemy pawn on an adjacent file.
+
+template<Color Us, PawnInfoTable::SideType Side>
+int PawnInfoTable::evaluate_pawn_storm(Square s, Rank r, File f, Bitboard theirPawns) const {
+
+ const Bitboard StormFilesBB = (Side == KingSide ? FileFBB | FileGBB | FileHBB
+ : FileABB | FileBBB | FileCBB);
+ const int K = (Side == KingSide ? 2 : 4);
+ const File RookFile = (Side == KingSide ? FILE_H : FILE_A);
+
+ Bitboard b = outpost_mask(Us, s) & theirPawns & StormFilesBB;
+ int bonus = 0;
+
+ while (b)
+ {
+ // Give a bonus according to the distance of the nearest enemy pawn
+ Square s2 = pop_1st_bit(&b);
+ Rank r2 = square_rank(s2);
+ int v = StormLeverBonus[f] - K * rank_distance(r, r2);
+
+ // If enemy pawn has no pawn beside itself is particularly vulnerable.
+ // Big bonus, especially against a weakness on the rook file
+ if (!(theirPawns & neighboring_files_bb(s2) & rank_bb(s2)))
+ v *= (square_file(s2) == RookFile ? 4 : 2);
+
+ bonus += v;
+ }
+ return bonus;
+}
+
+