diff options
| -rw-r--r-- | doc/nissy.1 | 16 | ||||
| -rwxr-xr-x | nissy | bin | 321192 -> 321192 bytes | |||
| -rw-r--r-- | nissy-2.0beta9.tar.gz | bin | 59974 -> 60731 bytes | |||
| -rw-r--r-- | src/commands.c | 10 |
4 files changed, 25 insertions, 1 deletions
diff --git a/doc/nissy.1 b/doc/nissy.1 index 8f92b01..add0da6 100644 --- a/doc/nissy.1 +++ b/doc/nissy.1 | |||
| @@ -111,7 +111,21 @@ Plain style: do not print the number of moves. | |||
| 111 | .It Fl s Ar n | 111 | .It Fl s Ar n |
| 112 | Try to find | 112 | Try to find |
| 113 | .Ar n | 113 | .Ar n |
| 114 | solutions. | 114 | solutions. By default and unless the |
| 115 | .Fl M | ||
| 116 | or | ||
| 117 | .Fl o | ||
| 118 | options are used, at most one solution is printed. | ||
| 119 | If at least one of | ||
| 120 | .Fl M | ||
| 121 | and | ||
| 122 | .Fl o | ||
| 123 | is used, all the solutions found within the given bounds are printed. | ||
| 124 | The option | ||
| 125 | .Fl s | ||
| 126 | overwrites these default behaviors and at most | ||
| 127 | .Ar n | ||
| 128 | solutions are printed, still satisfiyng the other constraints. | ||
| 115 | . | 129 | . |
| 116 | .It Fl t Ar n | 130 | .It Fl t Ar n |
| 117 | Use | 131 | Use |
| Binary files differ | |||
diff --git a/nissy-2.0beta9.tar.gz b/nissy-2.0beta9.tar.gz index 097acca..85ed2f0 100644 --- a/nissy-2.0beta9.tar.gz +++ b/nissy-2.0beta9.tar.gz | |||
| Binary files differ | |||
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 | } |
