Skip to content

Commit

Permalink
Bench: 25220913
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Oct 29, 2023
1 parent a4047d2 commit eb32a93
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ const int Mobility[4][28] = {
};

// KingSafety [pt-2]
const int AttackPower[4] = { 36, 19, 33, 74 };
const int CheckPower[4] = { 88, 38, 67, 63 };
const int CountModifier[8] = { 0, 0, 67, 119, 99, 125, 126, 128 };
const int AttackPower[4] = { 34, 19, 30, 74 };
const int CheckPower[4] = { 89, 41, 71, 64 };
const int CountModifier[8] = { 0, 0, 68, 118, 100, 127, 123, 128 };


// Evaluates pawns
Expand Down
8 changes: 4 additions & 4 deletions src/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
#define NoisyEntry(move) (&thread->captureHistory[piece(move)][toSq(move)][PieceTypeOf(capturing(move))])
#define ContEntry(offset, move) (&(*(ss-offset)->continuation)[piece(move)][toSq(move)])

#define QuietHistoryUpdate(move, bonus) (HistoryBonus(QuietEntry(move), bonus, 6910))
#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, 17250))
#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, 19742))
#define QuietHistoryUpdate(move, bonus) (HistoryBonus(QuietEntry(move), bonus, 6750))
#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, 17500))
#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, 20000))


INLINE void HistoryBonus(int16_t *cur, int bonus, int div) {
*cur += bonus - *cur * abs(bonus) / div;
}

INLINE int Bonus(Depth depth) {
return MIN(2225, 378 * depth - 300);
return MIN(2170, 390 * depth - 280);
}

INLINE void UpdateContHistories(Stack *ss, Move move, int bonus) {
Expand Down
4 changes: 2 additions & 2 deletions src/movepicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ Move NextMove(MovePicker *mp) {
case NOISY_GOOD:
// Save seemingly bad noisy moves for later
while ((move = PickNextMove(mp)))
if ( mp->list.moves[mp->list.next-1].score > 13000
|| (mp->list.moves[mp->list.next-1].score > -8666 && SEE(pos, move, mp->threshold)))
if ( mp->list.moves[mp->list.next-1].score > 13500
|| (mp->list.moves[mp->list.next-1].score > -8800 && SEE(pos, move, mp->threshold)))
return move;
else
mp->list.moves[mp->bads++].move = move;
Expand Down
26 changes: 13 additions & 13 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CONSTR(1) InitReductions() {
for (int depth = 1; depth < 32; ++depth)
for (int moves = 1; moves < 32; ++moves)
Reductions[0][depth][moves] = 0.00 + log(depth) * log(moves) / 3.00, // capture
Reductions[1][depth][moves] = 1.40 + log(depth) * log(moves) / 2.00; // quiet
Reductions[1][depth][moves] = 1.50 + log(depth) * log(moves) / 2.05; // quiet
}

// Checks if the move is in the list of searchmoves if any were given
Expand Down Expand Up @@ -125,7 +125,7 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, const int beta) {
if (eval > alpha)
alpha = eval;

futility = eval + 55;
futility = eval + 60;
bestScore = eval;

moveloop:
Expand Down Expand Up @@ -317,18 +317,18 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth
// Reverse Futility Pruning
if ( depth < 7
&& eval >= beta
&& eval - 100 * depth - (ss-1)->histScore / 320 >= beta
&& (!ttMove || GetHistory(thread, ss, ttMove) > 8500))
&& eval - 100 * depth - (ss-1)->histScore / 300 >= beta
&& (!ttMove || GetHistory(thread, ss, ttMove) > 7500))
return eval;

// Null Move Pruning
if ( eval >= beta
&& eval >= ss->eval
&& ss->eval >= beta + 130 - 16 * depth
&& (ss-1)->histScore < 32500
&& ss->eval >= beta + 140 - 15 * depth
&& (ss-1)->histScore < 27500
&& pos->nonPawnCount[sideToMove] > (depth > 8)) {

Depth reduction = 3 + depth / 4 + MIN(3, (eval - beta) / 274);
Depth reduction = 3 + depth / 4 + MIN(3, (eval - beta) / 270);

// Remember who last null-moved
Color nullMoverTemp = thread->nullMover;
Expand All @@ -348,10 +348,10 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth
return score >= TBWIN_IN_MAX ? beta : score;
}

int probCutBeta = beta + 200;
int probCutBeta = beta + 180;

// ProbCut
if ( depth >= 4
if ( depth >= 5
&& (!ttHit || ttBound == BOUND_LOWER || ttScore >= probCutBeta)) {

InitProbcutMP(&mp, thread, ss, probCutBeta - ss->eval);
Expand All @@ -376,7 +376,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth

// Cut if the reduced depth search beats the threshold
if (score >= probCutBeta)
return score - 120;
return score - 115;
}
}

Expand Down Expand Up @@ -421,7 +421,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth
continue;

// SEE pruning
if (lmrDepth < 8 && !SEE(pos, move, quiet ? -50 * depth : -90 * depth))
if (lmrDepth < 8 && !SEE(pos, move, quiet ? -50 * depth : -95 * depth))
continue;
}

Expand Down Expand Up @@ -510,7 +510,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth

// Research with the same window at full depth if the reduced search failed high
if (score > alpha && lmrDepth < newDepth) {
bool deeper = score > bestScore + 62 + 11 * (newDepth - lmrDepth);
bool deeper = score > bestScore + 60 + 12 * (newDepth - lmrDepth);

newDepth += deeper;

Expand Down Expand Up @@ -602,7 +602,7 @@ static void AspirationWindow(Thread *thread, Stack *ss) {
int alpha = MAX(prevScore - delta, -INFINITE);
int beta = MIN(prevScore + delta, INFINITE);

int x = CLAMP(prevScore / 2, -35, 35);
int x = CLAMP(prevScore / 2, -33, 33);
pos->trend = sideToMove == WHITE ? S(x, x/2) : -S(x, x/2);

// Repeatedly search and adjust the window until the score is inside the window
Expand Down

0 comments on commit eb32a93

Please sign in to comment.