From 0ece4b72db22139db51e8f5f37c25f24c84f3e43 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 17 Apr 2025 10:50:57 +0200 Subject: Small rework of optimal vs maxsols I wanted to make the "optimal" and "maxsolutions" options mutually exclusive, but in the end I decided there is value in keeping both (e.g. for specifying a limit to the number of solutions when asking for "all" optimal"). Now optimal cannot be negative anymore, for the same reason of maxsolutions. The interface user (shell, UI) will have to take care of handling this in a way that makes sense for the user. Usually this means setting the maximum number of solutions to UINT_MAX (or a similar very high number) when the user wants "all optimal". --- src/nissy.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/nissy.c') diff --git a/src/nissy.c b/src/nissy.c index a7f8432..ba43e5d 100644 --- a/src/nissy.c +++ b/src/nissy.c @@ -534,8 +534,8 @@ nissy_solve( unsigned minmoves, unsigned maxmoves, unsigned maxsols, - int optimal, - int threads, + unsigned optimal, + unsigned threads, unsigned long long data_size, const char data[data_size], unsigned sols_size, @@ -546,7 +546,7 @@ nissy_solve( cube_t c; long long parse_ret; uint8_t h, k; - int t, opt; + int t; if (solver == NULL) { LOG("Error: 'solver' argument is NULL\n"); @@ -573,8 +573,6 @@ nissy_solve( return 0; } - opt = optimal < 0 ? MAXLEN : optimal; - t = threads == 0 ? THREADS : threads; if (t < 0) { LOG("solve: 'threads' is negative. Please provide a " @@ -597,10 +595,10 @@ nissy_solve( if (parse_ret != NISSY_OK) return parse_ret; return solve_h48(c, minmoves, maxmoves, maxsols, - opt, t, data_size, data, sols_size, sols, stats); + optimal, t, data_size, data, sols_size, sols, stats); } else if (!strncmp(solver, "coord_", 6)) { return solve_coord_dispatch(c, solver + 6, nissflag, - minmoves, maxmoves, maxsols, opt, t, data_size, data, + minmoves, maxmoves, maxsols, optimal, t, data_size, data, sols_size, sols); } else { LOG("solve: unknown solver '%s'\n", solver); -- cgit v1.3