diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-14 17:24:09 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-14 17:24:09 +0100 |
| commit | ab95e3801f6659aa6b25ebd9a69b2e23dded130e (patch) | |
| tree | f042a4b5cc6390d7f8290cbb857313b0095ede0a | |
| parent | 9e6465bcc8f0d9bd1d78ad357a623452358ba7f2 (diff) | |
| download | nissy-core-ab95e3801f6659aa6b25ebd9a69b2e23dded130e.tar.gz nissy-core-ab95e3801f6659aa6b25ebd9a69b2e23dded130e.zip | |
Bugfix
| -rw-r--r-- | TODO_COORDINATES | 27 | ||||
| -rw-r--r-- | src/solvers/coord/solve.h | 18 |
2 files changed, 20 insertions, 25 deletions
diff --git a/TODO_COORDINATES b/TODO_COORDINATES index f2e4a25..d5c78aa 100644 --- a/TODO_COORDINATES +++ b/TODO_COORDINATES | |||
| @@ -1,25 +1,10 @@ | |||
| 1 | - coord solver | 1 | - filter solutions |
| 2 | - there is an error (try R B2 as scramble, EO on RL) | 2 | - allow not showing repeated solutions like R2 F and R2 F' for EO |
| 3 | - debug | 3 | - avoid B2 F as an EO |
| 4 | - fix | 4 | - in nissy.c, check for minmoves, maxmoves and nissflag (must be in range) |
| 5 | - h48 solve dispatch: move "h7k2" part to "options"? | 5 | - add a dispatcher in solvers.h? |
| 6 | - it makes sense, but breaks the rule "solver == table" | 6 | - test solver for EO (with unit test or tool) |
| 7 | - if so, adjust tools that use nissy_solve() | ||
| 8 | - add new parameter to solve(): options (char *) | ||
| 9 | - fix all usages | ||
| 10 | x tests | ||
| 11 | x shell | ||
| 12 | x tools | ||
| 13 | x python bindings | ||
| 14 | - document what to do when changing interface? | ||
| 15 | - where do I document which solvers take which parameters? | ||
| 16 | now that I am implementing more solvers I need an extra | ||
| 17 | document in doc/ | ||
| 18 | - in nissy.c, check for minmoves, maxmoves and nissflag (must be in range) | ||
| 19 | - add a dispatcher in solvers.h? | ||
| 20 | - test solver for EO | ||
| 21 | - add NISS (and add tests for NISS EO) | 7 | - add NISS (and add tests for NISS EO) |
| 22 | - allow not showing repeated solutions like R2 F and R2 F' for EO | ||
| 23 | - make solve parallelized | 8 | - make solve parallelized |
| 24 | - other coordinates | 9 | - other coordinates |
| 25 | - gendata must handle symmetry | 10 | - gendata must handle symmetry |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 75c6a4e..73ae9b1 100644 --- 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 *); | |||
| 29 | STATIC int64_t | 29 | STATIC int64_t |
| 30 | solve_coord_appendsolution(dfsarg_solve_coord_t *arg) | 30 | solve_coord_appendsolution(dfsarg_solve_coord_t *arg) |
| 31 | { | 31 | { |
| 32 | uint8_t i, t, l, tmoves[MAXLEN_COORDSOL]; | 32 | uint8_t i, t, tmoves[MAXLEN_COORDSOL]; |
| 33 | char *m; | ||
| 34 | int64_t strl; | 33 | int64_t strl; |
| 34 | uint64_t l; | ||
| 35 | char *m; | ||
| 35 | 36 | ||
| 36 | if (*arg->nsols >= arg->maxsolutions || | 37 | if (*arg->nsols >= arg->maxsolutions || |
| 37 | arg->nmoves > *arg->shortest_sol + arg->optimal) | 38 | arg->nmoves > *arg->shortest_sol + arg->optimal) |
| @@ -114,6 +115,7 @@ solve_coord_dfs(dfsarg_solve_coord_t *arg) | |||
| 114 | return n; | 115 | return n; |
| 115 | ret += n; | 116 | ret += n; |
| 116 | } | 117 | } |
| 118 | arg->cube = backup_cube; | ||
| 117 | arg->nmoves--; | 119 | arg->nmoves--; |
| 118 | 120 | ||
| 119 | return 0; | 121 | return 0; |
| @@ -174,7 +176,7 @@ solve_coord( | |||
| 174 | { | 176 | { |
| 175 | int8_t d; | 177 | int8_t d; |
| 176 | uint8_t t, shortest_sol; | 178 | uint8_t t, shortest_sol; |
| 177 | int64_t nsols; | 179 | int64_t nsols, ndepth; |
| 178 | uint64_t sols_used; | 180 | uint64_t sols_used; |
| 179 | cube_t c; | 181 | cube_t c; |
| 180 | const void *coord_data; | 182 | const void *coord_data; |
| @@ -238,7 +240,15 @@ solve_coord( | |||
| 238 | 240 | ||
| 239 | arg.depth = d; | 241 | arg.depth = d; |
| 240 | arg.nmoves = 0; | 242 | arg.nmoves = 0; |
| 241 | nsols += solve_coord_dfs(&arg); | 243 | ndepth = solve_coord_dfs(&arg); |
| 244 | |||
| 245 | /* TODO: improve error handling? */ | ||
| 246 | if (ndepth < 0) { | ||
| 247 | LOG("Error %" PRId64 "\n", ndepth); | ||
| 248 | return ndepth; | ||
| 249 | } | ||
| 250 | |||
| 251 | nsols += ndepth; | ||
| 242 | } | 252 | } |
| 243 | 253 | ||
| 244 | solve_coord_done: | 254 | solve_coord_done: |
