diff options
Diffstat (limited to 'old/2021-06-17-cachedata/main.c')
| -rw-r--r-- | old/2021-06-17-cachedata/main.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/old/2021-06-17-cachedata/main.c b/old/2021-06-17-cachedata/main.c deleted file mode 100644 index bd69ac9..0000000 --- a/old/2021-06-17-cachedata/main.c +++ /dev/null | |||
| @@ -1,63 +0,0 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include "cube.h" | ||
| 3 | #include "steps.h" | ||
| 4 | |||
| 5 | int main() { | ||
| 6 | Alg *algo; | ||
| 7 | AlgList *sols; | ||
| 8 | Cube cube; | ||
| 9 | SolveOptions opts; | ||
| 10 | char line[1000]; | ||
| 11 | int i, ns = 3; /*, nrand = 100000, sum1, sum2;*/ | ||
| 12 | |||
| 13 | Step *stps[20] = {&eofb_HTM, &corners_URF, &optimal_HTM}; | ||
| 14 | char sss[30][30] = {"EO on F/B", "Corners URF", "Optimal solution"}; | ||
| 15 | |||
| 16 | opts = (SolveOptions) { | ||
| 17 | .min_moves = 0, | ||
| 18 | .max_moves = 20, | ||
| 19 | .optimal_only = true, | ||
| 20 | .max_solutions = 1, | ||
| 21 | .can_niss = false, | ||
| 22 | .feedback = true, | ||
| 23 | .pre_trans = uf | ||
| 24 | }; | ||
| 25 | |||
| 26 | init(); | ||
| 27 | |||
| 28 | /* | ||
| 29 | print_ptable(&pd_corners_HTM); | ||
| 30 | |||
| 31 | srand(time(NULL)); | ||
| 32 | sum1 = 0; | ||
| 33 | sum2 = 0; | ||
| 34 | for (i = 0; i < nrand; i++) { | ||
| 35 | sum1 += optimal_HTM.check(random_cube()); | ||
| 36 | sum2 += corners_HTM.check(random_cube()); | ||
| 37 | } | ||
| 38 | printf("Average optimal pruning: %lf\n", ((double)sum1) / ((double) nrand)); | ||
| 39 | printf("Average corners pruning: %lf\n", ((double)sum2) / ((double) nrand)); | ||
| 40 | */ | ||
| 41 | |||
| 42 | print_cachedata(&cd_optimal_HTM_6, false); | ||
| 43 | |||
| 44 | printf("Welcome to nissy 2.0! Insert a scramble:\n"); | ||
| 45 | |||
| 46 | if (fgets(line, 1000, stdin) != NULL) { | ||
| 47 | algo = new_alg(line); | ||
| 48 | cube = apply_alg(algo, (Cube){0}); | ||
| 49 | |||
| 50 | for (i = 0; i < ns; i++) { | ||
| 51 | if (stps[i]->check == NULL) | ||
| 52 | fprintf(stderr, "Check function for step %d is null\n", i); | ||
| 53 | sols = solve(cube, *stps[i], &opts); | ||
| 54 | printf("%s: %d solutions found:\n", sss[i], sols->len); | ||
| 55 | print_alglist(sols, true); | ||
| 56 | free_alglist(sols); | ||
| 57 | } | ||
| 58 | free(algo); | ||
| 59 | } | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
