@@ -40,8 +40,8 @@ namespace {
4040 Pawns::Entry* pi;
4141
4242 // attackedBy[color][piece type] is a bitboard representing all squares
43- // attacked by a given color and piece type, attackedBy[color][0] contains
44- // all squares attacked by the given color.
43+ // attacked by a given color and piece type, attackedBy[color][ALL_PIECES]
44+ // contains all squares attacked by the given color.
4545 Bitboard attackedBy[COLOR_NB][PIECE_TYPE_NB];
4646
4747 // kingRing[color] is the zone around the king which is considered
@@ -693,15 +693,15 @@ Value do_evaluate(const Position& pos, Value& margin) {
693693 // Undefended minors get penalized even if not under attack
694694 undefendedMinors = pos.pieces (Them)
695695 & (pos.pieces (BISHOP) | pos.pieces (KNIGHT))
696- & ~ei.attackedBy [Them][0 ];
696+ & ~ei.attackedBy [Them][ALL_PIECES ];
697697
698698 if (undefendedMinors)
699699 score += UndefendedMinorPenalty;
700700
701701 // Enemy pieces not defended by a pawn and under our attack
702702 weakEnemies = pos.pieces (Them)
703703 & ~ei.attackedBy [Them][PAWN]
704- & ei.attackedBy [Us][0 ];
704+ & ei.attackedBy [Us][ALL_PIECES ];
705705
706706 if (!weakEnemies)
707707 return score;
@@ -740,9 +740,9 @@ Value do_evaluate(const Position& pos, Value& margin) {
740740 score += evaluate_pieces<QUEEN, Us, Trace>(pos, ei, mobility, mobilityArea);
741741
742742 // Sum up all attacked squares
743- ei.attackedBy [Us][0 ] = ei.attackedBy [Us][PAWN] | ei.attackedBy [Us][KNIGHT]
744- | ei.attackedBy [Us][BISHOP] | ei.attackedBy [Us][ROOK]
745- | ei.attackedBy [Us][QUEEN] | ei.attackedBy [Us][KING];
743+ ei.attackedBy [Us][ALL_PIECES ] = ei.attackedBy [Us][PAWN] | ei.attackedBy [Us][KNIGHT]
744+ | ei.attackedBy [Us][BISHOP] | ei.attackedBy [Us][ROOK]
745+ | ei.attackedBy [Us][QUEEN] | ei.attackedBy [Us][KING];
746746 return score;
747747 }
748748
@@ -768,7 +768,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
768768 {
769769 // Find the attacked squares around the king which has no defenders
770770 // apart from the king itself
771- undefended = ei.attackedBy [Them][0 ] & ei.attackedBy [Us][KING];
771+ undefended = ei.attackedBy [Them][ALL_PIECES ] & ei.attackedBy [Us][KING];
772772 undefended &= ~( ei.attackedBy [Us][PAWN] | ei.attackedBy [Us][KNIGHT]
773773 | ei.attackedBy [Us][BISHOP] | ei.attackedBy [Us][ROOK]
774774 | ei.attackedBy [Us][QUEEN]);
@@ -816,7 +816,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
816816 }
817817
818818 // Analyse enemy's safe distance checks for sliders and knights
819- safe = ~(pos.pieces (Them) | ei.attackedBy [Us][0 ]);
819+ safe = ~(pos.pieces (Them) | ei.attackedBy [Us][ALL_PIECES ]);
820820
821821 b1 = pos.attacks_from <ROOK>(ksq) & safe;
822822 b2 = pos.attacks_from <BISHOP>(ksq) & safe;
@@ -903,7 +903,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
903903 if (pos.is_empty (blockSq))
904904 {
905905 squaresToQueen = forward_bb (Us, s);
906- defendedSquares = squaresToQueen & ei.attackedBy [Us][0 ];
906+ defendedSquares = squaresToQueen & ei.attackedBy [Us][ALL_PIECES ];
907907
908908 // If there is an enemy rook or queen attacking the pawn from behind,
909909 // add all X-ray attacks by the rook or queen. Otherwise consider only
@@ -912,7 +912,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
912912 && (forward_bb (Them, s) & pos.pieces (Them, ROOK, QUEEN) & pos.attacks_from <ROOK>(s)))
913913 unsafeSquares = squaresToQueen;
914914 else
915- unsafeSquares = squaresToQueen & (ei.attackedBy [Them][0 ] | pos.pieces (Them));
915+ unsafeSquares = squaresToQueen & (ei.attackedBy [Them][ALL_PIECES ] | pos.pieces (Them));
916916
917917 // If there aren't enemy attacks or pieces along the path to queen give
918918 // huge bonus. Even bigger if we protect the pawn's path.
@@ -989,7 +989,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
989989 // Compute plies to queening and check direct advancement
990990 movesToGo = rank_distance (s, queeningSquare) - int (relative_rank (c, s) == RANK_2);
991991 oppMovesToGo = square_distance (pos.king_square (~c), queeningSquare) - int (c != pos.side_to_move ());
992- pathDefended = ((ei.attackedBy [c][0 ] & queeningPath) == queeningPath);
992+ pathDefended = ((ei.attackedBy [c][ALL_PIECES ] & queeningPath) == queeningPath);
993993
994994 if (movesToGo >= oppMovesToGo && !pathDefended)
995995 continue ;
@@ -1136,7 +1136,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
11361136 Bitboard safe = SpaceMask[Us]
11371137 & ~pos.pieces (Us, PAWN)
11381138 & ~ei.attackedBy [Them][PAWN]
1139- & (ei.attackedBy [Us][0 ] | ~ei.attackedBy [Them][0 ]);
1139+ & (ei.attackedBy [Us][ALL_PIECES ] | ~ei.attackedBy [Them][ALL_PIECES ]);
11401140
11411141 // Find all squares which are at most three squares behind some friendly pawn
11421142 Bitboard behind = pos.pieces (Us, PAWN);
0 commit comments