From 92fe5c67548304af7630ba0dd571b9d95241e412 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 24 Dec 2021 15:13:25 +0100 Subject: Added -c option for solve --- src/commands.c | 9 ++++++++- src/cubetypes.h | 1 + src/steps.c | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'src') 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) a->opts->verbose = false; a->opts->all = false; a->opts->print_number = true; + a->opts->count_only = false; for (i = 0; i < c; i++) { if (!strcmp(v[i], "-m") && i+1 < c) { @@ -175,6 +176,8 @@ solve_parse_args(int c, char **v) a->opts->all = true; } else if (!strcmp(v[i], "-p")) { a->opts->print_number = false; + } else if (!strcmp(v[i], "-c")) { + a->opts->count_only = true; } else if (!read_step(a, v[i])) { break; } @@ -265,7 +268,11 @@ solve_exec(CommandArgs *args) c = apply_alg(args->scramble, (Cube){0}); sols = solve(c, args->step, args->opts); - print_alglist(sols, args->opts->print_number); + if (args->opts->count_only) + printf("%d\n", sols->len); + else + print_alglist(sols, args->opts->print_number); + free_alglist(sols); } 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 bool verbose; bool all; bool print_number; + bool count_only; }; 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 = { .ntables = 2, }; +Step +eofbfin_eofb = { + .shortname = "eofbfin", + .name = "Optimal after EO on F/B without breaking EO", + + .final = true, + .is_done = is_solved, + .estimate = estimate_nxopt31_HTM, + .ready = check_eofb, + .ready_msg = check_eo_msg, + .is_valid = always_valid, + .moveset = &moveset_eofb, + + .pre_trans = uf, + + .tables = {&pd_nxopt31_HTM, &pd_corners_HTM}, + .ntables = 2, +}; + /* EO steps **************************/ Step eoany_HTM = { @@ -861,6 +880,7 @@ htrfin_htr = { Step *steps[NSTEPS] = { &optimal_HTM, /* first is default */ &optimal_light_HTM, + &eofbfin_eofb, &eoany_HTM, &eofb_HTM, -- cgit v1.3