- // Initialize king attack bitboards and king attack zones for both sides
- ei.attackedBy[WHITE][KING] = pos.attacks_from<KING>(pos.king_square(WHITE));
- ei.attackedBy[BLACK][KING] = pos.attacks_from<KING>(pos.king_square(BLACK));
- ei.kingZone[WHITE] = ei.attackedBy[BLACK][KING] | (ei.attackedBy[BLACK][KING] >> 8);
- ei.kingZone[BLACK] = ei.attackedBy[WHITE][KING] | (ei.attackedBy[WHITE][KING] << 8);
-
- // Initialize pawn attack bitboards for both sides
- ei.attackedBy[WHITE][PAWN] = ei.pi->pawn_attacks(WHITE);
- b = ei.attackedBy[WHITE][PAWN] & ei.attackedBy[BLACK][KING];
- if (b)
- ei.kingAttackersCount[WHITE] = count_1s_max_15<HasPopCnt>(b)/2;
-
- ei.attackedBy[BLACK][PAWN] = ei.pi->pawn_attacks(BLACK);
- b = ei.attackedBy[BLACK][PAWN] & ei.attackedBy[WHITE][KING];
- if (b)
- ei.kingAttackersCount[BLACK] = count_1s_max_15<HasPopCnt>(b)/2;
+ // Initialize attack bitboards with pawns evaluation
+ init_attack_tables<WHITE, HasPopCnt>(pos, ei);
+ init_attack_tables<BLACK, HasPopCnt>(pos, ei);