aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/solve.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/solve.c b/src/solve.c
index a2ca2ad..931dc02 100644
--- a/src/solve.c
+++ b/src/solve.c
@@ -139,14 +139,25 @@ dfs_check_solved(DfsArg *arg)
139 if (arg->current_alg->len == arg->d) { 139 if (arg->current_alg->len == arg->d) {
140 if ((arg->step->is_valid(arg->current_alg) || arg->opts->all) 140 if ((arg->step->is_valid(arg->current_alg) || arg->opts->all)
141 && (!arg->step->final || !cancel_niss(arg))) { 141 && (!arg->step->final || !cancel_niss(arg))) {
142
142 pthread_mutex_lock(arg->sols_mutex); 143 pthread_mutex_lock(arg->sols_mutex);
143 if (arg->sols->len < arg->opts->max_solutions) 144
145 if (arg->sols->len < arg->opts->max_solutions) {
144 append_alg(arg->sols, arg->current_alg); 146 append_alg(arg->sols, arg->current_alg);
147
148 transform_alg(
149 inverse_trans(arg->step->pre_trans),
150 arg->sols->last->alg
151 );
152 if (arg->step->final)
153 unniss(arg->sols->last->alg);
154
155 if (arg->opts->verbose)
156 print_alg(arg->sols->last->alg, false);
157 }
158
145 pthread_mutex_unlock(arg->sols_mutex); 159 pthread_mutex_unlock(arg->sols_mutex);
146 } 160 }
147
148 if (arg->opts->verbose)
149 print_alg(arg->current_alg, false);
150 } 161 }
151 162
152 return true; 163 return true;
@@ -364,7 +375,6 @@ solve(Cube cube, Step *step, SolveOptions *opts)
364{ 375{
365 int d; 376 int d;
366 AlgList *sols; 377 AlgList *sols;
367 AlgListNode *node;
368 Cube c; 378 Cube c;
369 379
370 prepare_step(step, opts); 380 prepare_step(step, opts);
@@ -398,11 +408,5 @@ solve(Cube cube, Step *step, SolveOptions *opts)
398 multidfs(c, step, opts, sols, d); 408 multidfs(c, step, opts, sols, d);
399 } 409 }
400 410
401 for (node = sols->first; node != NULL; node = node->next) {
402 transform_alg(inverse_trans(step->pre_trans), node->alg);
403 if (step->final)
404 unniss(node->alg);
405 }
406
407 return sols; 411 return sols;
408} 412}

Generated with cgit - Back to sebastiano.tronto.net