diff --git a/src/evaluate.c b/src/evaluate.c index d7b90bf9..63e00e1d 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -51,7 +51,7 @@ const int PieceValue[2][PIECE_NB] = { }; // Bonus for being the side to move -const int Tempo = 19; +extern int Tempo; // Misc bonuses and maluses const int PawnDoubled = S(-11,-48); @@ -136,11 +136,49 @@ const int Mobility[4][28] = { S(122,221), S(135,193), S(146,166), S(125,162) } }; -// KingSafety [pt-2] -const int AttackPower[4] = { 36, 19, 22, 72 }; -const int CheckPower[4] = { 71, 39, 80, 74 }; -const int CountModifier[8] = { 0, 0, 63, 126, 96, 124, 124, 128 }; +extern int BasePower; +extern int NPower; +extern int BPower; +extern int RPower; +extern int QPower; +extern int NCPower; +extern int BCPower; +extern int RCPower; +extern int QCPower; +extern int Modifier1; +extern int Modifier2; +extern int Modifier3; +extern int Modifier4; +extern int Modifier5; +extern int Modifier6; +extern int Modifier7; +extern int Modifier8; +// KingSafety [pt-2] +int AttackPower[4] = { 0 }; +int CheckPower[4] = { 0 }; +int CountModifier[8] = { 0 }; + +void InitSafety() { + AttackPower[KNIGHT-2] = NPower; + AttackPower[BISHOP-2] = BPower; + AttackPower[ROOK -2] = RPower; + AttackPower[QUEEN -2] = QPower; + + CheckPower[KNIGHT-2] = NCPower; + CheckPower[BISHOP-2] = BCPower; + CheckPower[ROOK -2] = RCPower; + CheckPower[QUEEN -2] = QCPower; + + CountModifier[0] = Modifier1; + CountModifier[1] = Modifier2; + CountModifier[2] = Modifier3; + CountModifier[3] = Modifier4; + CountModifier[4] = Modifier5; + CountModifier[5] = Modifier6; + CountModifier[6] = Modifier7; + CountModifier[7] = Modifier8; +} // Evaluates pawns INLINE int EvalPawns(const Position *pos, EvalInfo *ei, const Color color) { @@ -483,7 +521,7 @@ INLINE void InitEvalInfo(const Position *pos, EvalInfo *ei, const Color color) { // King Safety ei->kingZone[color] = AttackBB(KING, kingSq(color), 0); - ei->attackPower[color] = -30; + ei->attackPower[color] = BasePower; ei->attackCount[color] = 0; // Clear passed pawns, filled in during pawn eval @@ -494,6 +532,12 @@ 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) { @@ -503,11 +547,13 @@ static int ScaleFactor(const Position *pos, const int eval) { int strongPawnCount = PopCount(strongPawns); int x = 8 - strongPawnCount; - int pawnScale = 128 - x * x; + int pawnScale = PawnScaleBase - PawnScaleX * x - x * x; // Scale down when there aren't pawns on both sides of the board if (!(strongPawns & QueenSideBB) || !(strongPawns & KingSideBB)) - pawnScale -= 20; + pawnScale -= PawnScaleBothSides; + + pawnScale = MIN(pawnScale, 128); // Opposite-colored bishop if ( pos->nonPawnCount[WHITE] <= 2 @@ -516,7 +562,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 ? 64 : 96), pawnScale); + return MIN((pos->nonPawnCount[WHITE] == 1 ? OCBSolo : OCBDuo), pawnScale); return pawnScale; } diff --git a/src/evaluate.h b/src/evaluate.h index 56be48da..6eb6f02f 100644 --- a/src/evaluate.h +++ b/src/evaluate.h @@ -33,7 +33,7 @@ typedef struct PawnEntry { typedef PawnEntry PawnCache[PAWN_CACHE_SIZE]; -extern const int Tempo; +extern int Tempo; extern const int PieceValue[COLOR_NB][PIECE_NB]; @@ -54,3 +54,4 @@ INLINE int UpdatePhase(int value) { // Returns a static evaluation of the position int EvalPosition(const Position *pos, PawnCache pc); +void InitSafety(); diff --git a/src/history.h b/src/history.h index 20672d01..c88ed5a0 100644 --- a/src/history.h +++ b/src/history.h @@ -30,9 +30,20 @@ #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, 6500)) -#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, 15200)) -#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, 26850)) +#define QuietHistoryUpdate(move, bonus) (HistoryBonus(QuietEntry(move), bonus, HistQDiv)) +#define NoisyHistoryUpdate(move, bonus) (HistoryBonus(NoisyEntry(move), bonus, HistNDiv)) +#define ContHistoryUpdate(offset, move, bonus) (HistoryBonus(ContEntry(offset, move), bonus, HistCDiv)) + + +extern int HistQDiv; +extern int HistCDiv; +extern int HistNDiv; +extern int HistBonusMax; +extern int HistBonusBase; +extern int HistBonusDepth; +extern int HistMalusMax; +extern int HistMalusBase; +extern int HistMalusDepth; INLINE void HistoryBonus(int16_t *cur, int bonus, int div) { @@ -40,11 +51,11 @@ INLINE void HistoryBonus(int16_t *cur, int bonus, int div) { } INLINE int Bonus(Depth depth) { - return MIN(2560, 333 * depth - 285); + return MIN(HistBonusMax, HistBonusDepth * depth - HistBonusBase); } INLINE int Malus(Depth depth) { - return -MIN(1900, 367 * depth - 252); + return -MIN(HistMalusMax, HistMalusDepth * depth - HistMalusBase); } INLINE void UpdateContHistories(Stack *ss, Move move, int bonus) { diff --git a/src/movepicker.c b/src/movepicker.c index c729f06e..14914e0b 100644 --- a/src/movepicker.c +++ b/src/movepicker.c @@ -22,6 +22,13 @@ #include "movepicker.h" +extern int ScoreMovesLimit; +extern int MPGood; +extern int MPGoodDepth; +extern int MPBad; +extern int MPBadDepth; + + // Return the next best move static Move PickNextMove(MovePicker *mp) { @@ -69,7 +76,7 @@ static void ScoreMoves(MovePicker *mp, const int stage) { : GetCaptureHistory(thread, move) + PieceValue[MG][capturing(move)]; } - SortMoves(list, -1380 * mp->depth); + SortMoves(list, -ScoreMovesLimit * mp->depth); } // Returns the next move to try in a position @@ -96,8 +103,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 > 14540 - 200 * mp->depth - || (mp->list.moves[mp->list.next-1].score > -9935 + 200 * mp->depth && SEE(pos, move, mp->threshold))) + if ( mp->list.moves[mp->list.next-1].score > MPGood - MPGoodDepth * mp->depth + || (mp->list.moves[mp->list.next-1].score > -MPBad + MPBadDepth * mp->depth && 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 1c1a68e7..4a23ee51 100644 --- a/src/search.c +++ b/src/search.c @@ -43,12 +43,103 @@ atomic_bool SEARCH_STOPPED = true; static int Reductions[2][32][32]; +float LMRNoisyBase = 0.13; +float LMRNoisyDiv = 3.45; +float LMRQuietBase = 1.30; +float LMRQuietDiv = 2.80; + +int IIRDepth = 3; +int IIRCutDepth = 8; +int RFPDepth = 7; +int RFPBase = 78; +int RFPHistScore = 200; +int RFPHistory = 6950; +int NMPFlat = 146; +int NMPDepth = 20; +int NMPHist = 27150; +int NMPRBase = 3; +int NMPRDepth = 4; +int NMPREvalDiv = 256; +int NMPREvalMin = 3; +int ProbCut = 200; +int ProbCutDepth = 5; +int ProbCutReturn = 176; +int LMPImp = 0; +int LMPNonImp = -2; +int HistPruneDepth = 3; +int HistPrune = 1024; +int SEEPruneDepth = 7; +int SEEPruneQ = 47; +int SEEPruneN = 72; +int SingExtDepth = 4; +int SingExtTTDepth = 3; +int SingExtDouble = 17; +int LMRHist = 9600; +int DeeperBase = 49; +int DeeperDepth = 16; + +int QSFutility = 75; + +int Aspi = 9; +int AspiScoreDiv = 16384; +int Trend = 32; +float TrendDiv = 0.50; +int PruneDiv = 64; +int PruneDepthDiv = 270; + +int HistQDiv = 6500; +int HistCDiv = 26850; +int HistNDiv = 15200; +int HistBonusMax = 2560; +int HistBonusBase = 285; +int HistBonusDepth = 333; +int HistMalusMax = 1900; +int HistMalusBase = 252; +int HistMalusDepth = 367; + +int Tempo = 19; +int BasePower = -30; +int NPower = 36; +int BPower = 19; +int RPower = 22; +int QPower = 72; +int NCPower = 71; +int BCPower = 39; +int RCPower = 80; +int QCPower = 74; +int Modifier1 = 0; +int Modifier2 = 0; +int Modifier3 = 63; +int Modifier4 = 126; +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 = 1380; +int MPGood = 14540; +int MPGoodDepth = 200; +int MPBad = 9935; +int MPBadDepth = 200; + // Initializes the late move reduction array CONSTR(1) InitReductions() { for (int depth = 1; depth < 32; ++depth) for (int moves = 1; moves < 32; ++moves) - Reductions[0][depth][moves] = 0.13 + log(depth) * log(moves) / 3.45, // capture - Reductions[1][depth][moves] = 1.30 + log(depth) * log(moves) / 2.80; // quiet + Reductions[0][depth][moves] = LMRNoisyBase + log(depth) * log(moves) / LMRNoisyDiv, // capture + Reductions[1][depth][moves] = LMRQuietBase + log(depth) * log(moves) / LMRQuietDiv; // quiet +} + +void Reinit() { + InitReductions(); + InitSafety(); } // Checks whether a move was already searched in multi-pv mode @@ -121,7 +212,7 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, const int beta) { if (eval > alpha) alpha = eval; - futility = eval + 75; + futility = eval + QSFutility; bestScore = eval; moveloop: @@ -297,10 +388,10 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth bool improving = !inCheck && eval > (ss-2)->eval; // Internal iterative reduction based on Rebel's idea - if (pvNode && depth >= 3 && !ttMove) + if (pvNode && depth >= IIRDepth && !ttMove) depth--; - if (cutnode && depth >= 8 && !ttMove) + if (cutnode && depth >= IIRCutDepth && !ttMove) depth--; // Skip pruning in check, pv nodes, early iterations, when proving singularity, looking for terminal scores, or after a null move @@ -308,20 +399,20 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth goto move_loop; // Reverse Futility Pruning - if ( depth < 7 + if ( depth < RFPDepth && eval >= beta - && eval - 78 * (depth - improving) - (ss-1)->histScore / 200 >= beta - && (!ttMove || GetHistory(thread, ss, ttMove) > 6950)) + && eval - RFPBase * (depth - improving) - (ss-1)->histScore / RFPHistScore >= beta + && (!ttMove || GetHistory(thread, ss, ttMove) > RFPHistory)) return eval; // Null Move Pruning if ( eval >= beta && eval >= ss->eval - && ss->eval >= beta + 146 - 20 * depth - && (ss-1)->histScore < 27150 + && ss->eval >= beta + NMPFlat - NMPDepth * depth + && (ss-1)->histScore < NMPHist && pos->nonPawnCount[sideToMove] > (depth > 8)) { - Depth reduction = 3 + depth / 4 + MIN(3, (eval - beta) / 256); + Depth reduction = NMPRBase + depth / NMPRDepth + MIN(NMPREvalMin, (eval - beta) / NMPREvalDiv); ss->continuation = &thread->continuation[0][0][EMPTY][0]; @@ -335,10 +426,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 + ProbCut; // ProbCut - if ( depth >= 5 + if ( depth >= ProbCutDepth && (!ttHit || ttBound == BOUND_LOWER || ttScore >= probCutBeta)) { InitProbcutMP(&mp, thread, ss, probCutBeta - ss->eval); @@ -363,7 +454,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 - 176; + return score - ProbCutReturn; } } @@ -396,19 +487,19 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth && thread->doPruning && bestScore > -TBWIN_IN_MAX) { - int R = Reductions[quiet][MIN(31, depth)][MIN(31, moveCount)] - ss->histScore / 9600; + int R = Reductions[quiet][MIN(31, depth)][MIN(31, moveCount)] - ss->histScore / LMRHist; Depth lmrDepth = depth - 1 - R; // Quiet late move pruning - if (moveCount > (improving ? depth * depth : -2 + depth * depth / 2)) + if (moveCount > (improving ? LMPImp + depth * depth : LMPNonImp + depth * depth / 2)) mp.onlyNoisy = true; // History pruning - if (lmrDepth < 3 && ss->histScore < -1024 * depth) + if (lmrDepth < HistPruneDepth && ss->histScore < -HistPrune * depth) continue; // SEE pruning - if (lmrDepth < 7 && !SEE(pos, move, quiet ? -47 * depth : -72 * depth)) + if (lmrDepth < SEEPruneDepth && !SEE(pos, move, quiet ? -SEEPruneQ * depth : -SEEPruneN * depth)) continue; } @@ -425,10 +516,10 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth goto skip_extensions; // Singular extension - if ( depth > 4 + if ( depth > SingExtDepth && move == ttMove && !ss->excluded - && ttDepth > depth - 3 + && ttDepth > depth - SingExtTTDepth && ttBound != BOUND_UPPER && abs(ttScore) < TBWIN_IN_MAX / 4) { @@ -444,7 +535,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth // Singular - extend by 1 or 2 ply if (score < singularBeta) { extension = 1; - if (!pvNode && score < singularBeta - 17 && ss->doubleExtensions <= 5) + if (!pvNode && score < singularBeta - SingExtDouble && ss->doubleExtensions <= 5) extension = 2; // MultiCut - ttMove as well as at least one other move seem good enough to beat beta } else if (singularBeta >= beta) @@ -476,7 +567,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 / 9600; + r -= ss->histScore / LMRHist; // Reduce less in pv nodes r -= pvNode; // Reduce less when improving @@ -495,7 +586,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 + 49 + 16 * (newDepth - lmrDepth); + bool deeper = score > bestScore + DeeperBase + DeeperDepth * (newDepth - lmrDepth); newDepth += deeper; @@ -582,12 +673,12 @@ static void AspirationWindow(Thread *thread, Stack *ss) { int prevScore = thread->rootMoves[multiPV].score; - int delta = 9 + prevScore * prevScore / 16384; + int delta = Aspi + prevScore * prevScore / AspiScoreDiv; int alpha = MAX(prevScore - delta, -INFINITE); int beta = MIN(prevScore + delta, INFINITE); - int x = CLAMP(prevScore / 2, -32, 32); + int x = CLAMP(prevScore * TrendDiv, -Trend, Trend); 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 @@ -595,8 +686,8 @@ static void AspirationWindow(Thread *thread, Stack *ss) { thread->doPruning = Limits.infinite ? TimeSince(Limits.start) > 1000 - : TimeSince(Limits.start) >= Limits.optimalUsage / 64 - || depth > 2 + Limits.optimalUsage / 270; + : TimeSince(Limits.start) >= Limits.optimalUsage / PruneDiv + || depth > 2 + Limits.optimalUsage / PruneDepthDiv; int score = AlphaBeta(thread, ss, alpha, beta, depth, false); diff --git a/src/search.h b/src/search.h index aa39f1d8..1f441c68 100644 --- a/src/search.h +++ b/src/search.h @@ -39,3 +39,5 @@ extern atomic_bool SEARCH_STOPPED; void *SearchPosition(void *pos); + +void Reinit(); diff --git a/src/tests.c b/src/tests.c index afded9e0..4093d262 100644 --- a/src/tests.c +++ b/src/tests.c @@ -94,7 +94,7 @@ typedef struct BenchResult { } BenchResult; void Benchmark(int argc, char **argv) { - + Reinit(); // Default depth 16, 1 thread, and 32MB hash Limits.depth = argc > 2 ? atoi(argv[2]) : 16; int threadCount = argc > 3 ? atoi(argv[3]) : 1; diff --git a/src/uci.c b/src/uci.c index dfb76860..16013a85 100644 --- a/src/uci.c +++ b/src/uci.c @@ -34,6 +34,90 @@ #include "uci.h" +extern float LMRNoisyBase; +extern float LMRNoisyDiv; +extern float LMRQuietBase; +extern float LMRQuietDiv; + +extern int IIRDepth; +extern int IIRCutDepth; +extern int RFPDepth; +extern int RFPBase; +extern int RFPHistScore; +extern int RFPHistory; +extern int NMPFlat; +extern int NMPDepth; +extern int NMPHist; +extern int NMPRBase; +extern int NMPRDepth; +extern int NMPREvalDiv; +extern int NMPREvalMin; +extern int ProbCut; +extern int ProbCutDepth; +extern int ProbCutReturn; +extern int LMPImp; +extern int LMPNonImp; +extern int HistPruneDepth; +extern int HistPrune; +extern int SEEPruneDepth; +extern int SEEPruneQ; +extern int SEEPruneN; +extern int SingExtDepth; +extern int SingExtTTDepth; +extern int SingExtDouble; +extern int LMRHist; +extern int DeeperBase; +extern int DeeperDepth; + +extern int QSFutility; + +extern int Aspi; +extern int AspiScoreDiv; +extern int Trend; +extern float TrendDiv; +extern int PruneDiv; +extern int PruneDepthDiv; + +extern int HistQDiv; +extern int HistCDiv; +extern int HistNDiv; +extern int HistBonusMax; +extern int HistBonusBase; +extern int HistBonusDepth; +extern int HistMalusMax; +extern int HistMalusBase; +extern int HistMalusDepth; + +extern int Tempo; +extern int BasePower; +extern int NPower; +extern int BPower; +extern int RPower; +extern int QPower; +extern int NCPower; +extern int BCPower; +extern int RCPower; +extern int QCPower; +extern int Modifier1; +extern int Modifier2; +extern int Modifier3; +extern int Modifier4; +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; +extern int MPGoodDepth; +extern int MPBad; +extern int MPBadDepth; + // Parses the time controls static void ParseTimeControl(const char *str, const Position *pos) { @@ -117,6 +201,91 @@ static void SetOption(char *str) { else if (OptionNameIs("NoobBook" )) noobbook = BooleanValue; else if (OptionNameIs("UCI_Chess960" )) chess960 = BooleanValue; else if (OptionNameIs("OnlineSyzygy" )) onlineSyzygy = BooleanValue; + + else if (OptionNameIs("LMRNoisyBase" )) LMRNoisyBase = IntValue / 100.0; + else if (OptionNameIs("LMRNoisyDiv" )) LMRNoisyDiv = IntValue / 100.0; + else if (OptionNameIs("LMRQuietBase" )) LMRQuietBase = IntValue / 100.0; + else if (OptionNameIs("LMRQuietDiv" )) LMRQuietDiv = IntValue / 100.0; + + else if (OptionNameIs("IIRDepth" )) IIRDepth = IntValue; + else if (OptionNameIs("IIRCutDepth" )) IIRCutDepth= IntValue; + else if (OptionNameIs("RFPDepth" )) RFPDepth = IntValue; + else if (OptionNameIs("RFPBase" )) RFPBase = IntValue; + else if (OptionNameIs("RFPHistScore" )) RFPHistScore = IntValue; + else if (OptionNameIs("RFPHistory" )) RFPHistory = IntValue; + else if (OptionNameIs("NMPFlat" )) NMPFlat = IntValue; + else if (OptionNameIs("NMPDepth" )) NMPDepth = IntValue; + else if (OptionNameIs("NMPHist" )) NMPHist = IntValue; + else if (OptionNameIs("NMPRBase" )) NMPRBase = IntValue; + else if (OptionNameIs("NMPRDepth" )) NMPRDepth = IntValue; + else if (OptionNameIs("NMPREvalDiv" )) NMPREvalDiv= IntValue; + else if (OptionNameIs("NMPREvalMin" )) NMPREvalMin= IntValue; + else if (OptionNameIs("ProbCut" )) ProbCut = IntValue; + else if (OptionNameIs("ProbCutDepth" )) ProbCutDepth = IntValue; + else if (OptionNameIs("ProbCutReturn" )) ProbCutReturn = IntValue; + else if (OptionNameIs("LMPImp" )) LMPImp = IntValue; + else if (OptionNameIs("LMPNonImp" )) LMPNonImp = IntValue; + else if (OptionNameIs("HistPruneDepth")) HistPruneDepth = IntValue; + else if (OptionNameIs("HistPrune" )) HistPrune = IntValue; + else if (OptionNameIs("SEEPruneDepth")) SEEPruneDepth = IntValue; + else if (OptionNameIs("SEEPruneQ" )) SEEPruneQ = IntValue; + else if (OptionNameIs("SEEPruneN" )) SEEPruneN = IntValue; + else if (OptionNameIs("SingExtDepth" )) SingExtDepth = IntValue; + else if (OptionNameIs("SingExtTTDepth")) SingExtTTDepth = IntValue; + else if (OptionNameIs("SingExtDouble")) SingExtDouble = IntValue; + else if (OptionNameIs("LMRHist" )) LMRHist = IntValue; + else if (OptionNameIs("DeeperBase" )) DeeperBase = IntValue; + else if (OptionNameIs("DeeperDepth" )) DeeperDepth= IntValue; + + else if (OptionNameIs("QSFutility" )) QSFutility = IntValue; + + else if (OptionNameIs("Aspi" )) Aspi = IntValue; + else if (OptionNameIs("AspiScoreDiv" )) AspiScoreDiv = IntValue; + else if (OptionNameIs("Trend" )) Trend = IntValue; + else if (OptionNameIs("TrendDiv" )) TrendDiv = IntValue / 100.0; + else if (OptionNameIs("PruneDiv" )) PruneDiv = IntValue; + else if (OptionNameIs("PruneDepthDiv")) PruneDepthDiv = IntValue; + + else if (OptionNameIs("HistQDiv" )) HistQDiv = IntValue; + else if (OptionNameIs("HistCDiv" )) HistCDiv = IntValue; + else if (OptionNameIs("HistNDiv" )) HistNDiv = IntValue; + else if (OptionNameIs("HistBonusMax" )) HistBonusMax = IntValue; + else if (OptionNameIs("HistBonusBase")) HistBonusBase = IntValue; + else if (OptionNameIs("HistBonusDepth")) HistBonusDepth = IntValue; + else if (OptionNameIs("HistMalusMax" )) HistMalusMax = IntValue; + else if (OptionNameIs("HistMalusBase")) HistMalusBase = IntValue; + else if (OptionNameIs("HistMalusDepth")) HistMalusDepth = IntValue; + + else if (OptionNameIs("Tempo" )) Tempo = IntValue; + else if (OptionNameIs("BasePower" )) BasePower = IntValue; + else if (OptionNameIs("NPower" )) NPower = IntValue; + else if (OptionNameIs("BPower" )) BPower = IntValue; + else if (OptionNameIs("RPower" )) RPower = IntValue; + else if (OptionNameIs("QPower" )) QPower = IntValue; + else if (OptionNameIs("NCPower" )) NCPower = IntValue; + else if (OptionNameIs("BCPower" )) BCPower = IntValue; + else if (OptionNameIs("RCPower" )) RCPower = IntValue; + else if (OptionNameIs("QCPower" )) QCPower = IntValue; + else if (OptionNameIs("Modifier1" )) Modifier1 = IntValue; + else if (OptionNameIs("Modifier2" )) Modifier2 = IntValue; + else if (OptionNameIs("Modifier3" )) Modifier3 = IntValue; + else if (OptionNameIs("Modifier4" )) Modifier4 = IntValue; + else if (OptionNameIs("Modifier5" )) Modifier5 = IntValue; + 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; + else if (OptionNameIs("MPBadDepth" )) MPGoodDepth = IntValue; + else if (OptionNameIs("MPBad" )) MPBad = IntValue; + else if (OptionNameIs("MPBadDepth" )) MPBadDepth = IntValue; + else puts("info string No such option."); fflush(stdout); @@ -134,6 +303,91 @@ static void Info() { printf("option name NoobBook type check default false\n"); printf("option name NoobBookLimit type spin default 0 min 0 max 1000\n"); printf("option name OnlineSyzygy type check default false\n"); + + printf("option name LMRNoisyBase type spin default %d min %d max %d\n", (int)(LMRNoisyBase * 100), -100000, 100000); + printf("option name LMRNoisyDiv type spin default %d min %d max %d\n", (int)(LMRNoisyDiv * 100), -100000, 100000); + printf("option name LMRQuietBase type spin default %d min %d max %d\n", (int)(LMRQuietBase * 100), -100000, 100000); + printf("option name LMRQuietDiv type spin default %d min %d max %d\n", (int)(LMRQuietDiv * 100), -100000, 100000); + + printf("option name IIRDepth type spin default %d min %d max %d\n", IIRDepth, -100000, 100000); + printf("option name IIRCutDepth type spin default %d min %d max %d\n", IIRCutDepth, -100000, 100000); + printf("option name RFPDepth type spin default %d min %d max %d\n", RFPDepth, -100000, 100000); + printf("option name RFPBase type spin default %d min %d max %d\n", RFPBase, -100000, 100000); + printf("option name RFPHistScore type spin default %d min %d max %d\n", RFPHistScore, -100000, 100000); + printf("option name RFPHistory type spin default %d min %d max %d\n", RFPHistory, -100000, 100000); + printf("option name NMPFlat type spin default %d min %d max %d\n", NMPFlat, -100000, 100000); + printf("option name NMPDepth type spin default %d min %d max %d\n", NMPDepth, -100000, 100000); + printf("option name NMPHist type spin default %d min %d max %d\n", NMPHist, -100000, 100000); + printf("option name NMPRBase type spin default %d min %d max %d\n", NMPRBase, -100000, 100000); + printf("option name NMPRDepth type spin default %d min %d max %d\n", NMPRDepth, -100000, 100000); + printf("option name NMPREvalDiv type spin default %d min %d max %d\n", NMPREvalDiv, -100000, 100000); + printf("option name NMPREvalMin type spin default %d min %d max %d\n", NMPREvalMin, -100000, 100000); + printf("option name ProbCut type spin default %d min %d max %d\n", ProbCut, -100000, 100000); + printf("option name ProbCutDepth type spin default %d min %d max %d\n", ProbCutDepth, -100000, 100000); + printf("option name ProbCutReturn type spin default %d min %d max %d\n", ProbCutReturn, -100000, 100000); + printf("option name LMPImp type spin default %d min %d max %d\n", LMPImp, -100000, 100000); + printf("option name LMPNonImp type spin default %d min %d max %d\n", LMPNonImp, -100000, 100000); + printf("option name HistPruneDepth type spin default %d min %d max %d\n", HistPruneDepth, -100000, 100000); + printf("option name HistPrune type spin default %d min %d max %d\n", HistPrune, -100000, 100000); + printf("option name SEEPruneDepth type spin default %d min %d max %d\n", SEEPruneDepth, -100000, 100000); + printf("option name SEEPruneQ type spin default %d min %d max %d\n", SEEPruneQ, -100000, 100000); + printf("option name SEEPruneN type spin default %d min %d max %d\n", SEEPruneN, -100000, 100000); + printf("option name SingExtDepth type spin default %d min %d max %d\n", SingExtDepth, -100000, 100000); + printf("option name SingExtTTDepth type spin default %d min %d max %d\n", SingExtTTDepth, -100000, 100000); + printf("option name SingExtDouble type spin default %d min %d max %d\n", SingExtDouble, -100000, 100000); + printf("option name LMRHist type spin default %d min %d max %d\n", LMRHist, -100000, 100000); + printf("option name DeeperBase type spin default %d min %d max %d\n", DeeperBase, -100000, 100000); + printf("option name DeeperDepth type spin default %d min %d max %d\n", DeeperDepth, -100000, 100000); + + printf("option name QSFutility type spin default %d min %d max %d\n", QSFutility, -100000, 100000); + + printf("option name Aspi type spin default %d min %d max %d\n", Aspi, -100000, 100000); + printf("option name AspiScoreDiv type spin default %d min %d max %d\n", AspiScoreDiv, -100000, 100000); + printf("option name Trend type spin default %d min %d max %d\n", Trend, -100000, 100000); + printf("option name TrendDiv type spin default %d min %d max %d\n", (int)(TrendDiv * 100), -100000, 100000); + printf("option name PruneDiv type spin default %d min %d max %d\n", PruneDiv, -100000, 100000); + printf("option name PruneDepthDiv type spin default %d min %d max %d\n", PruneDepthDiv, -100000, 100000); + + printf("option name HistQDiv type spin default %d min %d max %d\n", HistQDiv, -100000, 100000); + printf("option name HistCDiv type spin default %d min %d max %d\n", HistCDiv, -100000, 100000); + printf("option name HistNDiv type spin default %d min %d max %d\n", HistNDiv, -100000, 100000); + printf("option name HistBonusMax type spin default %d min %d max %d\n", HistBonusMax, -100000, 100000); + printf("option name HistBonusBase type spin default %d min %d max %d\n", HistBonusBase, -100000, 100000); + printf("option name HistBonusDepth type spin default %d min %d max %d\n", HistBonusDepth, -100000, 100000); + printf("option name HistMalusMax type spin default %d min %d max %d\n", HistMalusMax, -100000, 100000); + printf("option name HistMalusBase type spin default %d min %d max %d\n", HistMalusBase, -100000, 100000); + printf("option name HistMalusDepth type spin default %d min %d max %d\n", HistMalusDepth, -100000, 100000); + + printf("option name Tempo type spin default %d min %d max %d\n", Tempo, -100000, 100000); + printf("option name BasePower type spin default %d min %d max %d\n", BasePower, -100000, 100000); + printf("option name NPower type spin default %d min %d max %d\n", NPower, -100000, 100000); + printf("option name BPower type spin default %d min %d max %d\n", BPower, -100000, 100000); + printf("option name RPower type spin default %d min %d max %d\n", RPower, -100000, 100000); + printf("option name QPower type spin default %d min %d max %d\n", QPower, -100000, 100000); + printf("option name NCPower type spin default %d min %d max %d\n", NCPower, -100000, 100000); + printf("option name BCPower type spin default %d min %d max %d\n", BCPower, -100000, 100000); + printf("option name RCPower type spin default %d min %d max %d\n", RCPower, -100000, 100000); + printf("option name QCPower type spin default %d min %d max %d\n", QCPower, -100000, 100000); + printf("option name Modifier1 type spin default %d min %d max %d\n", Modifier1, -100000, 100000); + printf("option name Modifier2 type spin default %d min %d max %d\n", Modifier2, -100000, 100000); + printf("option name Modifier3 type spin default %d min %d max %d\n", Modifier3, -100000, 100000); + printf("option name Modifier4 type spin default %d min %d max %d\n", Modifier4, -100000, 100000); + printf("option name Modifier5 type spin default %d min %d max %d\n", Modifier5, -100000, 100000); + 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); + printf("option name MPGoodDepth type spin default %d min %d max %d\n", MPGoodDepth, -100000, 100000); + printf("option name MPBad type spin default %d min %d max %d\n", MPBad, -100000, 100000); + printf("option name MPBadDepth type spin default %d min %d max %d\n", MPBadDepth, -100000, 100000); + printf("uciok\n"); fflush(stdout); } @@ -146,6 +400,7 @@ static void Stop() { // Signals the engine is ready static void IsReady() { + Reinit(); InitTT(); puts("readyok"); fflush(stdout);