aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cubetypes.h')
-rw-r--r--src/cubetypes.h240
1 files changed, 121 insertions, 119 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
index 3752019..ad9c627 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -10,8 +10,6 @@
10#define NROTATIONS 24 10#define NROTATIONS 24
11#define entry_group_t uint8_t /* For pruning tables */ 11#define entry_group_t uint8_t /* For pruning tables */
12 12
13#define MAX_N_COORD 6
14
15/* Enums *********************************************************************/ 13/* Enums *********************************************************************/
16 14
17typedef enum 15typedef enum
@@ -30,12 +28,6 @@ corner
30} Corner; 28} Corner;
31 29
32typedef enum 30typedef enum
33coordtype
34{
35 COMP_COORD, SYM_COORD, SYMCOMP_COORD
36} CoordType;
37
38typedef enum
39edge 31edge
40{ 32{
41 UF, UL, UB, UR, 33 UF, UL, UB, UR,
@@ -84,32 +76,33 @@ trans
84typedef struct alg Alg; 76typedef struct alg Alg;
85typedef struct alglist AlgList; 77typedef struct alglist AlgList;
86typedef struct alglistnode AlgListNode; 78typedef struct alglistnode AlgListNode;
87typedef struct choicestep ChoiceStep; 79typedef struct block Block;
88typedef struct command Command; 80typedef struct command Command;
89typedef struct commandargs CommandArgs; 81typedef struct commandargs CommandArgs;
90typedef struct coordinate Coordinate; 82typedef struct coordinate Coordinate;
91typedef struct cube Cube; 83typedef struct cube Cube;
92/*typedef struct dfsarg DfsArg;*/ 84typedef struct cubearray CubeArray;
93typedef struct fstcube FstCube; 85typedef struct dfsarg DfsArg;
94typedef struct indexer Indexer; 86typedef struct estimatedata EstimateData;
95typedef struct movable Movable;
96typedef struct moveset Moveset; 87typedef struct moveset Moveset;
88typedef struct piecefilter PieceFilter;
97typedef struct prunedata PruneData; 89typedef struct prunedata PruneData;
98typedef struct solveoptions SolveOptions; 90typedef struct solveoptions SolveOptions;
99typedef struct step Step; 91typedef struct step Step;
100typedef struct symdata SymData; 92typedef struct symdata SymData;
101typedef struct threaddatasolve ThreadDataSolve; 93typedef struct threaddatasolve ThreadDataSolve;
102typedef struct threaddatagenpt ThreadDataGenpt; 94typedef struct threaddatagenpt ThreadDataGenpt;
103typedef struct transgroup TransGroup;
104 95
105typedef bool (*Checker) (Cube *); 96typedef Cube (*AntiIndexer) (uint64_t);
106typedef bool (*CubeTester) (Cube *, Alg *); 97typedef bool (*Checker) (Cube);
107/*typedef bool (*DfsMover) (DfsArg *);*/ 98typedef uint64_t (*CoordMover) (Move, uint64_t);
108typedef void (*DfsExtraCopier) (void *, void *); 99typedef uint64_t (*CoordTransformer) (Trans, uint64_t);
109typedef Alg * (*Validator) (Alg *); 100typedef int (*Estimator) (DfsArg *);
101typedef bool (*Validator) (Alg *);
110typedef void (*Exec) (CommandArgs *); 102typedef void (*Exec) (CommandArgs *);
103typedef uint64_t (*Indexer) (Cube);
111typedef CommandArgs * (*ArgParser) (int, char **); 104typedef CommandArgs * (*ArgParser) (int, char **);
112typedef bool (*Tester) (void); 105typedef int (*TransDetector) (Cube, Trans *);
113typedef int (*TransFinder) (uint64_t, Trans *); 106typedef int (*TransFinder) (uint64_t, Trans *);
114 107
115 108
@@ -122,10 +115,6 @@ alg
122 bool * inv; 115 bool * inv;
123 int len; 116 int len;
124 int allocated; 117 int allocated;
125 Move * move_normal;
126 int len_normal;
127 Move * move_inverse;
128 int len_inverse;
129}; 118};
130 119
131struct 120struct
@@ -144,13 +133,11 @@ alglistnode
144}; 133};
145 134
146struct 135struct
147choicestep 136block
148{ 137{
149 char * shortname; 138 bool edge[12];
150 char * name; 139 bool corner[8];
151 Step * step[99]; 140 bool center[6];
152 Trans t[99];
153 char * ready_msg;
154}; 141};
155 142
156struct 143struct
@@ -169,7 +156,7 @@ commandargs
169 bool success; 156 bool success;
170 Alg * scramble; 157 Alg * scramble;
171 SolveOptions * opts; 158 SolveOptions * opts;
172 ChoiceStep * cs; 159 Step * step;
173 Command * command; /* For help */ 160 Command * command; /* For help */
174 int n; 161 int n;
175 char scrtype[20]; 162 char scrtype[20];
@@ -180,119 +167,119 @@ commandargs
180struct 167struct
181coordinate 168coordinate
182{ 169{
183 char * name; 170 Indexer index;
184 CoordType type;
185 bool generated;
186 Indexer * i[99];
187 uint64_t max; 171 uint64_t max;
188 uint64_t * mtable[NMOVES]; 172 CoordMover move;
189 uint64_t * ttable[NTRANS]; 173 CoordTransformer transform;
190 TransGroup * tgrp; 174 SymData * sd;
191 Coordinate * base[2]; 175 TransFinder tfind; /* TODO: should be easy to remove */
192 uint64_t * symclass; 176 Coordinate * base; /* TODO: part of refactor */
193 uint64_t * symrep;
194 Trans * transtorep;
195 Trans * ttrep_move[NMOVES];
196 uint64_t * selfsim;
197}; 177};
198 178
199struct 179struct
200cube 180cube
201{ 181{
202 int ep[12]; 182 int epose;
203 int eo[12]; 183 int eposs;
204 int cp[8]; 184 int eposm;
205 int co[8]; 185 int eofb;
206 int xp[6]; 186 int eorl;
187 int eoud;
188 int cp;
189 int coud;
190 int cofb;
191 int corl;
192 int cpos;
207}; 193};
208 194
209/*
210struct 195struct
211movable 196cubearray
212{ 197{
213 uint64_t val; 198 int * ep;
214 Trans t; 199 int * eofb;
200 int * eorl;
201 int * eoud;
202 int * cp;
203 int * coud;
204 int * corl;
205 int * cofb;
206 int * cpos;
215}; 207};
216*/
217 208
218/*
219struct 209struct
220dfsarg 210dfsarg
221{ 211{
222 Cube * cube; 212 Step * step;
223 Movable ind[MAX_N_COORD];
224 Trans t;
225 Step * s;
226 SolveOptions * opts; 213 SolveOptions * opts;
214 Trans t;
215 Cube cube;
216 Cube inverse;
227 int d; 217 int d;
228 int bound; 218 uint64_t badmoves;
219 uint64_t badmovesinv;
229 bool niss; 220 bool niss;
221 Move last1;
222 Move last2;
223 Move last1inv;
224 Move last2inv;
225 EstimateData * ed;
230 AlgList * sols; 226 AlgList * sols;
231 pthread_mutex_t * sols_mutex; 227 pthread_mutex_t * sols_mutex;
232 Alg * current_alg; 228 Alg * current_alg;
233 void * extra;
234}; 229};
235*/
236 230
237/*
238struct 231struct
239dfsarg 232estimatedata
240{ 233{
241 void * cube_data; 234 int corners;
242 SolveOptions * opts; 235 int normal_ud;
243 int d; 236 int normal_fb;
244 int bound; 237 int normal_rl;
245 bool niss; 238 int inverse_ud;
246 AlgList * sols; 239 int inverse_fb;
247 Alg * current_alg; 240 int inverse_rl;
248 Solver * solver; 241 int oldret;
249 Threader * threader;
250}; 242};
251*/
252 243
253struct 244struct
254fstcube 245moveset
255{ 246{
256 uint16_t uf_eofb; 247 bool (*allowed)(Move);
257 uint16_t uf_eposepe; 248 bool (*allowed_next)(Move, Move, Move);
258 uint16_t uf_coud; 249 Move sorted_moves[NMOVES+1];
259 uint16_t uf_cp; 250 uint64_t mask[NMOVES][NMOVES];
260 uint16_t fr_eofb;
261 uint16_t fr_eposepe;
262 uint16_t fr_coud;
263 uint16_t rd_eofb;
264 uint16_t rd_eposepe;
265 uint16_t rd_coud;
266}; 251};
267 252
268struct 253struct
269indexer 254piecefilter
270{ 255{
271 int n; 256 bool epose;
272 uint64_t (*index)(Cube *); 257 bool eposs;
273 void (*to_cube)(uint64_t, Cube *); 258 bool eposm;
274}; 259 bool eofb;
275 260 bool eorl;
276struct 261 bool eoud;
277moveset 262 bool cp;
278{ 263 bool coud;
279 char * name; 264 bool cofb;
280 bool (*allowed)(Move); 265 bool corl;
281 bool (*can_append)(Alg *, Move, bool); 266 bool cpos;
282 bool (*cancel_niss)(Alg *);
283 Move sorted_moves[NMOVES+1];
284}; 267};
285 268
286struct 269struct
287prunedata 270prunedata
288{ 271{
272 char * filename;
289 entry_group_t * ptable; 273 entry_group_t * ptable;
274 bool generated;
290 uint64_t n; 275 uint64_t n;
291 Coordinate * coord; 276 Coordinate * coord;
292 Moveset * moveset; 277 Moveset * moveset;
293 uint64_t count[16];
294 bool compact; 278 bool compact;
295 int base; 279 int base;
280 uint64_t count[16];
281 PruneData * fallback;
282 uint64_t fbmod;
296}; 283};
297 284
298struct 285struct
@@ -313,30 +300,52 @@ solveoptions
313struct 300struct
314step 301step
315{ 302{
316 Checker ready; 303 char * shortname;
304 char * name;
317 bool final; 305 bool final;
318 Moveset * moveset; 306 Checker is_done;
319 int n_coord; 307 Estimator estimate;
320 Coordinate * coord[MAX_N_COORD]; 308 Checker ready;
321 Trans coord_trans[MAX_N_COORD]; 309 char * ready_msg;
322 PruneData * pd[MAX_N_COORD];
323 bool pd_compact[MAX_N_COORD];
324 Validator is_valid; 310 Validator is_valid;
325 /*DfsMover custom_move_checkstop;*/ 311 Moveset * moveset;
326 DfsExtraCopier copy_extra; 312 Trans pre_trans;
313 TransDetector detect;
314 int ntables;
315 PruneData * tables[10];
316};
317
318struct
319symdata
320{
321 char * filename;
322 bool generated;
323 Coordinate * coord;
324 Coordinate * sym_coord;
325 int ntrans;
326 Trans * trans;
327 uint64_t * class;
328 uint64_t * unsym;
329 Trans * transtorep;
330 uint64_t * selfsim;
331 CoordTransformer transform; /* TODO: remove, use that of base coord */
327}; 332};
328 333
329/*
330struct 334struct
331threaddatasolve 335threaddatasolve
332{ 336{
333 DfsArg arg;
334 int thid; 337 int thid;
338 Trans t;
339 Cube cube;
340 Step * step;
341 int depth;
342 SolveOptions * opts;
335 AlgList * start; 343 AlgList * start;
336 AlgListNode ** node; 344 AlgListNode ** node;
345 AlgList * sols;
337 pthread_mutex_t * start_mutex; 346 pthread_mutex_t * start_mutex;
347 pthread_mutex_t * sols_mutex;
338}; 348};
339*/
340 349
341struct 350struct
342threaddatagenpt 351threaddatagenpt
@@ -350,11 +359,4 @@ threaddatagenpt
350 pthread_mutex_t * upmutex; 359 pthread_mutex_t * upmutex;
351}; 360};
352 361
353struct
354transgroup
355{
356 int n;
357 Trans t[NTRANS];
358};
359
360#endif 362#endif

Generated with cgit - Back to sebastiano.tronto.net