This fixes issues with uninitialized attack tables.
Bench results are deterministic now also for variants
that are missing some of the standard chess piece types.
No functional change for standard chess.
initialize<WHITE>();
initialize<BLACK>();
- // Pieces should be evaluated first (populate attack tables)
- for (PieceType pt : pos.piece_types())
- if (pt != PAWN && pt != KING)
- score += pieces<WHITE>(pt) - pieces<BLACK>(pt);
+ // Pieces should be evaluated first (populate attack tables).
+ // For unused piece types, we still need to set attack bitboard to zero.
+ for (PieceType pt = KNIGHT; pt < KING; ++pt)
+ score += pieces<WHITE>(pt) - pieces<BLACK>(pt);
score += mobility[WHITE] - mobility[BLACK];