aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cubetypes.h')
-rw-r--r--src/cubetypes.h360
1 files changed, 0 insertions, 360 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
deleted file mode 100644
index 3752019..0000000
--- a/src/cubetypes.h
+++ /dev/null
@@ -1,360 +0,0 @@
1#ifndef CUBETYPES_H
2#define CUBETYPES_H
3
4#include <stdbool.h>
5#include <inttypes.h>
6#include <pthread.h>
7
8#define NMOVES 55 /* Actually 54, but one is NULLMOVE */
9#define NTRANS 48
10#define NROTATIONS 24
11#define entry_group_t uint8_t /* For pruning tables */
12
13#define MAX_N_COORD 6
14
15/* Enums *********************************************************************/
16
17typedef enum
18center
19{
20 U_center, D_center,
21 R_center, L_center,
22 F_center, B_center
23} Center;
24
25typedef enum
26corner
27{
28 UFR, UFL, UBL, UBR,
29 DFR, DFL, DBL, DBR
30} Corner;
31
32typedef enum
33coordtype
34{
35 COMP_COORD, SYM_COORD, SYMCOMP_COORD
36} CoordType;
37
38typedef enum
39edge
40{
41 UF, UL, UB, UR,
42 DF, DL, DB, DR,
43 FR, FL, BL, BR
44} Edge;
45
46typedef enum
47move
48{
49 NULLMOVE,
50 U, U2, U3, D, D2, D3,
51 R, R2, R3, L, L2, L3,
52 F, F2, F3, B, B2, B3,
53 Uw, Uw2, Uw3, Dw, Dw2, Dw3,
54 Rw, Rw2, Rw3, Lw, Lw2, Lw3,
55 Fw, Fw2, Fw3, Bw, Bw2, Bw3,
56 M, M2, M3,
57 S, S2, S3,
58 E, E2, E3,
59 x, x2, x3,
60 y, y2, y3,
61 z, z2, z3,
62} Move;
63
64typedef enum
65trans
66{
67 uf, ur, ub, ul,
68 df, dr, db, dl,
69 rf, rd, rb, ru,
70 lf, ld, lb, lu,
71 fu, fr, fd, fl,
72 bu, br, bd, bl,
73 uf_mirror, ur_mirror, ub_mirror, ul_mirror,
74 df_mirror, dr_mirror, db_mirror, dl_mirror,
75 rf_mirror, rd_mirror, rb_mirror, ru_mirror,
76 lf_mirror, ld_mirror, lb_mirror, lu_mirror,
77 fu_mirror, fr_mirror, fd_mirror, fl_mirror,
78 bu_mirror, br_mirror, bd_mirror, bl_mirror,
79} Trans;
80
81
82/* Typedefs ******************************************************************/
83
84typedef struct alg Alg;
85typedef struct alglist AlgList;
86typedef struct alglistnode AlgListNode;
87typedef struct choicestep ChoiceStep;
88typedef struct command Command;
89typedef struct commandargs CommandArgs;
90typedef struct coordinate Coordinate;
91typedef struct cube Cube;
92/*typedef struct dfsarg DfsArg;*/
93typedef struct fstcube FstCube;
94typedef struct indexer Indexer;
95typedef struct movable Movable;
96typedef struct moveset Moveset;
97typedef struct prunedata PruneData;
98typedef struct solveoptions SolveOptions;
99typedef struct step Step;
100typedef struct symdata SymData;
101typedef struct threaddatasolve ThreadDataSolve;
102typedef struct threaddatagenpt ThreadDataGenpt;
103typedef struct transgroup TransGroup;
104
105typedef bool (*Checker) (Cube *);
106typedef bool (*CubeTester) (Cube *, Alg *);
107/*typedef bool (*DfsMover) (DfsArg *);*/
108typedef void (*DfsExtraCopier) (void *, void *);
109typedef Alg * (*Validator) (Alg *);
110typedef void (*Exec) (CommandArgs *);
111typedef CommandArgs * (*ArgParser) (int, char **);
112typedef bool (*Tester) (void);
113typedef int (*TransFinder) (uint64_t, Trans *);
114
115
116/* Structs *******************************************************************/
117
118struct
119alg
120{
121 Move * move;
122 bool * inv;
123 int len;
124 int allocated;
125 Move * move_normal;
126 int len_normal;
127 Move * move_inverse;
128 int len_inverse;
129};
130
131struct
132alglist
133{
134 AlgListNode * first;
135 AlgListNode * last;
136 int len;
137};
138
139struct
140alglistnode
141{
142 Alg * alg;
143 AlgListNode * next;
144};
145
146struct
147choicestep
148{
149 char * shortname;
150 char * name;
151 Step * step[99];
152 Trans t[99];
153 char * ready_msg;
154};
155
156struct
157command
158{
159 char * name;
160 char * usage;
161 char * description;
162 ArgParser parse_args;
163 Exec exec;
164};
165
166struct
167commandargs
168{
169 bool success;
170 Alg * scramble;
171 SolveOptions * opts;
172 ChoiceStep * cs;
173 Command * command; /* For help */
174 int n;
175 char scrtype[20];
176 bool scrstdin;
177 bool header;
178};
179
180struct
181coordinate
182{
183 char * name;
184 CoordType type;
185 bool generated;
186 Indexer * i[99];
187 uint64_t max;
188 uint64_t * mtable[NMOVES];
189 uint64_t * ttable[NTRANS];
190 TransGroup * tgrp;
191 Coordinate * base[2];
192 uint64_t * symclass;
193 uint64_t * symrep;
194 Trans * transtorep;
195 Trans * ttrep_move[NMOVES];
196 uint64_t * selfsim;
197};
198
199struct
200cube
201{
202 int ep[12];
203 int eo[12];
204 int cp[8];
205 int co[8];
206 int xp[6];
207};
208
209/*
210struct
211movable
212{
213 uint64_t val;
214 Trans t;
215};
216*/
217
218/*
219struct
220dfsarg
221{
222 Cube * cube;
223 Movable ind[MAX_N_COORD];
224 Trans t;
225 Step * s;
226 SolveOptions * opts;
227 int d;
228 int bound;
229 bool niss;
230 AlgList * sols;
231 pthread_mutex_t * sols_mutex;
232 Alg * current_alg;
233 void * extra;
234};
235*/
236
237/*
238struct
239dfsarg
240{
241 void * cube_data;
242 SolveOptions * opts;
243 int d;
244 int bound;
245 bool niss;
246 AlgList * sols;
247 Alg * current_alg;
248 Solver * solver;
249 Threader * threader;
250};
251*/
252
253struct
254fstcube
255{
256 uint16_t uf_eofb;
257 uint16_t uf_eposepe;
258 uint16_t uf_coud;
259 uint16_t uf_cp;
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};
267
268struct
269indexer
270{
271 int n;
272 uint64_t (*index)(Cube *);
273 void (*to_cube)(uint64_t, Cube *);
274};
275
276struct
277moveset
278{
279 char * name;
280 bool (*allowed)(Move);
281 bool (*can_append)(Alg *, Move, bool);
282 bool (*cancel_niss)(Alg *);
283 Move sorted_moves[NMOVES+1];
284};
285
286struct
287prunedata
288{
289 entry_group_t * ptable;
290 uint64_t n;
291 Coordinate * coord;
292 Moveset * moveset;
293 uint64_t count[16];
294 bool compact;
295 int base;
296};
297
298struct
299solveoptions
300{
301 int min_moves;
302 int max_moves;
303 int max_solutions;
304 int nthreads;
305 int optimal;
306 bool can_niss;
307 bool verbose;
308 bool all;
309 bool print_number;
310 bool count_only;
311};
312
313struct
314step
315{
316 Checker ready;
317 bool final;
318 Moveset * moveset;
319 int n_coord;
320 Coordinate * coord[MAX_N_COORD];
321 Trans coord_trans[MAX_N_COORD];
322 PruneData * pd[MAX_N_COORD];
323 bool pd_compact[MAX_N_COORD];
324 Validator is_valid;
325 /*DfsMover custom_move_checkstop;*/
326 DfsExtraCopier copy_extra;
327};
328
329/*
330struct
331threaddatasolve
332{
333 DfsArg arg;
334 int thid;
335 AlgList * start;
336 AlgListNode ** node;
337 pthread_mutex_t * start_mutex;
338};
339*/
340
341struct
342threaddatagenpt
343{
344 int thid;
345 int nthreads;
346 PruneData * pd;
347 int d;
348 int nchunks;
349 pthread_mutex_t ** mutex;
350 pthread_mutex_t * upmutex;
351};
352
353struct
354transgroup
355{
356 int n;
357 Trans t[NTRANS];
358};
359
360#endif

Generated with cgit - Back to sebastiano.tronto.net