diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-02-19 16:20:28 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-02-19 16:20:28 +0100 |
| commit | 82c20366986a3ba9cc7ff1e873c907ec3409b449 (patch) | |
| tree | 9b9c4cc94ba1cad48cbdd70fa07b93bd3c2cedcb /src/commands.c | |
| parent | 7c7b2cc15ae16128e40f09485ea7beb387412661 (diff) | |
| download | nissy-classic-82c20366986a3ba9cc7ff1e873c907ec3409b449.tar.gz nissy-classic-82c20366986a3ba9cc7ff1e873c907ec3409b449.zip | |
Fixed bug in DR scramble generation
Diffstat (limited to '')
| -rw-r--r-- | src/commands.c | 27 |
1 files changed, 18 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); |
