Skip to content

Commit

Permalink
Bench: 21985878
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Jan 18, 2025
1 parent 8048bb9 commit a037a69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/tuner/tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -200,6 +201,7 @@ static void InitBaseParams(TVector tparams) {
// Threats
InitBaseArray(ThreatByMinor, 8);
InitBaseArray(ThreatByRook, 8);
InitBaseArray(FarPiece, 4);

// KingLineDanger
InitBaseArray(KingLineDanger, 28);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -339,6 +342,7 @@ static void InitCoefficients(TCoeffs coeffs) {
// Threats
InitCoeffArray(ThreatByMinor, 8);
InitCoeffArray(ThreatByRook, 8);
InitCoeffArray(FarPiece, 4);

// KingLineDanger
InitCoeffArray(KingLineDanger, 28);
Expand Down
3 changes: 2 additions & 1 deletion src/tuner/tuner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit a037a69

Please sign in to comment.