diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-11-23 16:16:31 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-11-24 16:32:11 +0100 |
| commit | 147b0c3c4615c32478a4923242909b8ae5a30d03 (patch) | |
| tree | 5294d9b3655031535085a5163c2c5b5cbe7413b1 /src/solvers/coord/solve.h | |
| parent | 78ec0d22d927bc4287aa090469d5ba5f84e8780b (diff) | |
| download | nissy-core-147b0c3c4615c32478a4923242909b8ae5a30d03.tar.gz nissy-core-147b0c3c4615c32478a4923242909b8ae5a30d03.zip | |
Fix duplicate solutions, overflow in maxsols and improve symmetry reduction for H48.
This commit fixes two bugs:
- A bug that caused duplicates solutions for symmetric scrambles.
- An overflow in the maxsols parameter for the H48 solver, which
caused it to find much fewer solutions than existed.
Moreover, the H48 solvers has been improved by reducing by symmetry not
only from the starting position, but also up to the first 4 moves.
Diffstat (limited to 'src/solvers/coord/solve.h')
| -rw-r--r-- | src/solvers/coord/solve.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 54309b1..9ea6d1a 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -3,6 +3,7 @@ typedef struct { | |||
| 3 | cube_t inverse; | 3 | cube_t inverse; |
| 4 | uint8_t target_depth; | 4 | uint8_t target_depth; |
| 5 | solution_moves_t *solution_moves; | 5 | solution_moves_t *solution_moves; |
| 6 | uint64_t tmask; | ||
| 6 | solution_settings_t *solution_settings; | 7 | solution_settings_t *solution_settings; |
| 7 | solution_list_t *solution_list; | 8 | solution_list_t *solution_list; |
| 8 | uint8_t nissflag; | 9 | uint8_t nissflag; |
| @@ -163,7 +164,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 163 | if (coord_is_solved(arg->coord, coord, arg->coord_data)) { | 164 | if (coord_is_solved(arg->coord, coord, arg->coord_data)) { |
| 164 | if (!coord_solution_admissible(arg)) | 165 | if (!coord_solution_admissible(arg)) |
| 165 | return 0; | 166 | return 0; |
| 166 | return appendsolution(arg->solution_moves, | 167 | return appendsolution(arg->solution_moves, 1, &arg->tmask, |
| 167 | arg->solution_settings, arg->solution_list); | 168 | arg->solution_settings, arg->solution_list); |
| 168 | } | 169 | } |
| 169 | 170 | ||
| @@ -339,7 +340,6 @@ solve_coord( | |||
| 339 | solution_moves_reset(&solution_moves); | 340 | solution_moves_reset(&solution_moves); |
| 340 | 341 | ||
| 341 | solution_settings = (solution_settings_t) { | 342 | solution_settings = (solution_settings_t) { |
| 342 | .tmask = TM_SINGLE(inverse_trans(trans)), | ||
| 343 | .unniss = false, | 343 | .unniss = false, |
| 344 | .maxmoves = maxmoves, | 344 | .maxmoves = maxmoves, |
| 345 | .maxsolutions = maxsolutions, | 345 | .maxsolutions = maxsolutions, |
| @@ -355,14 +355,15 @@ solve_coord( | |||
| 355 | .ptable = ptable, | 355 | .ptable = ptable, |
| 356 | .solution_moves = &solution_moves, | 356 | .solution_moves = &solution_moves, |
| 357 | .solution_settings = &solution_settings, | 357 | .solution_settings = &solution_settings, |
| 358 | .tmask = TM_SINGLE(inverse_trans(trans)), | ||
| 358 | .solution_list = &solution_list, | 359 | .solution_list = &solution_list, |
| 359 | .nissflag = nissflag, | 360 | .nissflag = nissflag, |
| 360 | }; | 361 | }; |
| 361 | 362 | ||
| 362 | i = coord->coord(c, coord_data); | 363 | i = coord->coord(c, coord_data); |
| 363 | if (coord_is_solved(coord, i, coord_data)) { | 364 | if (coord_is_solved(coord, i, coord_data)) { |
| 364 | if (minmoves == 0 && !appendsolution(&solution_moves, | 365 | if (minmoves == 0 && !appendsolution(&solution_moves, 1, |
| 365 | &solution_settings, &solution_list)) | 366 | &arg.tmask, &solution_settings, &solution_list)) |
| 366 | goto solve_coord_error_buffer; | 367 | goto solve_coord_error_buffer; |
| 367 | goto solve_coord_done; | 368 | goto solve_coord_done; |
| 368 | } | 369 | } |
