aboutsummaryrefslogtreecommitdiff
path: root/old/2021-06-30-noreached/main.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
commit3568412f8f230774d0d11d7ed1c897424f95d3ef (patch)
tree77223792d8c925a9b1fc32b3f4341e943b5f8209 /old/2021-06-30-noreached/main.c
parent67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff)
downloadnissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz
nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-06-30-noreached/main.c')
-rw-r--r--old/2021-06-30-noreached/main.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/old/2021-06-30-noreached/main.c b/old/2021-06-30-noreached/main.c
new file mode 100644
index 0000000..1ebd917
--- /dev/null
+++ b/old/2021-06-30-noreached/main.c
@@ -0,0 +1,80 @@
1#include <stdio.h>
2#include "cube.h"
3#include "steps.h"
4
5int main() {
6 Alg *algo;
7 AlgList *sols;
8 Cube cube;
9 SolveOptions opts;
10 char line[1000];
11 int i, ns = 2;
12/* Move m;*/
13/* int nrand = 10000, sum1, sum2, sum3;*/
14
15 Step *stps[20] = {&drud_HTM, &optimal_HTM};
16 char sss[30][30] = {"DR on UD", "Optimal solve"};
17
18 opts = (SolveOptions) {
19 .min_moves = 0,
20 .max_moves = 20,
21 .optimal_only = true,
22 .max_solutions = 1,
23 .can_niss = false,
24 .feedback = true,
25 };
26
27 init();
28
29/*
30 srand(time(NULL));
31 sum1 = 0;
32 sum2 = 0;
33 sum3 = 0;
34 for (i = 0; i < nrand; i++) {
35 cube = random_cube();
36 sum1 += drud_HTM.check(cube, 20);
37 sum2 += optimal_HTM.check(cube, 20);
38 sum3 += cornershtreofb_HTM.check(cube, 20);
39 }
40 printf("Average drud pruning: %lf\n", ((double)sum1) / ((double) nrand));
41 printf("Average corners htr pruning: %lf\n", ((double)sum2) / ((double) nrand));
42 printf("Average corners htr + eofb pruning: %lf\n", ((double)sum3) / ((double) nrand));
43*/
44
45/*
46 for (m = U; m <= B3; m++) {
47 printf("Class eofbepos after %d: ", m);
48 printf("%lu\n", coord_khuge.index(apply_move(m,(Cube){0})));
49 }
50*/
51
52 printf("Welcome to nissy 2.0! Insert a scramble:\n");
53
54 if (fgets(line, 1000, stdin) != NULL) {
55 algo = new_alg(line);
56 cube = apply_alg(algo, (Cube){0});
57
58 print_alg(inverse_alg(algo), false);
59/*
60 printf("After rb_mirror:\n");
61 cube = apply_trans(rb_mirror, cube);
62 print_cube(cube);
63 printf("Going back:\n");
64 cube = apply_trans(inverse_trans(rb_mirror), cube);
65*/
66
67 print_cube(cube);
68
69 for (i = 0; i < ns; i++) {
70 sols = solve(cube, *stps[i], &opts);
71 printf("%s: %d solutions found:\n", sss[i], sols->len);
72 print_alglist(sols, true);
73 free_alglist(sols);
74 }
75 free_alg(algo);
76 }
77
78 return 0;
79}
80

Generated with cgit - Back to sebastiano.tronto.net