nissy-fmc

A Rubik's cube FMC assistant
git clone https://git.tronto.net/nissy-fmc
Download | Log | Files | Refs | README | LICENSE

commit 825ad379983681769e83cc7fe1949c5922062799
parent 92fe5c67548304af7630ba0dd571b9d95241e412
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Fri, 24 Dec 2021 15:33:09 +0100

Changed default behavior of -s

Diffstat:
Mdoc/nissy.1 | 16+++++++++++++++-
Mnissy | 0
Mnissy-2.0beta9.tar.gz | 0
Msrc/commands.c | 10++++++++++
4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/doc/nissy.1 b/doc/nissy.1 @@ -111,7 +111,21 @@ Plain style: do not print the number of moves. .It Fl s Ar n Try to find .Ar n -solutions. +solutions. By default and unless the +.Fl M +or +.Fl o +options are used, at most one solution is printed. +If at least one of +.Fl M +and +.Fl o +is used, all the solutions found within the given bounds are printed. +The option +.Fl s +overwrites these default behaviors and at most +.Ar n +solutions are printed, still satisfiyng the other constraints. . .It Fl t Ar n Use diff --git a/nissy b/nissy Binary files differ. diff --git 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 @@ -115,6 +115,7 @@ CommandArgs * solve_parse_args(int c, char **v) { int i; + bool infinitesols, fixedmsols; long val; CommandArgs *a = new_args(); @@ -130,6 +131,9 @@ solve_parse_args(int c, char **v) a->opts->print_number = true; a->opts->count_only = false; + fixedmsols = false; + infinitesols = false; + for (i = 0; i < c; i++) { if (!strcmp(v[i], "-m") && i+1 < c) { val = strtol(v[++i], NULL, 10); @@ -149,6 +153,7 @@ solve_parse_args(int c, char **v) return a; } a->opts->max_moves = val; + infinitesols = true; } else if (!strcmp(v[i], "-t") && i+1 < c) { val = strtol(v[++i], NULL, 10); if (val < 1 || val > 64) { @@ -166,8 +171,10 @@ solve_parse_args(int c, char **v) return a; } a->opts->max_solutions = val; + fixedmsols = true; } else if (!strcmp(v[i], "-o")) { a->opts->optimal_only = true; + infinitesols = true; } else if (!strcmp(v[i], "-n")) { a->opts->can_niss = true; } else if (!strcmp(v[i], "-v")) { @@ -183,6 +190,9 @@ solve_parse_args(int c, char **v) } } + if (infinitesols && !fixedmsols) + a->opts->max_solutions = 1000000; /* 1M = +infty */ + a->success = read_scramble(c-i, &v[i], a); return a; }