diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-24 15:13:25 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-24 15:13:25 +0100 |
| commit | 92fe5c67548304af7630ba0dd571b9d95241e412 (patch) | |
| tree | 4f394f944bdb05a28a36ae0442d9d2418cb5fa3c /src | |
| parent | fe1343560ef17a700cdf3110d2d2b6305338c041 (diff) | |
| download | nissy-92fe5c67548304af7630ba0dd571b9d95241e412.tar.gz nissy-92fe5c67548304af7630ba0dd571b9d95241e412.zip | |
Added -c option for solve
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.c | 9 | ||||
| -rw-r--r-- | src/cubetypes.h | 1 | ||||
| -rw-r--r-- | src/steps.c | 20 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/commands.c b/src/commands.c index 01671ee..193ee97 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -128,6 +128,7 @@ solve_parse_args(int c, char **v) | |||
| 128 | a->opts->verbose = false; | 128 | a->opts->verbose = false; |
| 129 | a->opts->all = false; | 129 | a->opts->all = false; |
| 130 | a->opts->print_number = true; | 130 | a->opts->print_number = true; |
| 131 | a->opts->count_only = false; | ||
| 131 | 132 | ||
| 132 | for (i = 0; i < c; i++) { | 133 | for (i = 0; i < c; i++) { |
| 133 | if (!strcmp(v[i], "-m") && i+1 < c) { | 134 | if (!strcmp(v[i], "-m") && i+1 < c) { |
| @@ -175,6 +176,8 @@ solve_parse_args(int c, char **v) | |||
| 175 | a->opts->all = true; | 176 | a->opts->all = true; |
| 176 | } else if (!strcmp(v[i], "-p")) { | 177 | } else if (!strcmp(v[i], "-p")) { |
| 177 | a->opts->print_number = false; | 178 | a->opts->print_number = false; |
| 179 | } else if (!strcmp(v[i], "-c")) { | ||
| 180 | a->opts->count_only = true; | ||
| 178 | } else if (!read_step(a, v[i])) { | 181 | } else if (!read_step(a, v[i])) { |
| 179 | break; | 182 | break; |
| 180 | } | 183 | } |
| @@ -265,7 +268,11 @@ solve_exec(CommandArgs *args) | |||
| 265 | c = apply_alg(args->scramble, (Cube){0}); | 268 | c = apply_alg(args->scramble, (Cube){0}); |
| 266 | sols = solve(c, args->step, args->opts); | 269 | sols = solve(c, args->step, args->opts); |
| 267 | 270 | ||
| 268 | print_alglist(sols, args->opts->print_number); | 271 | if (args->opts->count_only) |
| 272 | printf("%d\n", sols->len); | ||
| 273 | else | ||
| 274 | print_alglist(sols, args->opts->print_number); | ||
| 275 | |||
| 269 | free_alglist(sols); | 276 | free_alglist(sols); |
| 270 | } | 277 | } |
| 271 | 278 | ||
diff --git a/src/cubetypes.h b/src/cubetypes.h index 7563abb..6d8af21 100644 --- a/src/cubetypes.h +++ b/src/cubetypes.h | |||
| @@ -284,6 +284,7 @@ solveoptions | |||
| 284 | bool verbose; | 284 | bool verbose; |
| 285 | bool all; | 285 | bool all; |
| 286 | bool print_number; | 286 | bool print_number; |
| 287 | bool count_only; | ||
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | struct | 290 | struct |
diff --git a/src/steps.c b/src/steps.c index ae3f9fd..79f609b 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -121,6 +121,25 @@ optimal_light_HTM = { | |||
| 121 | .ntables = 2, | 121 | .ntables = 2, |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | Step | ||
| 125 | eofbfin_eofb = { | ||
| 126 | .shortname = "eofbfin", | ||
| 127 | .name = "Optimal after EO on F/B without breaking EO", | ||
| 128 | |||
| 129 | .final = true, | ||
| 130 | .is_done = is_solved, | ||
| 131 | .estimate = estimate_nxopt31_HTM, | ||
| 132 | .ready = check_eofb, | ||
| 133 | .ready_msg = check_eo_msg, | ||
| 134 | .is_valid = always_valid, | ||
| 135 | .moveset = &moveset_eofb, | ||
| 136 | |||
| 137 | .pre_trans = uf, | ||
| 138 | |||
| 139 | .tables = {&pd_nxopt31_HTM, &pd_corners_HTM}, | ||
| 140 | .ntables = 2, | ||
| 141 | }; | ||
| 142 | |||
| 124 | /* EO steps **************************/ | 143 | /* EO steps **************************/ |
| 125 | Step | 144 | Step |
| 126 | eoany_HTM = { | 145 | eoany_HTM = { |
| @@ -861,6 +880,7 @@ htrfin_htr = { | |||
| 861 | Step *steps[NSTEPS] = { | 880 | Step *steps[NSTEPS] = { |
| 862 | &optimal_HTM, /* first is default */ | 881 | &optimal_HTM, /* first is default */ |
| 863 | &optimal_light_HTM, | 882 | &optimal_light_HTM, |
| 883 | &eofbfin_eofb, | ||
| 864 | 884 | ||
| 865 | &eoany_HTM, | 885 | &eoany_HTM, |
| 866 | &eofb_HTM, | 886 | &eofb_HTM, |
