From: Marco Costalba Date: Sat, 1 Oct 2011 09:47:43 +0000 (+0100) Subject: Rename kingZone[] and reverse the king's color X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=2225e3bbe785f29dfcdb2b1057e1f141002f44c8 Rename kingZone[] and reverse the king's color Seems easier to understand to me. From Critter. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 1bbc0a36..13475ad4 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -44,20 +44,20 @@ namespace { // all squares attacked by the given color. Bitboard attackedBy[2][8]; - // kingZone[color] is the zone around the enemy king which is considered + // kingRing[color] is the zone around the king which is considered // by the king safety evaluation. This consists of the squares directly // adjacent to the king, and the three (or two, for a king on an edge file) // squares two ranks in front of the king. For instance, if black's king - // is on g8, kingZone[WHITE] is a bitboard containing the squares f8, h8, + // is on g8, kingRing[BLACK] is a bitboard containing the squares f8, h8, // f7, g7, h7, f6, g6 and h6. - Bitboard kingZone[2]; + Bitboard kingRing[2]; // kingAttackersCount[color] is the number of pieces of the given color - // which attack a square in the kingZone of the enemy king. + // which attack a square in the kingRing of the enemy king. int kingAttackersCount[2]; // kingAttackersWeight[color] is the sum of the "weight" of the pieces of the - // given color which attack a square in the kingZone of the enemy king. The + // given color which attack a square in the kingRing of the enemy king. The // weights of the individual piece types are given by the variables // QueenAttackWeight, RookAttackWeight, BishopAttackWeight and // KnightAttackWeight in evaluate.cpp @@ -436,12 +436,12 @@ namespace { if ( pos.piece_count(Us, QUEEN) && pos.non_pawn_material(Us) >= QueenValueMidgame + RookValueMidgame) { - ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8)); + ei.kingRing[Them] = (b | (Us == WHITE ? b >> 8 : b << 8)); b &= ei.attackedBy[Us][PAWN]; ei.kingAttackersCount[Us] = b ? count_1s(b) / 2 : 0; ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = 0; } else - ei.kingZone[Us] = ei.kingAttackersCount[Us] = 0; + ei.kingRing[Them] = ei.kingAttackersCount[Us] = 0; } @@ -505,7 +505,7 @@ namespace { ei.attackedBy[Us][Piece] |= b; // King attacks - if (b & ei.kingZone[Us]) + if (b & ei.kingRing[Them]) { ei.kingAttackersCount[Us]++; ei.kingAttackersWeight[Us] += KingAttackWeights[Piece];