aboutsummaryrefslogtreecommitdiff
path: root/tools/020_solve_small
diff options
context:
space:
mode:
Diffstat (limited to 'tools/020_solve_small')
-rw-r--r--tools/020_solve_small/solve_small.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/020_solve_small/solve_small.c b/tools/020_solve_small/solve_small.c
new file mode 100644
index 0000000..dee2b55
--- /dev/null
+++ b/tools/020_solve_small/solve_small.c
@@ -0,0 +1,51 @@
1#include <pthread.h>
2
3#include "../tool.h"
4
5const char *solver = "h48";
6const char *options = "0;4;20";
7const char *filename = "tables/h48h0k4";
8char *buf;
9
10char *scrambles[] = {
11 "R D' R2 D R U2 R' D' R U2 R D R'", /* 12 optimal */
12 "RLUD RLUD RLUD", /* 12 optimal */
13 NULL
14};
15
16void run(void) {
17 int i;
18 int64_t n;
19 char sol[100], cube[22];
20
21 printf("Solved the following scrambles:\n\n");
22 for (i = 0; scrambles[i] != NULL; i++) {
23 printf("%s\n", scrambles[i]);
24 fprintf(stderr, "Solving scramble %s\n", scrambles[i]);
25 if (nissy_frommoves(scrambles[i], cube) == -1) {
26 fprintf(stderr, "Invalid scramble, "
27 "continuing with next scramble\n");
28 continue;
29 }
30 n = nissy_solve(
31 cube, "h48", options, "", 0, 20, 1, -1, buf, sol);
32 if (n == 0)
33 fprintf(stderr, "No solution found, "
34 "continuing with next scramble\n");
35 }
36 printf("\n");
37}
38
39int main(void) {
40
41 srand(time(NULL));
42 nissy_setlogger(log_stderr);
43
44 if (getdata(solver, options, &buf, filename) != 0)
45 return 1;
46
47 timerun(run, "small solver benchmark");
48
49 free(buf);
50 return 0;
51}

Generated with cgit - Back to sebastiano.tronto.net