diff --git a/src/evaluate.c b/src/evaluate.c index e2360d1b..816ea7cb 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -106,6 +106,9 @@ const int ThreatByRook[8] = { S( 0, 0), S( 0, 0), S( 24, 43), S( 31, 45), S(-17, 47), S( 93,-73), S( 0, 0), S( 0, 0) }; +const int FarPiece[4] = { + S(-18, -6), S( -7, -6), S( 6, -2), S( 2, 13) +}; // KingLineDanger const int KingLineDanger[28] = { @@ -309,6 +312,12 @@ INLINE int EvalPiece(const Position *pos, EvalInfo *ei, const Color color, const TraceIncr(SemiForward); } } + + // Pieces far from own king + if (Distance(sq, kingSq(color)) > 3) { + eval += FarPiece[pt-2]; + TraceIncr(FarPiece[pt-2]); + } } return eval; diff --git a/src/tuner/tuner.c b/src/tuner/tuner.c index 05dd6cbf..87dc3407 100644 --- a/src/tuner/tuner.c +++ b/src/tuner/tuner.c @@ -73,6 +73,7 @@ extern const int PawnPhalanx[RANK_NB]; extern const int ThreatByMinor[8]; extern const int ThreatByRook[8]; +extern const int FarPiece[4]; // KingLineDanger extern const int KingLineDanger[28]; @@ -200,6 +201,7 @@ static void InitBaseParams(TVector tparams) { // Threats InitBaseArray(ThreatByMinor, 8); InitBaseArray(ThreatByRook, 8); + InitBaseArray(FarPiece, 4); // KingLineDanger InitBaseArray(KingLineDanger, 28); @@ -272,6 +274,7 @@ static void PrintParameters(TVector updates, TVector base) { puts("\n// Threats"); PrintArray(ThreatByMinor, 8); PrintArray(ThreatByRook, 8); + PrintArray(FarPiece, 4); puts("\n// KingLineDanger"); PrintArray(KingLineDanger, 28); @@ -339,6 +342,7 @@ static void InitCoefficients(TCoeffs coeffs) { // Threats InitCoeffArray(ThreatByMinor, 8); InitCoeffArray(ThreatByRook, 8); + InitCoeffArray(FarPiece, 4); // KingLineDanger InitCoeffArray(KingLineDanger, 28); diff --git a/src/tuner/tuner.h b/src/tuner/tuner.h index ba1e34ae..145264c1 100644 --- a/src/tuner/tuner.h +++ b/src/tuner/tuner.h @@ -49,7 +49,7 @@ // #define NPOSITIONS (14669229) // Total FENS in the book -#define NTERMS ( 552) // Number of terms being tuned +#define NTERMS ( 556) // Number of terms being tuned #define MAXEPOCHS ( 10000) // Max number of epochs allowed #define REPORTING ( 50) // How often to print the new parameters #define NPARTITIONS ( 64) // Total thread partitions @@ -97,6 +97,7 @@ typedef struct EvalTrace { int PawnPhalanx[RANK_NB][COLOR_NB]; int ThreatByMinor[8][COLOR_NB]; int ThreatByRook[8][COLOR_NB]; + int FarPiece[4][COLOR_NB]; int KingLineDanger[28][COLOR_NB]; int Mobility[4][28][COLOR_NB];