aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2022-03-15 15:54:39 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2022-03-15 15:54:39 +0100
commite18f8e4eefadd733d985e99e2710111afa5a710a (patch)
tree196033c8f04e760b8b6f4d445c70ca17143e0179 /src
parentdef25ea64b097d2a994eb33c91dc66248233afec (diff)
downloadnissy-e18f8e4eefadd733d985e99e2710111afa5a710a.tar.gz
nissy-e18f8e4eefadd733d985e99e2710111afa5a710a.zip
Prepare for big changes in coordinates
Diffstat (limited to 'src')
-rw-r--r--src/cubetypes.h6
-rw-r--r--src/moves.c22
-rw-r--r--src/moves.h15
-rw-r--r--src/pruning.c4
-rw-r--r--src/symcoord.c32
-rw-r--r--src/trans.h2
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
96typedef Cube (*AntiIndexer) (uint64_t); 96typedef Cube (*AntiIndexer) (uint64_t);
97typedef bool (*Checker) (Cube); 97typedef bool (*Checker) (Cube);
98typedef uint64_t (*CoordMover) (Move, uint64_t);
99typedef uint64_t (*CoordTransformer) (Trans, uint64_t);
98typedef int (*Estimator) (DfsArg *); 100typedef int (*Estimator) (DfsArg *);
99typedef bool (*Validator) (Alg *); 101typedef bool (*Validator) (Alg *);
100typedef void (*Exec) (CommandArgs *); 102typedef 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
174struct 178struct
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 */
141static int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 141int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
142static int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 142int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
143static int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8]; 143int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
144static int eofb_mtable[NMOVES][POW2TO11]; 144int eofb_mtable[NMOVES][POW2TO11];
145static int eorl_mtable[NMOVES][POW2TO11]; 145int eorl_mtable[NMOVES][POW2TO11];
146static int eoud_mtable[NMOVES][POW2TO11]; 146int eoud_mtable[NMOVES][POW2TO11];
147static int cp_mtable[NMOVES][FACTORIAL8]; 147int cp_mtable[NMOVES][FACTORIAL8];
148static int coud_mtable[NMOVES][POW3TO7]; 148int coud_mtable[NMOVES][POW3TO7];
149static int cofb_mtable[NMOVES][POW3TO7]; 149int cofb_mtable[NMOVES][POW3TO7];
150static int corl_mtable[NMOVES][POW3TO7]; 150int corl_mtable[NMOVES][POW3TO7];
151static int cpos_mtable[NMOVES][FACTORIAL6]; 151int 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 */
11extern int epose_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
12extern int eposs_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
13extern int eposm_mtable[NMOVES][FACTORIAL12/FACTORIAL8];
14extern int eofb_mtable[NMOVES][POW2TO11];
15extern int eorl_mtable[NMOVES][POW2TO11];
16extern int eoud_mtable[NMOVES][POW2TO11];
17extern int cp_mtable[NMOVES][FACTORIAL8];
18extern int coud_mtable[NMOVES][POW3TO7];
19extern int cofb_mtable[NMOVES][POW3TO7];
20extern int corl_mtable[NMOVES][POW3TO7];
21extern int cpos_mtable[NMOVES][FACTORIAL6];
22
8Cube apply_alg(Alg *alg, Cube cube); 23Cube apply_alg(Alg *alg, Cube cube);
9Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a); 24Cube apply_alg_generic(Alg *alg, Cube c, PieceFilter f, bool a);
10Cube apply_move(Move m, Cube cube); 25Cube 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
65Coordinate 65Coordinate
66coord_eofbepos_sym16 = { 66coord_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
71Coordinate 71Coordinate
72coord_cp_sym16 = { 72coord_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
77Coordinate 77Coordinate
78coord_drud_sym16 = { 78coord_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
85Coordinate 85Coordinate
86coord_drudfin_noE_sym16 = { 86coord_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
93Coordinate 93Coordinate
94coord_nxopt31 = { 94coord_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 */
10extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8]; 10extern int epose_ttable[NTRANS][FACTORIAL12/FACTORIAL8];

Generated with cgit - Back to sebastiano.tronto.net