aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cubetypes.h')
-rw-r--r--src/cubetypes.h176
1 files changed, 87 insertions, 89 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
index ad9c627..cf6b7d5 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -10,6 +10,8 @@
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
13/* Enums *********************************************************************/ 15/* Enums *********************************************************************/
14 16
15typedef enum 17typedef enum
@@ -28,6 +30,12 @@ corner
28} Corner; 30} Corner;
29 31
30typedef enum 32typedef enum
33coordtype
34{
35 COMP_COORD, SYM_COORD, SYMCOMP_COORD
36} CoordType;
37
38typedef enum
31edge 39edge
32{ 40{
33 UF, UL, UB, UR, 41 UF, UL, UB, UR,
@@ -81,28 +89,24 @@ typedef struct command Command;
81typedef struct commandargs CommandArgs; 89typedef struct commandargs CommandArgs;
82typedef struct coordinate Coordinate; 90typedef struct coordinate Coordinate;
83typedef struct cube Cube; 91typedef struct cube Cube;
84typedef struct cubearray CubeArray;
85typedef struct dfsarg DfsArg; 92typedef struct dfsarg DfsArg;
86typedef struct estimatedata EstimateData; 93typedef struct indexer Indexer;
94typedef struct movable Movable;
87typedef struct moveset Moveset; 95typedef struct moveset Moveset;
88typedef struct piecefilter PieceFilter; 96typedef struct pdgendata PDGenData;
89typedef struct prunedata PruneData; 97typedef struct prunedata PruneData;
90typedef struct solveoptions SolveOptions; 98typedef struct solveoptions SolveOptions;
91typedef struct step Step; 99typedef struct step Step;
100typedef struct stepalt StepAlt;
92typedef struct symdata SymData; 101typedef struct symdata SymData;
93typedef struct threaddatasolve ThreadDataSolve; 102typedef struct threaddatasolve ThreadDataSolve;
94typedef struct threaddatagenpt ThreadDataGenpt; 103typedef struct threaddatagenpt ThreadDataGenpt;
104typedef struct transgroup TransGroup;
95 105
96typedef Cube (*AntiIndexer) (uint64_t); 106typedef bool (*Checker) (Cube *);
97typedef bool (*Checker) (Cube);
98typedef uint64_t (*CoordMover) (Move, uint64_t);
99typedef uint64_t (*CoordTransformer) (Trans, uint64_t);
100typedef int (*Estimator) (DfsArg *);
101typedef bool (*Validator) (Alg *); 107typedef bool (*Validator) (Alg *);
102typedef void (*Exec) (CommandArgs *); 108typedef void (*Exec) (CommandArgs *);
103typedef uint64_t (*Indexer) (Cube);
104typedef CommandArgs * (*ArgParser) (int, char **); 109typedef CommandArgs * (*ArgParser) (int, char **);
105typedef int (*TransDetector) (Cube, Trans *);
106typedef int (*TransFinder) (uint64_t, Trans *); 110typedef int (*TransFinder) (uint64_t, Trans *);
107 111
108 112
@@ -167,83 +171,69 @@ commandargs
167struct 171struct
168coordinate 172coordinate
169{ 173{
170 Indexer index; 174 char * name;
175 CoordType type;
176 bool generated;
177 Indexer * i[99];
171 uint64_t max; 178 uint64_t max;
172 CoordMover move; 179 uint64_t * mtable[NMOVES];
173 CoordTransformer transform; 180 uint64_t * ttable[NTRANS];
174 SymData * sd; 181 TransGroup * tgrp;
175 TransFinder tfind; /* TODO: should be easy to remove */ 182 Coordinate * base[2];
176 Coordinate * base; /* TODO: part of refactor */ 183 uint64_t * symclass;
184 uint64_t * symrep;
185 Trans * transtorep;
186 Trans * ttrep_move[NMOVES];
187 uint64_t * selfsim;
177}; 188};
178 189
179struct 190struct
180cube 191cube
181{ 192{
182 int epose; 193 int ep[12];
183 int eposs; 194 int eo[12];
184 int eposm; 195 int cp[8];
185 int eofb; 196 int co[8];
186 int eorl; 197 int xp[6];
187 int eoud;
188 int cp;
189 int coud;
190 int cofb;
191 int corl;
192 int cpos;
193}; 198};
194 199
195struct 200struct
196cubearray 201movable
197{ 202{
198 int * ep; 203 uint64_t val;
199 int * eofb; 204 Trans t;
200 int * eorl;
201 int * eoud;
202 int * cp;
203 int * coud;
204 int * corl;
205 int * cofb;
206 int * cpos;
207}; 205};
208 206
209struct 207struct
210dfsarg 208dfsarg
211{ 209{
212 Step * step; 210 Cube * cube;
213 SolveOptions * opts; 211 Movable ind[MAX_N_COORD];
214 Trans t; 212 Trans t;
215 Cube cube; 213 StepAlt * sa;
216 Cube inverse; 214 SolveOptions * opts;
217 int d; 215 int d;
218 uint64_t badmoves; 216 int bound;
219 uint64_t badmovesinv;
220 bool niss; 217 bool niss;
221 Move last1; 218 Move last[2];
222 Move last2; 219 Move lastinv[2];
223 Move last1inv;
224 Move last2inv;
225 EstimateData * ed;
226 AlgList * sols; 220 AlgList * sols;
227 pthread_mutex_t * sols_mutex; 221 pthread_mutex_t * sols_mutex;
228 Alg * current_alg; 222 Alg * current_alg;
229}; 223};
230 224
231struct 225struct
232estimatedata 226indexer
233{ 227{
234 int corners; 228 int n;
235 int normal_ud; 229 uint64_t (*index)(Cube *);
236 int normal_fb; 230 void (*to_cube)(uint64_t, Cube *);
237 int normal_rl;
238 int inverse_ud;
239 int inverse_fb;
240 int inverse_rl;
241 int oldret;
242}; 231};
243 232
244struct 233struct
245moveset 234moveset
246{ 235{
236 char * name;
247 bool (*allowed)(Move); 237 bool (*allowed)(Move);
248 bool (*allowed_next)(Move, Move, Move); 238 bool (*allowed_next)(Move, Move, Move);
249 Move sorted_moves[NMOVES+1]; 239 Move sorted_moves[NMOVES+1];
@@ -251,34 +241,24 @@ moveset
251}; 241};
252 242
253struct 243struct
254piecefilter 244pdgendata
255{ 245{
256 bool epose; 246 Coordinate * coord;
257 bool eposs; 247 Moveset * moveset;
258 bool eposm; 248 bool compact;
259 bool eofb; 249 PruneData * pd;
260 bool eorl;
261 bool eoud;
262 bool cp;
263 bool coud;
264 bool cofb;
265 bool corl;
266 bool cpos;
267}; 250};
268 251
269struct 252struct
270prunedata 253prunedata
271{ 254{
272 char * filename;
273 entry_group_t * ptable; 255 entry_group_t * ptable;
274 bool generated;
275 uint64_t n; 256 uint64_t n;
276 Coordinate * coord; 257 Coordinate * coord;
277 Moveset * moveset; 258 Moveset * moveset;
278 bool compact; 259 bool compact;
279 int base; 260 int base;
280 uint64_t count[16]; 261 uint64_t count[16];
281 PruneData * fallback;
282 uint64_t fbmod; 262 uint64_t fbmod;
283}; 263};
284 264
@@ -302,19 +282,35 @@ step
302{ 282{
303 char * shortname; 283 char * shortname;
304 char * name; 284 char * name;
305 bool final; 285 StepAlt * alt[99];
306 Checker is_done; 286 Trans t[99];
307 Estimator estimate;
308 Checker ready;
309 char * ready_msg; 287 char * ready_msg;
310 Validator is_valid; 288};
289
290struct
291stepalt
292{
293 Checker ready;
294 bool final;
311 Moveset * moveset; 295 Moveset * moveset;
312 Trans pre_trans; 296 /* Just a comment, (TODO: remove this): moveset is really a stepalt
313 TransDetector detect; 297 * property, because for example we may want to define a "fingertrick
314 int ntables; 298 * friendly ZBLL" step, where we allow either <R U D> or <R U F> as
315 PruneData * tables[10]; 299 * movesets (or similar) */
300 int n_coord;
301 Coordinate * coord[MAX_N_COORD];
302 Trans coord_trans[MAX_N_COORD];
303 PruneData * pd[MAX_N_COORD];
304 bool compact_pd[MAX_N_COORD];
305 Coordinate * fallback_coord[MAX_N_COORD];
306 PruneData * fallback_pd[MAX_N_COORD];
307 uint64_t fbmod[MAX_N_COORD];
308 int n_dbtrick;
309 int dbtrick[MAX_N_COORD][3];
310 Validator is_valid;
316}; 311};
317 312
313/*
318struct 314struct
319symdata 315symdata
320{ 316{
@@ -328,23 +324,18 @@ symdata
328 uint64_t * unsym; 324 uint64_t * unsym;
329 Trans * transtorep; 325 Trans * transtorep;
330 uint64_t * selfsim; 326 uint64_t * selfsim;
331 CoordTransformer transform; /* TODO: remove, use that of base coord */
332}; 327};
328*/
329
333 330
334struct 331struct
335threaddatasolve 332threaddatasolve
336{ 333{
334 DfsArg arg;
337 int thid; 335 int thid;
338 Trans t;
339 Cube cube;
340 Step * step;
341 int depth;
342 SolveOptions * opts;
343 AlgList * start; 336 AlgList * start;
344 AlgListNode ** node; 337 AlgListNode ** node;
345 AlgList * sols;
346 pthread_mutex_t * start_mutex; 338 pthread_mutex_t * start_mutex;
347 pthread_mutex_t * sols_mutex;
348}; 339};
349 340
350struct 341struct
@@ -359,4 +350,11 @@ threaddatagenpt
359 pthread_mutex_t * upmutex; 350 pthread_mutex_t * upmutex;
360}; 351};
361 352
353struct
354transgroup
355{
356 int n;
357 Trans t[NTRANS];
358};
359
362#endif 360#endif

Generated with cgit - Back to sebastiano.tronto.net