diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-03-15 15:54:39 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-03-15 15:54:39 +0100 |
| commit | e18f8e4eefadd733d985e99e2710111afa5a710a (patch) | |
| tree | 196033c8f04e760b8b6f4d445c70ca17143e0179 /src | |
| parent | def25ea64b097d2a994eb33c91dc66248233afec (diff) | |
| download | nissy-e18f8e4eefadd733d985e99e2710111afa5a710a.tar.gz nissy-e18f8e4eefadd733d985e99e2710111afa5a710a.zip | |
Prepare for big changes in coordinates
Diffstat (limited to '')
| -rw-r--r-- | src/cubetypes.h | 6 | ||||
| -rw-r--r-- | src/moves.c | 22 | ||||
| -rw-r--r-- | src/moves.h | 15 | ||||
| -rw-r--r-- | src/pruning.c | 4 | ||||
| -rw-r--r-- | src/symcoord.c | 32 | ||||
| -rw-r--r-- | src/trans.h | 2 |
6 files changed, 50 insertions, 31 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h index 14e490a..518c727 100644 --- a/src/cubetypes.h +++ b/src/cubetypes.h | |||
| @@ -95,6 +95,8 @@ typedef struct threaddatagenpt ThreadDataGenpt; | |||
| 95 | 95 | ||
| 96 | typedef Cube (*AntiIndexer) (uint64_t); | 96 | typedef Cube (*AntiIndexer) (uint64_t); |
| 97 | typedef bool (*Checker) (Cube); | 97 | typedef bool (*Checker) (Cube); |
| 98 | typedef uint64_t (*CoordMover) (Move, uint64_t); | ||
| 99 | typedef uint64_t (*CoordTransformer) (Trans, uint64_t); | ||
| 98 | typedef int (*Estimator) (DfsArg *); | 100 | typedef int (*Estimator) (DfsArg *); |
| 99 | typedef bool (*Validator) (Alg *); | 101 | typedef bool (*Validator) (Alg *); |
| 100 | typedef void (*Exec) (CommandArgs *); | 102 | typedef void (*Exec) (CommandArgs *); |
| @@ -168,7 +170,9 @@ coordinate | |||
| 168 | Indexer index; | 170 | Indexer index; |
| 169 | AntiIndexer cube; | 171 | AntiIndexer cube; |
| 170 | uint64_t max; | 172 | uint64_t max; |
| 171 | TransFinder trans; | 173 | TransFinder transfind; |
| 174 | CoordMover move; | ||
| 175 | CoordTransformer transform; | ||
| 172 | }; | 176 | }; |
| 173 | 177 | ||
| 174 | struct | 178 | struct |
diff --git a/src/moves.c b/src/moves.c index 7c33db4..02880ca 100644 --- a/src/moves.c +++ b/src/moves.c | |||
| @@ -138,17 +138,17 @@ static char equiv_alg_string[100][NMOVES] = { | |||
| 138 | }; | 138 | }; |
| 139 | 139 | ||
| 140 | /* Transition tables, to be loaded up at the beginning */ | 140 | /* Transition tables, to be loaded up at the beginning */ |
| 141 | static int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | 141 | int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; |
| 142 | static int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | 142 | int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; |
| 143 | static int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | 143 | int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; |
| 144 | static int eofb_mtable[NMOVES][POW2TO11]; | 144 | int eofb_mtable[NMOVES][POW2TO11]; |
| 145 | static int eorl_mtable[NMOVES][POW2TO11]; | 145 | int eorl_mtable[NMOVES][POW2TO11]; |
| 146 | static int eoud_mtable[NMOVES][POW2TO11]; | 146 | int eoud_mtable[NMOVES][POW2TO11]; |
| 147 | static int cp_mtable[NMOVES][FACTORIAL8]; | 147 | int cp_mtable[NMOVES][FACTORIAL8]; |
| 148 | static int coud_mtable[NMOVES][POW3TO7]; | 148 | int coud_mtable[NMOVES][POW3TO7]; |
| 149 | static int cofb_mtable[NMOVES][POW3TO7]; | 149 | int cofb_mtable[NMOVES][POW3TO7]; |
| 150 | static int corl_mtable[NMOVES][POW3TO7]; | 150 | int corl_mtable[NMOVES][POW3TO7]; |
| 151 | static int cpos_mtable[NMOVES][FACTORIAL6]; | 151 | int cpos_mtable[NMOVES][FACTORIAL6]; |
| 152 | 152 | ||
| 153 | 153 | ||
| 154 | /* Local functions implementation ********************************************/ | 154 | /* Local functions implementation ********************************************/ |
diff --git a/src/moves.h b/src/moves.h index e7881a4..14ae087 100644 --- a/src/moves.h +++ b/src/moves.h | |||
| @@ -5,6 +5,21 @@ | |||
| 5 | #include "cube.h" | 5 | #include "cube.h" |
| 6 | #include "env.h" | 6 | #include "env.h" |
| 7 | 7 | ||
| 8 | /* | ||
| 9 | * Tables are exposed to allow for faster moves in some cases. | ||
| 10 | */ | ||
| 11 | extern int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | ||
| 12 | extern int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | ||
| 13 | extern int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; | ||
| 14 | extern int eofb_mtable[NMOVES][POW2TO11]; | ||
| 15 | extern int eorl_mtable[NMOVES][POW2TO11]; | ||
| 16 | extern int eoud_mtable[NMOVES][POW2TO11]; | ||
| 17 | extern int cp_mtable[NMOVES][FACTORIAL8]; | ||
| 18 | extern int coud_mtable[NMOVES][POW3TO7]; | ||
| 19 | extern int cofb_mtable[NMOVES][POW3TO7]; | ||
| 20 | extern int corl_mtable[NMOVES][POW3TO7]; | ||
| 21 | extern int cpos_mtable[NMOVES][FACTORIAL6]; | ||
| 22 | |||
| 8 | Cube apply_alg(Alg *alg, Cube cube); | 23 | Cube apply_alg(Alg *alg, Cube cube); |
| 9 | Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a); | 24 | Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a); |
| 10 | Cube apply_move(Move m, Cube cube); | 25 | Cube apply_move(Move m, Cube cube); |
diff --git a/src/pruning.c b/src/pruning.c index c66f8d6..2dea797 100644 --- a/src/pruning.c +++ b/src/pruning.c | |||
| @@ -263,12 +263,12 @@ genptable_fixnasty(PruneData *pd, int d) | |||
| 263 | Cube c, cc; | 263 | Cube c, cc; |
| 264 | Trans t[NTRANS]; | 264 | Trans t[NTRANS]; |
| 265 | 265 | ||
| 266 | if (pd->coord->trans == NULL) | 266 | if (pd->coord->transfind == NULL) |
| 267 | return; | 267 | return; |
| 268 | 268 | ||
| 269 | for (i = 0; i < pd->coord->max; i++) { | 269 | for (i = 0; i < pd->coord->max; i++) { |
| 270 | if (ptableval_index(pd, i) == d) { | 270 | if (ptableval_index(pd, i) == d) { |
| 271 | n = pd->coord->trans(i, t); | 271 | n = pd->coord->transfind(i, t); |
| 272 | if (n == 1) | 272 | if (n == 1) |
| 273 | continue; | 273 | continue; |
| 274 | 274 | ||
diff --git a/src/symcoord.c b/src/symcoord.c index c4349f5..38e13c6 100644 --- a/src/symcoord.c +++ b/src/symcoord.c | |||
| @@ -64,38 +64,38 @@ SymData * all_sd[] = { | |||
| 64 | 64 | ||
| 65 | Coordinate | 65 | Coordinate |
| 66 | coord_eofbepos_sym16 = { | 66 | coord_eofbepos_sym16 = { |
| 67 | .index = index_eofbepos_sym16, | 67 | .index = index_eofbepos_sym16, |
| 68 | .cube = antindex_eofbepos_sym16, | 68 | .cube = antindex_eofbepos_sym16, |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | Coordinate | 71 | Coordinate |
| 72 | coord_cp_sym16 = { | 72 | coord_cp_sym16 = { |
| 73 | .index = index_cp_sym16, | 73 | .index = index_cp_sym16, |
| 74 | .cube = antindex_cp_sym16, | 74 | .cube = antindex_cp_sym16, |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | Coordinate | 77 | Coordinate |
| 78 | coord_drud_sym16 = { | 78 | coord_drud_sym16 = { |
| 79 | .index = index_drud_sym16, | 79 | .index = index_drud_sym16, |
| 80 | .cube = antindex_drud_sym16, | 80 | .cube = antindex_drud_sym16, |
| 81 | .max = POW3TO7 * CLASSES_EOFBEPOS_16, | 81 | .max = POW3TO7 * CLASSES_EOFBEPOS_16, |
| 82 | .trans = transfinder_drud_sym16, | 82 | .transfind = transfinder_drud_sym16, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | Coordinate | 85 | Coordinate |
| 86 | coord_drudfin_noE_sym16 = { | 86 | coord_drudfin_noE_sym16 = { |
| 87 | .index = index_drudfin_noE_sym16, | 87 | .index = index_drudfin_noE_sym16, |
| 88 | .cube = antindex_drudfin_noE_sym16, | 88 | .cube = antindex_drudfin_noE_sym16, |
| 89 | .max = FACTORIAL8 * CLASSES_CP_16, | 89 | .max = FACTORIAL8 * CLASSES_CP_16, |
| 90 | .trans = transfinder_drudfin_noE_sym16, | 90 | .transfind = transfinder_drudfin_noE_sym16, |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | Coordinate | 93 | Coordinate |
| 94 | coord_nxopt31 = { | 94 | coord_nxopt31 = { |
| 95 | .index = index_nxopt31, | 95 | .index = index_nxopt31, |
| 96 | .cube = antindex_nxopt31, | 96 | .cube = antindex_nxopt31, |
| 97 | .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16 , | 97 | .max = POW3TO7 * BINOM8ON4 * CLASSES_EOFBEPOS_16, |
| 98 | .trans = transfinder_nxopt31, | 98 | .transfind = transfinder_nxopt31, |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | /* Functions *****************************************************************/ | 101 | /* Functions *****************************************************************/ |
diff --git a/src/trans.h b/src/trans.h index 13d17d8..51df12f 100644 --- a/src/trans.h +++ b/src/trans.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "moves.h" | 4 | #include "moves.h" |
| 5 | 5 | ||
| 6 | /* | 6 | /* |
| 7 | * Tables are exposed to allow faster partial transofrmations in some | 7 | * Tables are exposed to allow faster partial transformations in some |
| 8 | * specific cases (in symcoord) | 8 | * specific cases (in symcoord) |
| 9 | */ | 9 | */ |
| 10 | extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; | 10 | extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; |
