nissy-fmc

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

commit 0aabc7d04f03311694557a045de2ad3d9caa4004
parent 4fb970ad4e7d0558f7bf32dbad2333dbf3cb3ab4
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Fri, 24 Dec 2021 00:07:29 +0100

use nxopt31 (compressed) by default for optimal solving

Diffstat:
MTODO.md | 6++++++
Mnissy | 0
Msrc/pruning.c | 15+++++++++++----
Msrc/shell.c | 6------
Msrc/steps.c | 25+++++++++++++++----------
Msrc/symcoord.c | 14+++++++++++---
6 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -73,3 +73,9 @@ It's more of a personal reminder than anything else. * client/server architecture: run a server process in the background so that multiple client processess can send it queries and get results; this would open up the door for a web-based version or graphical clients + +### Cleanup +* Remove khuge from everywhere +* sort again functions alphabetically in their files +* more stuff to load at start (or when suitable command is called) rather + than when called directly, to avoid nasty problems with threading diff --git a/nissy b/nissy Binary files differ. diff --git a/src/pruning.c b/src/pruning.c @@ -78,13 +78,14 @@ pd_htrfin_htr = { .moveset = &moveset_htr, }; -/* TODO: remove */ +/* PruneData pd_khuge_HTM = { .filename = "pt_khuge_HTM", .coord = &coord_khuge, .moveset = &moveset_HTM, }; +*/ PruneData pd_nxopt31_HTM = { @@ -399,10 +400,16 @@ ptableval_index(PruneData *pd, uint64_t ind) genptable(pd, 1); /* TODO: set default or remove this case */ } - e = pd->compact ? ENTRIES_PER_GROUP_COMPACT : ENTRIES_PER_GROUP; - m = (entry_group_t)(pd->compact ? 3 : 15); + if (pd->compact) { + e = ENTRIES_PER_GROUP_COMPACT; + m = 3; + sh = (ind % e) * 2; + } else { + e = ENTRIES_PER_GROUP; + m = 15; + sh = (ind % e) * 4; + } - sh = (ind % e) * (pd->compact ? 2 : 4); mask = m << sh; i = ind/e; diff --git a/src/shell.c b/src/shell.c @@ -97,12 +97,6 @@ launch(bool batchmode) int main(int argc, char *argv[]) { -/* - init_movesets(); - init_symcoord(); - print_ptable(&pd_nxopt31_HTM); -*/ - if (argc > 1) { if (!strcmp(argv[1], "-b")) { launch(true); diff --git a/src/steps.c b/src/steps.c @@ -35,7 +35,7 @@ static int estimate_dr_eofb(DfsArg *arg); static int estimate_drudfin_drud(DfsArg *arg); static int estimate_htr_drud(DfsArg *arg); static int estimate_htrfin_htr(DfsArg *arg); -static int estimate_optimal_HTM(DfsArg *arg); +/*static int estimate_khuge_HTM(DfsArg *arg);*/ static int estimate_nxopt31_HTM(DfsArg *arg); static int estimate_light_HTM(DfsArg *arg); @@ -60,14 +60,17 @@ static char check_drany_msg[100] = "DR must be solved on at least one axis"; /* Steps *********************************************************************/ /* Optimal solvers *******************/ + +/* This is not used anymore, I'll keep it just in case */ +/* Step -optimal_HTM = { - .shortname = "optimal", - .name = "Optimal solve (in HTM)", +optimal_khuge_HTM = { + .shortname = "khuge", + .name = "Optimal solve (in HTM) using khuge table", .final = true, .is_done = is_solved, - .estimate = estimate_optimal_HTM, + .estimate = estimate_khuge_HTM, .ready = check_centers, .ready_msg = check_centers_msg, .is_valid = always_valid, @@ -78,11 +81,12 @@ optimal_HTM = { .tables = {&pd_khuge_HTM, &pd_corners_HTM}, .ntables = 2, }; +*/ Step -optimal_nxopt31_HTM = { - .shortname = "nxopt31", - .name = "Optimal solve (in HTM), nxopt31 table", +optimal_HTM = { + .shortname = "optimal", + .name = "Optimal solve (in HTM)", .final = true, .is_done = is_solved, @@ -856,7 +860,6 @@ htrfin_htr = { Step *steps[NSTEPS] = { &optimal_HTM, /* first is default */ - &optimal_nxopt31_HTM, &optimal_light_HTM, &eoany_HTM, @@ -1203,11 +1206,13 @@ estimate_htrfin_htr(DfsArg *arg) return ptableval(&pd_htrfin_htr, arg->cube); } +/* static int -estimate_optimal_HTM(DfsArg *arg) +estimate_khuge_HTM(DfsArg *arg) { return estimate_nxoptlike(arg, &pd_khuge_HTM); } +*/ static int estimate_nxopt31_HTM(DfsArg *arg) diff --git a/src/symcoord.c b/src/symcoord.c @@ -8,19 +8,19 @@ static Cube antindex_cp_sym16(uint64_t ind); static Cube antindex_eofbepos_sym16(uint64_t ind); static Cube antindex_drud_sym16(uint64_t ind); static Cube antindex_drudfin_noE_sym16(uint64_t ind); -static Cube antindex_khuge(uint64_t ind); +/*static Cube antindex_khuge(uint64_t ind);*/ static Cube antindex_nxopt31(uint64_t ind); static uint64_t index_cp_sym16(Cube cube); static uint64_t index_eofbepos_sym16(Cube cube); static uint64_t index_drud_sym16(Cube cube); static uint64_t index_drudfin_noE_sym16(Cube cube); -static uint64_t index_khuge(Cube cube); +/*static uint64_t index_khuge(Cube cube);*/ static uint64_t index_nxopt31(Cube cube); static int transfinder_drud_sym16(uint64_t ind, Trans *ret); static int transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret); -static int transfinder_khuge(uint64_t ind, Trans *ret); +/*static int transfinder_khuge(uint64_t ind, Trans *ret);*/ static int transfinder_nxopt31(uint64_t ind, Trans *ret); static void gensym(SymData *sd); @@ -93,6 +93,7 @@ coord_drudfin_noE_sym16 = { .trans = transfinder_drudfin_noE_sym16, }; +/* Coordinate coord_khuge = { .index = index_khuge, @@ -100,6 +101,7 @@ coord_khuge = { .max = POW3TO7 * FACTORIAL4 * CLASSES_EOFBEPOS_16, .trans = transfinder_khuge, }; +*/ Coordinate coord_nxopt31 = { @@ -148,6 +150,7 @@ antindex_drudfin_noE_sym16(uint64_t ind) return c1; } +/* static Cube antindex_khuge(uint64_t ind) { @@ -159,6 +162,7 @@ antindex_khuge(uint64_t ind) return c; } +*/ static Cube antindex_nxopt31(uint64_t ind) @@ -208,6 +212,7 @@ index_eofbepos_sym16(Cube cube) return sd_eofbepos_16.class[coord_eofbepos.index(cube)]; } +/* static uint64_t index_khuge(Cube cube) { @@ -221,6 +226,7 @@ index_khuge(Cube cube) return a * POW3TO7 + c.coud; } +*/ static uint64_t index_nxopt31(Cube cube) @@ -280,6 +286,7 @@ transfinder_drudfin_noE_sym16(uint64_t ind, Trans *ret) return naux[trueind]; } +/* static int transfinder_khuge(uint64_t ind, Trans *ret) { @@ -301,6 +308,7 @@ transfinder_khuge(uint64_t ind, Trans *ret) ret[j] = retaux[trueind][j]; return naux[trueind]; } +*/ static int transfinder_nxopt31(uint64_t ind, Trans *ret)