nissy-classic

Stable branch of nissy
git clone https://git.tronto.net/nissy-classic
Download | Log | Files | Refs | README | LICENSE

commit e8c05804d52bd8f54d5398250f261ddd1c39789f
parent 6c05a5accff2055ddac64504571e52d945bcd372
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sun, 29 Oct 2023 17:57:25 +0100

Fixed bug on dr-eo -N

Diffstat:
Msrc/alg.c | 2+-
Msrc/solve.c | 29+++++++++++++++++------------
Msrc/steps.c | 10++++------
3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/src/alg.c b/src/alg.c @@ -632,7 +632,7 @@ void sort_alglist(AlgList *al) { int i, n = al->len; - Alg* alg_array[n]; + Alg* alg_array[n+1]; AlgListNode *node; for (i = 0, node = al->first; i < n; i++, node = node->next) diff --git a/src/solve.c b/src/solve.c @@ -11,11 +11,11 @@ static bool dfs_check_solved(DfsArg *arg); static bool dfs_switch(DfsArg *arg); static void dfs_niss(DfsArg *arg); static bool dfs_stop(DfsArg *arg); +static bool dfs_useless_niss(DfsArg *arg); static void * instance_thread(void *arg); static void invert_branch(DfsArg *arg); static void multidfs(Cube c, Trans t, Step *s, SolveOptions *opts, AlgList *sols, int d); -static bool niss_makes_sense(DfsArg *arg); static bool solvestop(int d, int op, SolveOptions *opts, AlgList *sols); /* Local functions ***********************************************************/ @@ -97,7 +97,7 @@ dfs(DfsArg *arg) invert_branch(arg); dfs_branch(arg); - if (arg->opts->nisstype == NISS && !arg->niss && niss_makes_sense(arg)) + if (arg->opts->nisstype == NISS && !arg->niss && !arg->step->final) dfs_niss(arg); if (sw) @@ -139,7 +139,7 @@ dfs_check_solved(DfsArg *arg) if (!arg->step->is_done(arg->cube)) return false; - if (arg->current_alg->len == arg->d) { + if (arg->current_alg->len == arg->d && !dfs_useless_niss(arg)) { if ((arg->step->is_valid(arg->current_alg) || arg->opts->all) && (!arg->step->final || !cancel_niss(arg))) { @@ -233,6 +233,20 @@ dfs_switch(DfsArg *arg) return bi < bn; } +static bool +dfs_useless_niss(DfsArg *arg) +{ + Cube c; + Move m = arg->last1inv; + + if (m == NULLMOVE || !arg->niss) + return false; + + c = apply_move(inverse_move(m), arg->cube); + + return arg->step->is_done(c); +} + static void * instance_thread(void *arg) { @@ -363,15 +377,6 @@ multidfs(Cube c, Trans tr, Step *s, SolveOptions *opts, AlgList *sols, int d) } static bool -niss_makes_sense(DfsArg *arg) -{ - Cube testcube; - - testcube = apply_move(inverse_move(arg->last1), (Cube){0}); - return arg->current_alg->len == 0 || !arg->step->is_done(testcube); -} - -static bool solvestop(int d, int op, SolveOptions *opts, AlgList *sols) { bool opt_done, max_moves_exceeded, max_sols_exceeded; diff --git a/src/steps.c b/src/steps.c @@ -33,7 +33,6 @@ static int estimate_cp_drud(DfsArg *arg); static int estimate_htrfin_htr(DfsArg *arg); static int estimate_nxopt31_HTM(DfsArg *arg); static int estimate_light_HTM(DfsArg *arg); - static int estimate_nxoptlike(DfsArg *arg, PruneData *pd); static bool always_valid(Alg *alg); @@ -976,7 +975,7 @@ corners_dr_any = { .shortname = "corners-dr", .name = "Solve corners from DR", - .final = false, + .final = true, .is_done = check_corners_HTM, .estimate = estimate_cp_drud, .ready = check_coud_HTM, @@ -995,7 +994,7 @@ corners_drud = { .shortname = "corners-drud", .name = "Solve corners from DR on U/D", - .final = false, + .final = true, .is_done = check_corners_HTM, .estimate = estimate_cp_drud, .ready = check_coud_HTM, @@ -1014,7 +1013,7 @@ corners_drrl = { .shortname = "corners-drrl", .name = "Solve corners from DR on R/L", - .final = false, + .final = true, .is_done = check_corners_HTM, .estimate = estimate_cp_drud, .ready = check_coud_HTM, @@ -1033,7 +1032,7 @@ corners_drfb = { .shortname = "corners-drfb", .name = "Solve corners from DR on F/B", - .final = false, + .final = true, .is_done = check_corners_HTM, .estimate = estimate_cp_drud, .ready = check_coud_HTM, @@ -1570,7 +1569,6 @@ estimate_nxoptlike(DfsArg *arg, PruneData *pd) return arg->ed->oldret = ret; } - static bool always_valid(Alg *alg) {