diff options
Diffstat (limited to '')
| -rw-r--r-- | src/commands.c | 9 |
1 files changed, 8 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 | ||
