aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/multisolve.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-11-23 16:16:31 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-11-24 16:32:11 +0100
commit147b0c3c4615c32478a4923242909b8ae5a30d03 (patch)
tree5294d9b3655031535085a5163c2c5b5cbe7413b1 /src/solvers/coord/multisolve.h
parent78ec0d22d927bc4287aa090469d5ba5f84e8780b (diff)
downloadnissy-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/multisolve.h')
-rw-r--r--src/solvers/coord/multisolve.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/solvers/coord/multisolve.h b/src/solvers/coord/multisolve.h
index f3589e8..a45bd6a 100644
--- a/src/solvers/coord/multisolve.h
+++ b/src/solvers/coord/multisolve.h
@@ -9,6 +9,7 @@ typedef struct {
9 uint8_t target_depth; 9 uint8_t target_depth;
10 solution_moves_t *solution_moves; 10 solution_moves_t *solution_moves;
11 solution_settings_t *solution_settings; 11 solution_settings_t *solution_settings;
12 uint64_t tmask;
12 solution_list_t *solution_list; 13 solution_list_t *solution_list;
13 multicoord_t *mcoord; 14 multicoord_t *mcoord;
14 const unsigned char *coord_data[MAX_MULTICOORD_NCOORDS]; 15 const unsigned char *coord_data[MAX_MULTICOORD_NCOORDS];
@@ -87,7 +88,7 @@ solve_multicoord_dfs(dfsarg_solve_multicoord_t arg[static 1])
87 /* All coordinates are solved */ 88 /* All coordinates are solved */
88 if (!multicoord_solution_admissible(arg)) 89 if (!multicoord_solution_admissible(arg))
89 return 0; 90 return 0;
90 return appendsolution(arg->solution_moves, 91 return appendsolution(arg->solution_moves, 1, &arg->tmask,
91 arg->solution_settings, arg->solution_list); 92 arg->solution_settings, arg->solution_list);
92 93
93solve_multicoord_dfs_notsolved: 94solve_multicoord_dfs_notsolved:
@@ -208,7 +209,6 @@ solve_multicoord(
208 solution_moves_reset(&solution_moves); 209 solution_moves_reset(&solution_moves);
209 210
210 solution_settings = (solution_settings_t) { 211 solution_settings = (solution_settings_t) {
211 .tmask = TM_SINGLE(inverse_trans(trans)),
212 .unniss = false, 212 .unniss = false,
213 .maxmoves = maxmoves, 213 .maxmoves = maxmoves,
214 .maxsolutions = maxsolutions, 214 .maxsolutions = maxsolutions,
@@ -222,6 +222,7 @@ solve_multicoord(
222 .mcoord = mcoord, 222 .mcoord = mcoord,
223 .solution_moves = &solution_moves, 223 .solution_moves = &solution_moves,
224 .solution_settings = &solution_settings, 224 .solution_settings = &solution_settings,
225 .tmask = TM_SINGLE(inverse_trans(trans)),
225 .solution_list = &solution_list, 226 .solution_list = &solution_list,
226 }; 227 };
227 228
@@ -258,8 +259,8 @@ solve_multicoord(
258 } 259 }
259 260
260 /* All coordinates are solved */ 261 /* All coordinates are solved */
261 if (minmoves == 0 && !appendsolution(&solution_moves, 262 if (minmoves == 0 && !appendsolution(&solution_moves, 1,
262 &solution_settings, &solution_list)) 263 &arg.tmask, &solution_settings, &solution_list))
263 goto solve_multicoord_error_buffer; 264 goto solve_multicoord_error_buffer;
264 goto solve_multicoord_done; 265 goto solve_multicoord_done;
265 266

Generated with cgit - Back to sebastiano.tronto.net