diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-31 08:38:37 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-31 08:38:37 +0200 |
| commit | e2b154c40acaac4e7a7b3e379ada0404519c3750 (patch) | |
| tree | 2ddca6533b03180eee1cd199d1c5a56586211a65 /tools/solvetest.h | |
| parent | 36c317ebd1cf1dba8a8cbec494f4d3971e6cefd3 (diff) | |
| download | nissy-core-e2b154c40acaac4e7a7b3e379ada0404519c3750.tar.gz nissy-core-e2b154c40acaac4e7a7b3e379ada0404519c3750.zip | |
Added solvetest for EO (broken for now)
Diffstat (limited to '')
| -rw-r--r-- | tools/solvetest.h (renamed from tools/400_solvetest/solve_test.c) | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/tools/400_solvetest/solve_test.c b/tools/solvetest.h index 73e6e8e..4a36736 100644 --- a/tools/400_solvetest/solve_test.c +++ b/tools/solvetest.h | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | #include "../tool.h" | 1 | #include "tool.h" |
| 2 | #include "scrambles.h" | ||
| 3 | 2 | ||
| 4 | #define SOL_BUFFER_LEN 100000 | 3 | #define SOL_BUFFER_LEN 100000 |
| 5 | 4 | ||
| @@ -50,36 +49,15 @@ void run(void) { | |||
| 50 | for (i = 0; s[i].scramble[0]; i++) { | 49 | for (i = 0; s[i].scramble[0]; i++) { |
| 51 | printf("\n%d. %s\n", i, s[i].scramble); | 50 | printf("\n%d. %s\n", i, s[i].scramble); |
| 52 | 51 | ||
| 53 | /* Single solution */ | ||
| 54 | if (nissy_applymoves(NISSY_SOLVED_CUBE, s[i].scramble, cube) | ||
| 55 | == -1) { | ||
| 56 | printf("Invalid scramble\n"); | ||
| 57 | continue; | ||
| 58 | } | ||
| 59 | n = nissy_solve(cube, solver, NISSY_NISSFLAG_NORMAL, | ||
| 60 | 0, 20, 1, -1, 0, size, buf, SOL_BUFFER_LEN, sol, stats, | ||
| 61 | NULL, NULL); | ||
| 62 | if (n == 0) { | ||
| 63 | printf("Error: no solution\n"); | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | if (check_one(sol, s[i].solutions)) { | ||
| 67 | printf("Single solution is correct\n"); | ||
| 68 | } else { | ||
| 69 | printf("Error!\n"); | ||
| 70 | printf("Found solution(s):\n%s", sol); | ||
| 71 | printf("Valid solution(s):\n%s", s[i].solutions); | ||
| 72 | return; | ||
| 73 | } | ||
| 74 | |||
| 75 | /* Multiple solutions */ | 52 | /* Multiple solutions */ |
| 76 | if (nissy_applymoves(NISSY_SOLVED_CUBE, s[i].scramble, cube) | 53 | if (nissy_applymoves(NISSY_SOLVED_CUBE, s[i].scramble, cube) |
| 77 | == -1) { | 54 | == -1) { |
| 78 | printf("Invalid scramble\n"); | 55 | printf("Invalid scramble\n"); |
| 79 | continue; | 56 | continue; |
| 80 | } | 57 | } |
| 81 | n = nissy_solve(cube, solver, NISSY_NISSFLAG_NORMAL, | 58 | n = nissy_solve(cube, solver, |
| 82 | 0, 20, 100, 0, 0, size, buf, SOL_BUFFER_LEN, sol, stats, | 59 | NISSFLAG, MINMOVES, MAXMOVES, MAXSOLUTIONS, OPTIMAL, |
| 60 | 0, size, buf, SOL_BUFFER_LEN, sol, stats, | ||
| 83 | NULL, NULL); | 61 | NULL, NULL); |
| 84 | if (check_all(sol, s[i].solutions)) { | 62 | if (check_all(sol, s[i].solutions)) { |
| 85 | printf("All solutions are correct\n"); | 63 | printf("All solutions are correct\n"); |
