diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c index 193ee97..6afd5cd 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -115,6 +115,7 @@ CommandArgs * | |||
| 115 | solve_parse_args(int c, char **v) | 115 | solve_parse_args(int c, char **v) |
| 116 | { | 116 | { |
| 117 | int i; | 117 | int i; |
| 118 | bool infinitesols, fixedmsols; | ||
| 118 | long val; | 119 | long val; |
| 119 | 120 | ||
| 120 | CommandArgs *a = new_args(); | 121 | CommandArgs *a = new_args(); |
| @@ -130,6 +131,9 @@ solve_parse_args(int c, char **v) | |||
| 130 | a->opts->print_number = true; | 131 | a->opts->print_number = true; |
| 131 | a->opts->count_only = false; | 132 | a->opts->count_only = false; |
| 132 | 133 | ||
| 134 | fixedmsols = false; | ||
| 135 | infinitesols = false; | ||
| 136 | |||
| 133 | for (i = 0; i < c; i++) { | 137 | for (i = 0; i < c; i++) { |
| 134 | if (!strcmp(v[i], "-m") && i+1 < c) { | 138 | if (!strcmp(v[i], "-m") && i+1 < c) { |
| 135 | val = strtol(v[++i], NULL, 10); | 139 | val = strtol(v[++i], NULL, 10); |
| @@ -149,6 +153,7 @@ solve_parse_args(int c, char **v) | |||
| 149 | return a; | 153 | return a; |
| 150 | } | 154 | } |
| 151 | a->opts->max_moves = val; | 155 | a->opts->max_moves = val; |
| 156 | infinitesols = true; | ||
| 152 | } else if (!strcmp(v[i], "-t") && i+1 < c) { | 157 | } else if (!strcmp(v[i], "-t") && i+1 < c) { |
| 153 | val = strtol(v[++i], NULL, 10); | 158 | val = strtol(v[++i], NULL, 10); |
| 154 | if (val < 1 || val > 64) { | 159 | if (val < 1 || val > 64) { |
| @@ -166,8 +171,10 @@ solve_parse_args(int c, char **v) | |||
| 166 | return a; | 171 | return a; |
| 167 | } | 172 | } |
| 168 | a->opts->max_solutions = val; | 173 | a->opts->max_solutions = val; |
| 174 | fixedmsols = true; | ||
| 169 | } else if (!strcmp(v[i], "-o")) { | 175 | } else if (!strcmp(v[i], "-o")) { |
| 170 | a->opts->optimal_only = true; | 176 | a->opts->optimal_only = true; |
| 177 | infinitesols = true; | ||
| 171 | } else if (!strcmp(v[i], "-n")) { | 178 | } else if (!strcmp(v[i], "-n")) { |
| 172 | a->opts->can_niss = true; | 179 | a->opts->can_niss = true; |
| 173 | } else if (!strcmp(v[i], "-v")) { | 180 | } else if (!strcmp(v[i], "-v")) { |
| @@ -183,6 +190,9 @@ solve_parse_args(int c, char **v) | |||
| 183 | } | 190 | } |
| 184 | } | 191 | } |
| 185 | 192 | ||
| 193 | if (infinitesols && !fixedmsols) | ||
| 194 | a->opts->max_solutions = 1000000; /* 1M = +infty */ | ||
| 195 | |||
| 186 | a->success = read_scramble(c-i, &v[i], a); | 196 | a->success = read_scramble(c-i, &v[i], a); |
| 187 | return a; | 197 | return a; |
| 188 | } | 198 | } |
