diff --git a/src/history.h b/src/history.h index 2173ab60..95f33ecc 100644 --- a/src/history.h +++ b/src/history.h @@ -36,15 +36,15 @@ #define ContCorrEntry(offset) (&(*(ss-offset)->contCorr)[piece((ss-1)->move)][toSq((ss-1)->move)]) #define NonPawnCorrEntry(color) (&thread->nonPawnCorrHistory[color][thread->pos.stm][NonPawnCorrIndex(&thread->pos, color)]) -#define QuietHistoryUpdate(move, bonus) (HistoryBonus(QuietEntry(move), bonus, 5280)) -#define PawnHistoryUpdate(move, bonus) (HistoryBonus(PawnEntry(move), bonus, 9275)) -#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, 16000)) -#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, 21250)) -#define PawnCorrHistoryUpdate(bonus) (HistoryBonus(PawnCorrEntry(), bonus, 1662)) -#define MinorCorrHistoryUpdate(bonus) (HistoryBonus(MinorCorrEntry(), bonus, 1024)) -#define MajorCorrHistoryUpdate(bonus) (HistoryBonus(MajorCorrEntry(), bonus, 1024)) -#define ContCorrHistoryUpdate(offset, bonus) (HistoryBonus(ContCorrEntry(offset), bonus, 1220)) -#define NonPawnCorrHistoryUpdate(bonus, color) (HistoryBonus(NonPawnCorrEntry(color), bonus, 1024)) +#define QuietHistoryUpdate(move, bonus) (HistoryBonus(QuietEntry(move), bonus, 4657)) +#define PawnHistoryUpdate(move, bonus) (HistoryBonus(PawnEntry(move), bonus, 9730)) +#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, 14315)) +#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, 20000)) +#define PawnCorrHistoryUpdate(bonus) (HistoryBonus(PawnCorrEntry(), bonus, 1723)) +#define MinorCorrHistoryUpdate(bonus) (HistoryBonus(MinorCorrEntry(), bonus, 1146)) +#define MajorCorrHistoryUpdate(bonus) (HistoryBonus(MajorCorrEntry(), bonus, 1111)) +#define ContCorrHistoryUpdate(offset, bonus) (HistoryBonus(ContCorrEntry(offset), bonus, 1244)) +#define NonPawnCorrHistoryUpdate(bonus, color) (HistoryBonus(NonPawnCorrEntry(color), bonus, 1162)) INLINE int PawnStructure(const Position *pos) { return pos->pawnKey & (PAWN_HISTORY_SIZE - 1); } @@ -61,15 +61,15 @@ INLINE void HistoryBonus(int16_t *entry, int bonus, int div) { } INLINE int Bonus(Depth depth) { - return MIN(2410, 268 * depth - 310); + return MIN(2405, 254 * depth - 293); } INLINE int Malus(Depth depth) { - return -MIN(834, 531 * depth - 148); + return -MIN(765, 508 * depth - 146); } INLINE int CorrectionBonus(int score, int eval, Depth depth) { - return CLAMP((score - eval) * depth / 4, -212, 254); + return CLAMP((score - eval) * depth / 4, -169, 294); } INLINE void UpdateContHistories(Stack *ss, Move move, int bonus) { @@ -153,16 +153,16 @@ INLINE int GetHistory(const Thread *thread, Stack *ss, Move move) { } INLINE int GetCorrectionHistory(const Thread *thread, const Stack *ss) { - int c = 6554 * *PawnCorrEntry() - + 6800 * *MinorCorrEntry() - + 3700 * *MajorCorrEntry() - + 7000 * (*NonPawnCorrEntry(WHITE) + *NonPawnCorrEntry(BLACK)) - + 3121 * *ContCorrEntry(2) - + 2979 * *ContCorrEntry(3) - + 2849 * *ContCorrEntry(4) - + 3121 * *ContCorrEntry(5) - + 2789 * *ContCorrEntry(6) - + 2979 * *ContCorrEntry(7); + int c = 6439 * *PawnCorrEntry() + + 6582 * *MinorCorrEntry() + + 3925 * *MajorCorrEntry() + + 7383 * (*NonPawnCorrEntry(WHITE) + *NonPawnCorrEntry(BLACK)) + + 3230 * *ContCorrEntry(2) + + 3375 * *ContCorrEntry(3) + + 2326 * *ContCorrEntry(4) + + 3018 * *ContCorrEntry(5) + + 3066 * *ContCorrEntry(6) + + 2561 * *ContCorrEntry(7); return c / 131072; } diff --git a/src/movepicker.c b/src/movepicker.c index dc7a0dcb..100e82f3 100644 --- a/src/movepicker.c +++ b/src/movepicker.c @@ -69,7 +69,7 @@ static void ScoreMoves(MovePicker *mp, const int stage) { : GetCaptureHistory(thread, move) + PieceValue[MG][capturing(move)]; } - SortMoves(list, -1000 * mp->depth); + SortMoves(list, -845 * mp->depth); } // Returns the next move to try in a position @@ -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 > 11300 - || (mp->list.moves[mp->list.next-1].score > -11100 && SEE(pos, move, mp->threshold))) + if ( mp->list.moves[mp->list.next-1].score > 11400 + || (mp->list.moves[mp->list.next-1].score > -10400 && SEE(pos, move, mp->threshold))) return move; else mp->list.moves[mp->bads++].move = move; diff --git a/src/search.c b/src/search.c index 89bd461d..3df4c77a 100644 --- a/src/search.c +++ b/src/search.c @@ -48,8 +48,8 @@ static int Reductions[2][32][32]; CONSTR(1) InitReductions() { for (int depth = 1; depth < 32; ++depth) for (int moves = 1; moves < 32; ++moves) - Reductions[0][depth][moves] = 0.48 + log(depth) * log(moves) / 3.43, // capture - Reductions[1][depth][moves] = 1.92 + log(depth) * log(moves) / 2.46; // quiet + Reductions[0][depth][moves] = 0.42 + log(depth) * log(moves) / 3.53, // capture + Reductions[1][depth][moves] = 1.96 + log(depth) * log(moves) / 2.27; // quiet } // Checks whether a move was already searched in multi-pv mode @@ -163,7 +163,7 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, int beta) { if (eval > alpha) alpha = eval; - futility = eval + 132; + futility = eval + 164; bestScore = eval; moveloop: @@ -367,18 +367,18 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth // Reverse Futility Pruning if ( depth < 7 && eval >= beta - && eval - 76 * (depth - improving) - (ss-1)->histScore / 119 >= beta - && (!ttMove || GetHistory(thread, ss, ttMove) > 7600)) + && eval - 75 * (depth - improving) - (ss-1)->histScore / 127 >= beta + && (!ttMove || GetHistory(thread, ss, ttMove) > 6650)) return eval; // Null Move Pruning if ( eval >= beta && eval >= ss->staticEval - && ss->staticEval >= beta + 158 - 19 * depth - && (ss-1)->histScore < 26300 + && ss->staticEval >= beta + 147 - 15 * depth + && (ss-1)->histScore < 28250 && pos->nonPawnCount[sideToMove] > (depth > 8)) { - Depth reduction = 4 + depth / 4 + MIN(3, (eval - beta) / 224); + Depth reduction = 4 + depth / 4 + MIN(3, (eval - beta) / 222); ss->move = NOMOVE; ss->continuation = &thread->continuation[0][0][EMPTY][0]; @@ -463,19 +463,19 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth && thread->doPruning && !isLoss(bestScore)) { - int R = Reductions[quiet][MIN(31, depth)][MIN(31, moveCount)] - ss->histScore / 9050; + int R = Reductions[quiet][MIN(31, depth)][MIN(31, moveCount)] - ss->histScore / 9322; Depth lmrDepth = depth - 1 - R; // Quiet late move pruning - if (moveCount > (improving ? 1 + depth * depth : depth * depth / 2)) + if (moveCount > (improving ? 2 + depth * depth : depth * depth / 2)) mp.onlyNoisy = true; // History pruning - if (lmrDepth < 3 && ss->histScore < -1024 * depth) + if (lmrDepth < 3 && ss->histScore < -1204 * depth) continue; // SEE pruning - if (lmrDepth < 7 && !SEE(pos, move, -63 * depth)) + if (lmrDepth < 7 && !SEE(pos, move, -69 * depth)) continue; } @@ -536,7 +536,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth // Base reduction int r = Reductions[quiet][MIN(31, depth)][MIN(31, moveCount)]; // Adjust reduction by move history - r -= ss->histScore / 10135; + r -= ss->histScore / 9612; // Reduce less in pv nodes r -= pvNode; // Reduce less when improving @@ -555,7 +555,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth // Re-search with the same window at full depth if the reduced search failed high if (score > alpha && lmrDepth < newDepth) { - bool deeper = score > bestScore + 1 + 7 * (newDepth - lmrDepth); + bool deeper = score > bestScore + 1 + 8 * (newDepth - lmrDepth); newDepth += deeper; @@ -750,7 +750,7 @@ static void *IterativeDeepening(void *voidThread) { Limits.optimalUsage = MIN(500, Limits.optimalUsage); double nodeRatio = 1.0 - (double)thread->rootMoves[0].nodes / (MAX(1, pos->nodes)); - double timeRatio = 0.55 + 3.01 * nodeRatio; + double timeRatio = 0.57 + 3.56 * nodeRatio; // If an iteration finishes after optimal time usage, stop the search if ( Limits.timelimit