Skip to content

Commit

Permalink
Document Threat[] indices
Browse files Browse the repository at this point in the history
From Marco's repo.

No functional change.
  • Loading branch information
lucasart committed Jul 29, 2014
1 parent f2053ba commit 5adc678
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/evaluate.cpp
Expand Up @@ -498,14 +498,15 @@ namespace {

Bitboard b, weakEnemies, protectedEnemies;
Score score = SCORE_ZERO;
enum { Minor, Major };

// Protected enemies
protectedEnemies = (pos.pieces(Them) ^ pos.pieces(Them,PAWN))
& ei.attackedBy[Them][PAWN]
& (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]);

if(protectedEnemies)
score += Threat[0][type_of(pos.piece_on(lsb(protectedEnemies)))];
score += Threat[Minor][type_of(pos.piece_on(lsb(protectedEnemies)))];

// Enemies not defended by a pawn and under our attack
weakEnemies = pos.pieces(Them)
Expand All @@ -517,11 +518,11 @@ namespace {
{
b = weakEnemies & (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]);
if (b)
score += Threat[0][type_of(pos.piece_on(lsb(b)))];
score += Threat[Minor][type_of(pos.piece_on(lsb(b)))];

b = weakEnemies & (ei.attackedBy[Us][ROOK] | ei.attackedBy[Us][QUEEN]);
if (b)
score += Threat[1][type_of(pos.piece_on(lsb(b)))];
score += Threat[Major][type_of(pos.piece_on(lsb(b)))];

b = weakEnemies & ~ei.attackedBy[Them][ALL_PIECES];
if (b)
Expand Down

0 comments on commit 5adc678

Please sign in to comment.