commit ab95e3801f6659aa6b25ebd9a69b2e23dded130e
parent 9e6465bcc8f0d9bd1d78ad357a623452358ba7f2
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Fri, 14 Mar 2025 17:24:09 +0100
Bugfix
Diffstat:
2 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/TODO_COORDINATES b/TODO_COORDINATES
@@ -1,25 +1,10 @@
-- 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"
- - if so, adjust tools that use nissy_solve()
- - add new parameter to solve(): options (char *)
- - fix all usages
- x tests
- x shell
- x tools
- 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
- document in doc/
- - in nissy.c, check for minmoves, maxmoves and nissflag (must be in range)
- - add a dispatcher in solvers.h?
-- test solver for EO
+- filter solutions
+ - allow not showing repeated solutions like R2 F and R2 F' for EO
+ - avoid B2 F as an EO
+- in nissy.c, check for minmoves, maxmoves and nissflag (must be in range)
+- add a dispatcher in solvers.h?
+- test solver for EO (with unit test or tool)
- 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/src/solvers/coord/solve.h b/src/solvers/coord/solve.h
@@ -29,9 +29,10 @@ STATIC int64_t solve_coord_dfs(dfsarg_solve_coord_t *);
STATIC int64_t
solve_coord_appendsolution(dfsarg_solve_coord_t *arg)
{
- uint8_t i, t, l, tmoves[MAXLEN_COORDSOL];
- char *m;
+ uint8_t i, t, tmoves[MAXLEN_COORDSOL];
int64_t strl;
+ uint64_t l;
+ char *m;
if (*arg->nsols >= arg->maxsolutions ||
arg->nmoves > *arg->shortest_sol + arg->optimal)
@@ -114,6 +115,7 @@ solve_coord_dfs(dfsarg_solve_coord_t *arg)
return n;
ret += n;
}
+ arg->cube = backup_cube;
arg->nmoves--;
return 0;
@@ -174,7 +176,7 @@ solve_coord(
{
int8_t d;
uint8_t t, shortest_sol;
- int64_t nsols;
+ int64_t nsols, ndepth;
uint64_t sols_used;
cube_t c;
const void *coord_data;
@@ -238,7 +240,15 @@ solve_coord(
arg.depth = d;
arg.nmoves = 0;
- nsols += solve_coord_dfs(&arg);
+ ndepth = solve_coord_dfs(&arg);
+
+ /* TODO: improve error handling? */
+ if (ndepth < 0) {
+ LOG("Error %" PRId64 "\n", ndepth);
+ return ndepth;
+ }
+
+ nsols += ndepth;
}
solve_coord_done: