aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands.c27
-rw-r--r--src/steps.h2
2 files changed, 20 insertions, 9 deletions
diff --git a/src/commands.c b/src/commands.c
index c65cc5f..e876082 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -450,6 +450,15 @@ scramble_exec(CommandArgs *args)
450 int i, j, eo, ep, co, cp, a[12]; 450 int i, j, eo, ep, co, cp, a[12];
451 int eparr[12] = { [8] = 8, [9] = 9, [10] = 10, [11] = 11 }; 451 int eparr[12] = { [8] = 8, [9] = 9, [10] = 10, [11] = 11 };
452 uint64_t ui, uj, uk; 452 uint64_t ui, uj, uk;
453 AlgList *scrlist;
454 SolveOptions dropts = {
455 .min_moves = 0,
456 .max_moves = 19,
457 .max_solutions = 1,
458 .nthreads = 1,
459 .nisstype = NORMAL,
460 .verbose = false
461 };
453 462
454 init_all_movesets(); 463 init_all_movesets();
455 init_symcoord(); 464 init_symcoord();
@@ -459,12 +468,8 @@ scramble_exec(CommandArgs *args)
459 for (i = 0; i < args->n; i++) { 468 for (i = 0; i < args->n; i++) {
460 469
461 if (!strcmp(args->scrtype, "dr")) { 470 if (!strcmp(args->scrtype, "dr")) {
462 /* Warning: cube is inconsistent because of side CO * 471 /* Warning: cube is inconsistent because of side CO *
463 * and EO on U/D. But solve_2phase only solves drfin * 472 * and EO on U/D, but we only solve drudfin on it. */
464 * in this case, so it should be ok. *
465 * TODO: check this properly *
466 * Moreover we again need to fix parity after *
467 * generating epose manually */
468 do { 473 do {
469 ui = rand() % FACTORIAL8; 474 ui = rand() % FACTORIAL8;
470 uj = rand() % FACTORIAL8; 475 uj = rand() % FACTORIAL8;
@@ -479,6 +484,9 @@ scramble_exec(CommandArgs *args)
479 cube.cp = uj; 484 cube.cp = uj;
480 cube.epose = uk; 485 cube.epose = uk;
481 } while (!is_admissible(cube)); 486 } while (!is_admissible(cube));
487
488 scrlist = solve(cube, &drudfin_drud, &dropts);
489 scr = scrlist->first->alg;
482 } else if (!strcmp(args->scrtype, "htr")) { 490 } else if (!strcmp(args->scrtype, "htr")) {
483 /* antindex_htrfin() returns a consistent * 491 /* antindex_htrfin() returns a consistent *
484 * cube, except possibly for parity */ 492 * cube, except possibly for parity */
@@ -490,6 +498,9 @@ scramble_exec(CommandArgs *args)
490 cube.eposs = rand() % 24; 498 cube.eposs = rand() % 24;
491 cube.eposm = rand() % 24; 499 cube.eposm = rand() % 24;
492 } while (!is_admissible(cube)); 500 } while (!is_admissible(cube));
501
502 scrlist = solve(cube, &drudfin_drud, &dropts);
503 scr = scrlist->first->alg;
493 } else { 504 } else {
494 eo = rand() % POW2TO11; 505 eo = rand() % POW2TO11;
495 ep = rand() % FACTORIAL12; 506 ep = rand() % FACTORIAL12;
@@ -516,11 +527,9 @@ scramble_exec(CommandArgs *args)
516 } 527 }
517 } 528 }
518 cube = fourval_to_cube(eo, ep, co, cp); 529 cube = fourval_to_cube(eo, ep, co, cp);
530 scr = solve_2phase(cube, 1);
519 } 531 }
520 532
521 /* TODO: can be optimized for htr and dr using htrfin, drfin */
522 scr = solve_2phase(cube, 1);
523
524 if (!strcmp(args->scrtype, "fmc")) { 533 if (!strcmp(args->scrtype, "fmc")) {
525 aux = new_alg(""); 534 aux = new_alg("");
526 copy_alg(scr, aux); 535 copy_alg(scr, aux);
diff --git a/src/steps.h b/src/steps.h
index da5c041..682be88 100644
--- a/src/steps.h
+++ b/src/steps.h
@@ -8,6 +8,8 @@ extern Step * steps[];
8/* Two steps used directly by two-phase solver */ 8/* Two steps used directly by two-phase solver */
9extern Step drany_HTM; 9extern Step drany_HTM;
10extern Step dranyfin_DR; 10extern Step dranyfin_DR;
11/* Step used directly by the scramble command */
12extern Step drudfin_drud;
11 13
12void copy_estimatedata(EstimateData *s, EstimateData *d); 14void copy_estimatedata(EstimateData *s, EstimateData *d);
13void invert_estimatedata(EstimateData *ed); 15void invert_estimatedata(EstimateData *ed);

Generated with cgit - Back to sebastiano.tronto.net