]> git.sesse.net Git - stockfish/commitdiff
Rename AttackWeight[] in KingAttackWeights[]
authorMarco Costalba <mcostalba@gmail.com>
Fri, 7 May 2010 09:36:25 +0000 (11:36 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 7 May 2010 11:04:23 +0000 (12:04 +0100)
Also simplify a bit the code removing useless
named constants.

No functional change.

src/evaluate.cpp

index ac240f05023b93134f7f83fc10b179f9e1310090..1036b47939bae402ab25694237ae21de3d7014c2 100644 (file)
@@ -203,13 +203,8 @@ namespace {
   /// the strength of the enemy attack are added up into an integer, which
   /// is used as an index to KingDangerTable[].
 
   /// the strength of the enemy attack are added up into an integer, which
   /// is used as an index to KingDangerTable[].
 
-  // Attack weights for each piece type and table indexed on piece type
-  const int QueenAttackWeight  = 5;
-  const int RookAttackWeight   = 3;
-  const int BishopAttackWeight = 2;
-  const int KnightAttackWeight = 2;
-
-  const int AttackWeight[] = { 0, 0, KnightAttackWeight, BishopAttackWeight, RookAttackWeight, QueenAttackWeight };
+  // KingAttackWeights[] contains king attack weights by piece type
+  const int KingAttackWeights[8] = { 0, 0, 2, 2, 3, 5 };
 
   // Bonuses for enemy's safe checks
   const int QueenContactCheckBonus = 3;
 
   // Bonuses for enemy's safe checks
   const int QueenContactCheckBonus = 3;
@@ -554,7 +549,7 @@ namespace {
         if (b & ei.kingZone[Us])
         {
             ei.kingAttackersCount[Us]++;
         if (b & ei.kingZone[Us])
         {
             ei.kingAttackersCount[Us]++;
-            ei.kingAttackersWeight[Us] += AttackWeight[Piece];
+            ei.kingAttackersWeight[Us] += KingAttackWeights[Piece];
             Bitboard bb = (b & ei.attackedBy[Them][KING]);
             if (bb)
                 ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);
             Bitboard bb = (b & ei.attackedBy[Them][KING]);
             if (bb)
                 ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);