aboutsummaryrefslogtreecommitdiff
path: root/tools/300_solve_small/solve_small.c
diff options
context:
space:
mode:
authorenricotenuti <tenutz_27@outlook.it>2024-09-29 12:42:31 +0200
committerenricotenuti <tenutz_27@outlook.it>2024-09-29 12:42:31 +0200
commit7a52b4cd50a40e4bce919b6bd51203d0e9867141 (patch)
tree95ab133f9771c4791d5c784f1b3d4822b1dd7d3c /tools/300_solve_small/solve_small.c
parent8fcfb3a33fe053ed2032d58ecc0b5d640c155931 (diff)
parent774a824a6c80b5af495f4fb99d98758e3b9f6b81 (diff)
downloadnissy-core-7a52b4cd50a40e4bce919b6bd51203d0e9867141.tar.gz
nissy-core-7a52b4cd50a40e4bce919b6bd51203d0e9867141.zip
Merge remote-tracking branch 'upstream/master'
Merge upstream
Diffstat (limited to 'tools/300_solve_small/solve_small.c')
-rw-r--r--tools/300_solve_small/solve_small.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/300_solve_small/solve_small.c b/tools/300_solve_small/solve_small.c
new file mode 100644
index 0000000..d476bce
--- /dev/null
+++ b/tools/300_solve_small/solve_small.c
@@ -0,0 +1,53 @@
1#include "../tool.h"
2
3const char *solver = "h48";
4const char *options = "0;4;20";
5const char *filename = "tables/h48h0k4";
6char *buf;
7
8char *scrambles[] = {
9 "R D' R2 D R U2 R' D' R U2 R D R'", /* 12 optimal */
10 "RLUD RLUD RLUD", /* 12 optimal */
11 // "R' U' F D2 L2 F R2 U2 R2 B D2 L B2 D' B2 L' R' B D2 B U2 L U2 R' U' F", /* FMC2019 A1 - 16 optimal */
12 // "R' U' F D R F2 D L F D2 F2 L' U R' L2 D' R2 F2 R2 D L2 U2 R' U' F", /* FMC2024 A1 - 19 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("%d. %s\n", i+1, scrambles[i]);
24 fprintf(stderr, "Solving scramble %s\n", scrambles[i]);
25 if (nissy_frommoves(scrambles[i], cube) == -1) {
26 fprintf(stderr, "Invalid scramble\n");
27 printf("Invalid\n");
28 continue;
29 }
30 n = nissy_solve(
31 cube, "h48", options, "", 0, 20, 1, -1, buf, sol);
32 if (n == 0) {
33 printf("No solution\n");
34 fprintf(stderr, "No solution found\n");
35 } else {
36 printf("Solutions:\n%s\n", sol);
37 }
38 }
39}
40
41int main(void) {
42
43 srand(time(NULL));
44 nissy_setlogger(log_stderr);
45
46 if (getdata(solver, options, &buf, filename) != 0)
47 return 1;
48
49 timerun(run, "small solver benchmark");
50
51 free(buf);
52 return 0;
53}

Generated with cgit - Back to sebastiano.tronto.net