1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Rename AttackWeight[] in KingAttackWeights[]

Also simplify a bit the code removing useless
named constants.

No functional change.
This commit is contained in:
Marco Costalba 2010-05-07 11:36:25 +02:00
parent 0f712ad4fd
commit c0334c7bac

View file

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