aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/solvers/h48/solve.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h
index 92de8a9..fcd2762 100644
--- a/src/solvers/h48/solve.h
+++ b/src/solvers/h48/solve.h
@@ -288,18 +288,16 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1])
288 int64_t ret, n; 288 int64_t ret, n;
289 uint8_t m, nm, nn, ni, target; 289 uint8_t m, nm, nn, ni, target;
290 uint64_t mm_normal, mm_inverse; 290 uint64_t mm_normal, mm_inverse;
291 bool normal;
292 cube_t cube, backup_cube, backup_inverse; 291 cube_t cube, backup_cube, backup_inverse;
293 h48_prune_t prune[NMOVES]; 292 h48_prune_t prune[NMOVES];
294 293
295 nn = arg->solution_moves->nmoves;
296 ni = arg->solution_moves->npremoves;
297 nm = nn + ni;
298
299 if (equal(arg->cube, SOLVED_CUBE) || /* Solved before target depth */ 294 if (equal(arg->cube, SOLVED_CUBE) || /* Solved before target depth */
300 arg->solution_list->nsols >= arg->solution_settings->maxsolutions) 295 arg->solution_list->nsols >= arg->solution_settings->maxsolutions)
301 return 0; 296 return 0;
302 297
298 nn = arg->solution_moves->nmoves;
299 ni = arg->solution_moves->npremoves;
300 nm = nn + ni;
303 target = arg->target_depth - (nm + 1); 301 target = arg->target_depth - (nm + 1);
304 mm_normal = arg->movemask_normal; 302 mm_normal = arg->movemask_normal;
305 mm_inverse = arg->movemask_inverse; 303 mm_inverse = arg->movemask_inverse;
@@ -310,6 +308,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1])
310 continue; 308 continue;
311 cube = move(arg->cube, m); 309 cube = move(arg->cube, m);
312 arg->solution_moves->moves[nn] = m; 310 arg->solution_moves->moves[nn] = m;
311 arg->nodes_visited++;
313 if (!equal(cube, SOLVED_CUBE)) 312 if (!equal(cube, SOLVED_CUBE))
314 continue; 313 continue;
315 wrapthread_mutex_lock(arg->solutions_mutex); 314 wrapthread_mutex_lock(arg->solutions_mutex);
@@ -326,12 +325,10 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1])
326 325
327 backup_cube = arg->cube; 326 backup_cube = arg->cube;
328 backup_inverse = arg->inverse; 327 backup_inverse = arg->inverse;
329 normal = popcount_u32(mm_normal) <= popcount_u32(mm_inverse);
330
331 h48_prune_pipeline(arg, prune, target, normal);
332 328
333 ret = 0; 329 ret = 0;
334 if (normal) { 330 if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) {
331 h48_prune_pipeline(arg, prune, target, true);
335 arg->solution_moves->nmoves++; 332 arg->solution_moves->nmoves++;
336 for (m = 0; m < NMOVES; m++) { 333 for (m = 0; m < NMOVES; m++) {
337 if (prune[m].stop) 334 if (prune[m].stop)
@@ -346,6 +343,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1])
346 } 343 }
347 arg->solution_moves->nmoves--; 344 arg->solution_moves->nmoves--;
348 } else { 345 } else {
346 h48_prune_pipeline(arg, prune, target, false);
349 arg->solution_moves->npremoves++; 347 arg->solution_moves->npremoves++;
350 for (m = 0; m < NMOVES; m++) { 348 for (m = 0; m < NMOVES; m++) {
351 if (prune[m].stop) 349 if (prune[m].stop)

Generated with cgit - Back to sebastiano.tronto.net