Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Minimal" option where only info from the final search depth is printed #760

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
SearchLimits Limits = { .multiPV = 1 };
atomic_bool ABORT_SIGNAL;
atomic_bool SEARCH_STOPPED = true;
atomic_bool Minimal = false;

static int Reductions[2][32][32];

Expand Down Expand Up @@ -687,6 +688,7 @@ static void AspirationWindow(Thread *thread, Stack *ss) {
// Give an update when failing high/low in longer searches
if ( mainThread
&& Limits.multiPV == 1
&& !Minimal
&& (score <= alpha || score >= beta)
&& TimeSince(Limits.start) > 3000)
PrintThinking(thread, alpha, beta);
Expand Down Expand Up @@ -739,8 +741,9 @@ static void *IterativeDeepening(void *voidThread) {
// Only the main thread concerns itself with the rest
if (!mainThread) continue;

// Print thinking info
PrintThinking(thread, -INFINITE, INFINITE);
// Print search info
if (!Minimal)
PrintThinking(thread, -INFINITE, INFINITE);

// Stop searching after finding a short enough mate
if (MATE - abs(thread->rootMoves[0].score) <= 2 * abs(Limits.mate)) break;
Expand All @@ -763,6 +766,14 @@ static void *IterativeDeepening(void *voidThread) {
history(i).key = 0;
}

// Print final search info in minimal mode
if (mainThread && Minimal) {
// Fix the depth when the search is stopped due to reaching the depth limit
if (thread->depth > Limits.depth)
thread->depth--;
PrintThinking(thread, -INFINITE, INFINITE);
}

return NULL;
}

Expand Down
1 change: 1 addition & 0 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef struct {
extern SearchLimits Limits;
extern atomic_bool ABORT_SIGNAL;
extern atomic_bool SEARCH_STOPPED;
extern atomic_bool Minimal;


void *SearchPosition(void *pos);
2 changes: 2 additions & 0 deletions src/uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ static void SetOption(char *str) {
else if (OptionNameIs("Threads" )) InitThreads(IntValue);
else if (OptionNameIs("SyzygyPath" )) tb_init(optionValue);
else if (OptionNameIs("MultiPV" )) Limits.multiPV = IntValue;
else if (OptionNameIs("Minimal" )) Minimal = BooleanValue;
else if (OptionNameIs("NoobBookLimit")) NoobLimit = IntValue;
else if (OptionNameIs("NoobBookMode" )) NoobBookSetMode(optionValue);
else if (OptionNameIs("NoobBook" )) NoobBook = BooleanValue;
Expand All @@ -133,6 +134,7 @@ static void Info() {
printf("option name Threads type spin default %d min %d max %d\n", 1, 1, 2048);
printf("option name SyzygyPath type string default <empty>\n");
printf("option name MultiPV type spin default 1 min 1 max %d\n", MULTI_PV_MAX);
printf("option name Minimal type check default false\n");
printf("option name UCI_Chess960 type check default false\n");
printf("option name NoobBook type check default false\n");
printf("option name NoobBookMode type string default <best>\n");
Expand Down
Loading