- ei.pi = PawnTable[threadID]->get_pawn_info(pos);
- ei.mgValue += apply_weight(ei.pi->mg_value(), WeightPawnStructureMidgame);
- ei.egValue += apply_weight(ei.pi->eg_value(), WeightPawnStructureEndgame);
-
- // Initialize king attack bitboards and king attack zones for both sides
- ei.attackedBy[WHITE][KING] = pos.piece_attacks<KING>(pos.king_square(WHITE));
- ei.attackedBy[BLACK][KING] = pos.piece_attacks<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] = ((pos.pawns(WHITE) << 9) & ~FileABB) | ((pos.pawns(WHITE) << 7) & ~FileHBB);
- ei.attackedBy[BLACK][PAWN] = ((pos.pawns(BLACK) >> 7) & ~FileABB) | ((pos.pawns(BLACK) >> 9) & ~FileHBB);
- ei.kingAttackersCount[WHITE] = count_1s_max_15(ei.attackedBy[WHITE][PAWN] & ei.attackedBy[BLACK][KING])/2;
- ei.kingAttackersCount[BLACK] = count_1s_max_15(ei.attackedBy[BLACK][PAWN] & ei.attackedBy[WHITE][KING])/2;
-
- // Evaluate pieces
- for (Color c = WHITE; c <= BLACK; c++)
- {
- // Knights
- for (int i = 0; i < pos.piece_count(c, KNIGHT); i++)
- evaluate_knight(pos, pos.piece_list(c, KNIGHT, i), c, ei);
-
- // Bishops
- for (int i = 0; i < pos.piece_count(c, BISHOP); i++)
- evaluate_bishop(pos, pos.piece_list(c, BISHOP, i), c, ei);
-
- // Rooks
- for (int i = 0; i < pos.piece_count(c, ROOK); i++)
- evaluate_rook(pos, pos.piece_list(c, ROOK, i), c, ei);
-
- // Queens
- for(int i = 0; i < pos.piece_count(c, QUEEN); i++)
- evaluate_queen(pos, pos.piece_list(c, QUEEN, i), c, ei);
-
- // Special pattern: trapped bishops on a7/h7/a2/h2
- Bitboard b = pos.bishops(c) & MaskA7H7[c];
- while (b)
- {
- Square s = pop_1st_bit(&b);
- evaluate_trapped_bishop_a7h7(pos, s, c, ei);
- }