if (relative_rank(Us, s) >= RANK_5)
score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]);
- // Bonus for rook on same file as their queen
- if (file_bb(s) & pos.pieces(Them, QUEEN))
+ // Bonus for rook on the same file as a queen
+ if (file_bb(s) & pos.pieces(QUEEN))
score += RookOnQueenFile;
// Bonus for rook on an open or semi-open file
bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide)
&& (pos.pieces(PAWN) & KingSide);
+ bool almostUnwinnable = !pe->passed_count()
+ && outflanking < 0
+ && !pawnsOnBothFlanks;
+
// Compute the initiative bonus for the attacking side
int complexity = 9 * pe->passed_count()
+ 11 * pos.count<PAWN>()
+ 9 * outflanking
+ 18 * pawnsOnBothFlanks
+ 49 * !pos.non_pawn_material()
+ - 36 * almostUnwinnable
-103 ;
// Now apply the bonus: note that we find the attacking side by extracting