diff options
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/coord/solve.h | 18 |
1 files changed, 14 insertions, 4 deletions
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: |
