From 3568412f8f230774d0d11d7ed1c897424f95d3ef Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 11 Nov 2021 21:37:34 +0100 Subject: Rewritten from scratch. Welocme nissy 2.0! --- old/2021-06-17-cachedata/main.c | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 old/2021-06-17-cachedata/main.c (limited to 'old/2021-06-17-cachedata/main.c') diff --git a/old/2021-06-17-cachedata/main.c b/old/2021-06-17-cachedata/main.c new file mode 100644 index 0000000..bd69ac9 --- /dev/null +++ b/old/2021-06-17-cachedata/main.c @@ -0,0 +1,63 @@ +#include +#include "cube.h" +#include "steps.h" + +int main() { + Alg *algo; + AlgList *sols; + Cube cube; + SolveOptions opts; + char line[1000]; + int i, ns = 3; /*, nrand = 100000, sum1, sum2;*/ + + Step *stps[20] = {&eofb_HTM, &corners_URF, &optimal_HTM}; + char sss[30][30] = {"EO on F/B", "Corners URF", "Optimal solution"}; + + opts = (SolveOptions) { + .min_moves = 0, + .max_moves = 20, + .optimal_only = true, + .max_solutions = 1, + .can_niss = false, + .feedback = true, + .pre_trans = uf + }; + + init(); + +/* + print_ptable(&pd_corners_HTM); + + srand(time(NULL)); + sum1 = 0; + sum2 = 0; + for (i = 0; i < nrand; i++) { + sum1 += optimal_HTM.check(random_cube()); + sum2 += corners_HTM.check(random_cube()); + } + printf("Average optimal pruning: %lf\n", ((double)sum1) / ((double) nrand)); + printf("Average corners pruning: %lf\n", ((double)sum2) / ((double) nrand)); +*/ + + print_cachedata(&cd_optimal_HTM_6, false); + + printf("Welcome to nissy 2.0! Insert a scramble:\n"); + + if (fgets(line, 1000, stdin) != NULL) { + algo = new_alg(line); + cube = apply_alg(algo, (Cube){0}); + + for (i = 0; i < ns; i++) { + if (stps[i]->check == NULL) + fprintf(stderr, "Check function for step %d is null\n", i); + sols = solve(cube, *stps[i], &opts); + printf("%s: %d solutions found:\n", sss[i], sols->len); + print_alglist(sols, true); + free_alglist(sols); + } + free(algo); + } + + return 0; +} + -- cgit v1.3