Skip to content

Commit

Permalink
Threats retuned
Browse files Browse the repository at this point in the history
STC:

LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 45239 W: 8913 L: 8591 D: 27735

LTC:

LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 21046 W: 3200 L: 2989 D: 14857

Bench: 8012530

Resolves #526
  • Loading branch information
Rocky640 authored and zamar committed Dec 14, 2015
1 parent 69240a9 commit 9fac577
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/evaluate.cpp
Expand Up @@ -108,10 +108,10 @@ namespace {


// Evaluation weights, indexed by the corresponding evaluation term
enum { Mobility, PawnStructure, PassedPawns, Space, KingSafety, Threats };
enum { Mobility, PawnStructure, PassedPawns, Space, KingSafety };

const struct Weight { int mg, eg; } Weights[] = {
{266, 334}, {214, 203}, {193, 262}, {47, 0}, {330, 0}, {404, 241}
{266, 334}, {214, 203}, {193, 262}, {47, 0}, {330, 0}
};

Score operator*(Score s, const Weight& w) {
Expand Down Expand Up @@ -161,14 +161,14 @@ namespace {
// bonuses according to which piece type attacks which one.
// Attacks on lesser pieces which are pawn defended are not considered.
const Score Threat[2][PIECE_TYPE_NB] = {
{ S(0, 0), S(0, 32), S(25, 39), S(28, 44), S(42, 98), S(35,105) }, // Minor attacks
{ S(0, 0), S(0, 27), S(26, 57), S(26, 57), S( 0, 30), S(23, 51) } // Rook attacks
{ S(0, 0), S(0, 33), S(45, 43), S(46, 47), S(72, 107), S(48,118) }, // Minor attacks
{ S(0, 0), S(0, 25), S(40, 62), S(40, 59), S( 0, 34), S(35, 48) } // Rook attacks
};

// ThreatenedByPawn[PieceType] contains a penalty according to which piece
// type is attacked by a pawn.
const Score ThreatenedByPawn[PIECE_TYPE_NB] = {
S(0, 0), S(0, 0), S(107, 138), S(84, 122), S(114, 203), S(121, 217)
S(0, 0), S(0, 0), S(176, 139), S(131, 127), S(217, 218), S(203, 215)
};

// Passed[mg/eg][Rank] contains midgame and endgame bonuses for passed pawns.
Expand All @@ -184,20 +184,20 @@ namespace {
S(-27, -12), S( 1, -8), S( 3, 10), S( 12, 10)
};

const Score ThreatenedByHangingPawn = S(40, 60);
const Score ThreatenedByHangingPawn = S(70, 63);

// Assorted bonuses and penalties used by evaluation
const Score KingOnOne = S( 2, 58);
const Score KingOnMany = S( 6,125);
const Score KingOnOne = S( 3, 62);
const Score KingOnMany = S( 9,138);
const Score RookOnPawn = S( 7, 27);
const Score RookOnOpenFile = S(43, 21);
const Score RookOnSemiOpenFile = S(19, 10);
const Score BishopPawns = S( 8, 12);
const Score MinorBehindPawn = S(16, 0);
const Score TrappedRook = S(92, 0);
const Score Unstoppable = S( 0, 20);
const Score Hanging = S(31, 26);
const Score PawnAttackThreat = S(20, 20);
const Score Hanging = S(48, 28);
const Score PawnAttackThreat = S(31, 19);
const Score Checked = S(20, 20);

// Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
Expand Down Expand Up @@ -557,9 +557,9 @@ namespace {
score += popcount<Max15>(b) * PawnAttackThreat;

if (DoTrace)
Trace::add(THREAT, Us, score * Weights[Threats]);
Trace::add(THREAT, Us, score);

return score * Weights[Threats];
return score;
}


Expand Down

0 comments on commit 9fac577

Please sign in to comment.