Skip to content

Commit

Permalink
Bench: 26539847
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Nov 4, 2024
1 parent 347f640 commit 39a56a1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 62 deletions.
12 changes: 3 additions & 9 deletions src/evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,6 @@ INLINE void InitEvalInfo(const Position *pos, EvalInfo *ei, const Color color) {
ei->attackedBy[color][ALL] = ei->attackedBy[color][KING] | ei->attackedBy[color][PAWN];
}

extern int PawnScaleBase;
extern int PawnScaleX;
extern int PawnScaleBothSides;
extern int OCBSolo;
extern int OCBDuo;

// Calculate scale factor to lower overall eval based on various features
static int ScaleFactor(const Position *pos, const int eval) {

Expand All @@ -548,11 +542,11 @@ static int ScaleFactor(const Position *pos, const int eval) {

int strongPawnCount = PopCount(strongPawns);
int x = 8 - strongPawnCount;
int pawnScale = PawnScaleBase - PawnScaleX * x - x * x;
int pawnScale = 128 - x * x;

// Scale down when there aren't pawns on both sides of the board
if (!(strongPawns & QueenSideBB) || !(strongPawns & KingSideBB))
pawnScale -= PawnScaleBothSides;
pawnScale -= 20;

pawnScale = MIN(pawnScale, 128);

Expand All @@ -563,7 +557,7 @@ static int ScaleFactor(const Position *pos, const int eval) {
&& Single(colorPieceBB(WHITE, BISHOP))
&& Single(colorPieceBB(BLACK, BISHOP))
&& Single(pieceBB(BISHOP) & BlackSquaresBB))
return MIN((pos->nonPawnCount[WHITE] == 1 ? OCBSolo : OCBDuo), pawnScale);
return MIN((pos->nonPawnCount[WHITE] == 1 ? 64 : 96), pawnScale);

return pawnScale;
}
Expand Down
6 changes: 6 additions & 0 deletions src/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#define PawnHistoryUpdate(move, bonus) (HistoryBonus(PawnEntry(move), bonus, HistPDiv))
#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, HistNDiv))
#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, HistCDiv))
#define PawnCorrectionHistoryUpdate(bonus) (HistoryBonus(PawnCorrectionEntry(), bonus, 1024))
#define MaterialCorrectionHistoryUpdate(bonus) (HistoryBonus(MaterialCorrectionEntry(), bonus, 1024))


extern int HistQDiv;
Expand All @@ -63,6 +65,10 @@ INLINE int Malus(Depth depth) {
return -MIN(HistMalusMax, HistMalusDepth * depth - HistMalusBase);
}

INLINE int CorrectionBonus(int score, int eval, Depth depth) {
return CLAMP((score - eval) * depth / 8, -1024 / 4, 1024 / 4);
}

INLINE void UpdateContHistories(Stack *ss, Move move, int bonus) {
ContHistoryUpdate(1, move, bonus);
ContHistoryUpdate(2, move, bonus);
Expand Down
69 changes: 31 additions & 38 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,43 @@ atomic_bool SEARCH_STOPPED = true;
static int Reductions[2][32][32];


float LMRNoisyBase = 0.30;
float LMRNoisyDiv = 3.33;
float LMRQuietBase = 1.50;
float LMRNoisyBase = 0.33;
float LMRNoisyDiv = 3.20;
float LMRQuietBase = 1.65;
float LMRQuietDiv = 2.80;

int QSFutility = 75;

int IIRDepth = 3;
int IIRCutDepth = 8;
int RFPDepth = 7;
int RFPBase = 84;
int RFPHistScore = 160;
int RFPHistory = 7600;
int NMPFlat = 166;
int NMPDepth = 21;
int RFPBase = 92;
int RFPHistScore = 128;
int RFPHistory = 8650;
int NMPFlat = 174;
int NMPDepth = 24;
int NMPHist = 25000;
int NMPRBase = 3;
int NMPRDepth = 4;
int NMPREvalDiv = 256;
int NMPREvalMin = 3;
int ProbCut = 200;
int ProbCutDepth = 5;
int ProbCutReturn = 157;
int ProbCutReturn = 160;
int LMRPruneHist = 9000;
int LMPImp = 0;
int LMPNonImp = -2;
int LMRPruneHist = 9570;
int HistPruneDepth = 3;
int HistPrune = 1024;
int SEEPruneDepth = 7;
int SEEPruneQ = 46;
int SEEPruneQ = 53;
int SEEPruneN = 73;
int SingExtDepth = 4;
int SingExtTTDepth = 3;
int SingExtDouble = 11;
int LMRHist = 9570;
int DeeperBase = 33;
int DeeperDepth = 17;

int QSFutility = 75;
int SingExtDouble = 6;
int LMRHist = 10275;
int DeeperBase = 23;
int DeeperDepth = 13;

int Aspi = 9;
int AspiScoreDiv = 16384;
Expand All @@ -88,16 +88,16 @@ float TrendDiv = 0.50;
int PruneDiv = 64;
int PruneDepthDiv = 270;

int HistQDiv = 7180;
int HistQDiv = 6880;
int HistPDiv = 8192;
int HistCDiv = 28650;
int HistNDiv = 16384;
int HistBonusMax = 2545;
int HistBonusBase = 300;
int HistBonusDepth = 315;
int HistMalusMax = 1700;
int HistMalusBase = 205;
int HistMalusDepth = 480;
int HistCDiv = 30000;
int HistBonusMax = 2645;
int HistBonusBase = 305;
int HistBonusDepth = 285;
int HistMalusMax = 1435;
int HistMalusBase = 213;
int HistMalusDepth = 455;

int Tempo = 18;
int BasePower = -30;
Expand All @@ -117,19 +117,12 @@ int Modifier5 = 96;
int Modifier6 = 124;
int Modifier7 = 124;
int Modifier8 = 128;
int KSCountOffset = 3;
int KSCountScale = 8;
int PawnScaleBase = 128;
int PawnScaleX = 0;
int PawnScaleBothSides = 20;
int OCBSolo = 64;
int OCBDuo = 96;

int ScoreMovesLimit = 1500;
int MPGood = 14350;
int MPGoodDepth = 197;
int MPBad = 10085;
int MPBadDepth = 155;

int ScoreMovesLimit = 1835;
int MPGood = 14600;
int MPGoodDepth = 270;
int MPBad = 10470;
int MPBadDepth = 68;

// Initializes the late move reduction array
CONSTR(1) InitReductions() {
Expand Down
15 changes: 0 additions & 15 deletions src/uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ extern int Modifier5;
extern int Modifier6;
extern int Modifier7;
extern int Modifier8;
extern int PawnScaleBase;
extern int PawnScaleX;
extern int PawnScaleBothSides;
extern int OCBSolo;
extern int OCBDuo;

extern int ScoreMovesLimit;
extern int MPGood;
Expand Down Expand Up @@ -279,11 +274,6 @@ static void SetOption(char *str) {
else if (OptionNameIs("Modifier6" )) Modifier6 = IntValue;
else if (OptionNameIs("Modifier7" )) Modifier7 = IntValue;
else if (OptionNameIs("Modifier8" )) Modifier8 = IntValue;
else if (OptionNameIs("PawnScaleBase")) PawnScaleBase = IntValue;
else if (OptionNameIs("PawnScaleX" )) PawnScaleX = IntValue;
else if (OptionNameIs("PawnScaleBothSides")) PawnScaleBothSides = IntValue;
else if (OptionNameIs("OCBSolo" )) OCBSolo = IntValue;
else if (OptionNameIs("OCBDuo" )) OCBDuo = IntValue;

else if (OptionNameIs("ScoreMovesLimit")) ScoreMovesLimit = IntValue;
else if (OptionNameIs("MPGood" )) MPGood = IntValue;
Expand Down Expand Up @@ -384,11 +374,6 @@ static void Info() {
printf("option name Modifier6 type spin default %d min %d max %d\n", Modifier6, -100000, 100000);
printf("option name Modifier7 type spin default %d min %d max %d\n", Modifier7, -100000, 100000);
printf("option name Modifier8 type spin default %d min %d max %d\n", Modifier8, -100000, 100000);
printf("option name PawnScaleBase type spin default %d min %d max %d\n", PawnScaleBase, -100000, 100000);
printf("option name PawnScaleX type spin default %d min %d max %d\n", PawnScaleX, -100000, 100000);
printf("option name PawnScaleBothSides type spin default %d min %d max %d\n", PawnScaleBothSides, -100000, 100000);
printf("option name OCBSolo type spin default %d min %d max %d\n", OCBSolo, -100000, 100000);
printf("option name OCBDuo type spin default %d min %d max %d\n", OCBDuo, -100000, 100000);

printf("option name ScoreMovesLimit type spin default %d min %d max %d\n", ScoreMovesLimit, -100000, 100000);
printf("option name MPGood type spin default %d min %d max %d\n", MPGood, -100000, 100000);
Expand Down

0 comments on commit 39a56a1

Please sign in to comment.