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". --- python/nissy_module.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'python/nissy_module.c') diff --git a/python/nissy_module.c b/python/nissy_module.c index e92cfd9..46570dc 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c @@ -324,8 +324,7 @@ PyDoc_STRVAR(solve_doc, " - minmoves: the minimum number of moves to use\n" " - maxmoves: the maximum number of moves to use\n" " - maxsolution: the maximum number of solutions to return\n" -" - optimal: the largest number of moves from the shortest solution" -"(set to -1 to ignore)\n" +" - optimal: the largest number of moves from the shortest solution\n" " - threads: the number of threads to use (0 for default)\n" " - data: a bytearray containing the data for the solver\n" "\n" @@ -343,7 +342,7 @@ solve(PyObject *self, PyObject *args) PyByteArrayObject *data; PyObject *list, *item; - if (!PyArg_ParseTuple(args, "ssIIIIiiY", &cube, &solver, &nissflag, + if (!PyArg_ParseTuple(args, "ssIIIIIIY", &cube, &solver, &nissflag, &minmoves, &maxmoves, &maxsolutions, &optimal, &threads, &data)) return NULL; -- cgit v1.3