From ba75d1632115180d05ba9ce5e35380251d251e7d Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 9 Mar 2025 18:07:31 +0100 Subject: Fixed python module --- TODO_COORDINATES | 10 ++++++++-- python/nissy_module.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/TODO_COORDINATES b/TODO_COORDINATES index 6634623..1c50db3 100644 --- a/TODO_COORDINATES +++ b/TODO_COORDINATES @@ -1,10 +1,15 @@ - coord solver + - there is an error (try R B2 as scramble, EO on RL) + - debug + - fix + - h48 solve dispatch: move "h7k2" part to "options"? + - it makes sense, but breaks the rule "solver == table" - add new parameter to solve(): options (char *) - fix all usages x tests x shell - - tools - - python bindings + - tools (after deciding if refactoring h48 solve dispatch) + x python bindings - document what to do when changing interface? - where do I document which solvers take which parameters? now that I am implementing more solvers I need an extra @@ -13,6 +18,7 @@ - add a dispatcher in solvers.h? - test solver for EO - add NISS (and add tests for NISS EO) +- allow not showing repeated solutions like R2 F and R2 F' for EO - make solve parallelized - other coordinates - gendata must handle symmetry diff --git a/python/nissy_module.c b/python/nissy_module.c index 947d06f..6511382 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c @@ -315,6 +315,7 @@ PyDoc_STRVAR(solve_doc, "Parameters:\n" " - cube: a cube in B32 format\n" " - solver: the solver to use\n" +" - options: extra options for the chosen solver\n" " - 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" @@ -331,20 +332,21 @@ solve(PyObject *self, PyObject *args) long long result; unsigned nissflag, minmoves, maxmoves, maxsolutions; int optimal, i, j, k, threads; - const char *cube, *solver; + const char *cube, *solver, *options; char solutions[MAX_SOLUTIONS_SIZE]; long long stats[NISSY_SIZE_SOLVE_STATS]; PyByteArrayObject *data; PyObject *list, *item; - if (!PyArg_ParseTuple(args, "ssIIIIiiY", &cube, &solver, &nissflag, - &minmoves, &maxmoves, &maxsolutions, &optimal, &threads, &data)) + if (!PyArg_ParseTuple(args, "sssIIIIiiY", &cube, &solver, &options, + &nissflag, &minmoves, &maxmoves, &maxsolutions, &optimal, + &threads, &data)) return NULL; Py_BEGIN_ALLOW_THREADS - result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, - maxsolutions, optimal, threads, data->ob_alloc, data->ob_bytes, - MAX_SOLUTIONS_SIZE, solutions, stats); + result = nissy_solve(cube, solver, options, nissflag, minmoves, + maxmoves, maxsolutions, optimal, threads, data->ob_alloc, + data->ob_bytes, MAX_SOLUTIONS_SIZE, solutions, stats); Py_END_ALLOW_THREADS if(!check_error(result)) { -- cgit v1.3