aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-03-09 18:07:31 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-03-09 18:07:31 +0100
commitba75d1632115180d05ba9ce5e35380251d251e7d (patch)
tree5382621c745ab5309ebc69fd82a17f544e5d0ca3
parent11e6aeeaf5f08839c6effb8f68710081acf491bf (diff)
downloadnissy-core-ba75d1632115180d05ba9ce5e35380251d251e7d.tar.gz
nissy-core-ba75d1632115180d05ba9ce5e35380251d251e7d.zip
Fixed python module
-rw-r--r--TODO_COORDINATES10
-rw-r--r--python/nissy_module.c14
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 @@
1- coord solver 1- coord solver
2 - there is an error (try R B2 as scramble, EO on RL)
3 - debug
4 - fix
5 - h48 solve dispatch: move "h7k2" part to "options"?
6 - it makes sense, but breaks the rule "solver == table"
2 - add new parameter to solve(): options (char *) 7 - add new parameter to solve(): options (char *)
3 - fix all usages 8 - fix all usages
4 x tests 9 x tests
5 x shell 10 x shell
6 - tools 11 - tools (after deciding if refactoring h48 solve dispatch)
7 - python bindings 12 x python bindings
8 - document what to do when changing interface? 13 - document what to do when changing interface?
9 - where do I document which solvers take which parameters? 14 - where do I document which solvers take which parameters?
10 now that I am implementing more solvers I need an extra 15 now that I am implementing more solvers I need an extra
@@ -13,6 +18,7 @@
13 - add a dispatcher in solvers.h? 18 - add a dispatcher in solvers.h?
14- test solver for EO 19- test solver for EO
15- add NISS (and add tests for NISS EO) 20- add NISS (and add tests for NISS EO)
21- allow not showing repeated solutions like R2 F and R2 F' for EO
16- make solve parallelized 22- make solve parallelized
17- other coordinates 23- other coordinates
18 - gendata must handle symmetry 24 - 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,
315"Parameters:\n" 315"Parameters:\n"
316" - cube: a cube in B32 format\n" 316" - cube: a cube in B32 format\n"
317" - solver: the solver to use\n" 317" - solver: the solver to use\n"
318" - options: extra options for the chosen solver\n"
318" - minmoves: the minimum number of moves to use\n" 319" - minmoves: the minimum number of moves to use\n"
319" - maxmoves: the maximum number of moves to use\n" 320" - maxmoves: the maximum number of moves to use\n"
320" - maxsolution: the maximum number of solutions to return\n" 321" - maxsolution: the maximum number of solutions to return\n"
@@ -331,20 +332,21 @@ solve(PyObject *self, PyObject *args)
331 long long result; 332 long long result;
332 unsigned nissflag, minmoves, maxmoves, maxsolutions; 333 unsigned nissflag, minmoves, maxmoves, maxsolutions;
333 int optimal, i, j, k, threads; 334 int optimal, i, j, k, threads;
334 const char *cube, *solver; 335 const char *cube, *solver, *options;
335 char solutions[MAX_SOLUTIONS_SIZE]; 336 char solutions[MAX_SOLUTIONS_SIZE];
336 long long stats[NISSY_SIZE_SOLVE_STATS]; 337 long long stats[NISSY_SIZE_SOLVE_STATS];
337 PyByteArrayObject *data; 338 PyByteArrayObject *data;
338 PyObject *list, *item; 339 PyObject *list, *item;
339 340
340 if (!PyArg_ParseTuple(args, "ssIIIIiiY", &cube, &solver, &nissflag, 341 if (!PyArg_ParseTuple(args, "sssIIIIiiY", &cube, &solver, &options,
341 &minmoves, &maxmoves, &maxsolutions, &optimal, &threads, &data)) 342 &nissflag, &minmoves, &maxmoves, &maxsolutions, &optimal,
343 &threads, &data))
342 return NULL; 344 return NULL;
343 345
344 Py_BEGIN_ALLOW_THREADS 346 Py_BEGIN_ALLOW_THREADS
345 result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, 347 result = nissy_solve(cube, solver, options, nissflag, minmoves,
346 maxsolutions, optimal, threads, data->ob_alloc, data->ob_bytes, 348 maxmoves, maxsolutions, optimal, threads, data->ob_alloc,
347 MAX_SOLUTIONS_SIZE, solutions, stats); 349 data->ob_bytes, MAX_SOLUTIONS_SIZE, solutions, stats);
348 Py_END_ALLOW_THREADS 350 Py_END_ALLOW_THREADS
349 351
350 if(!check_error(result)) { 352 if(!check_error(result)) {

Generated with cgit - Back to sebastiano.tronto.net