aboutsummaryrefslogtreecommitdiff
path: root/old/2021-07-02-genptable-dfs/cubetypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'old/2021-07-02-genptable-dfs/cubetypes.h')
-rw-r--r--old/2021-07-02-genptable-dfs/cubetypes.h250
1 files changed, 250 insertions, 0 deletions
diff --git a/old/2021-07-02-genptable-dfs/cubetypes.h b/old/2021-07-02-genptable-dfs/cubetypes.h
new file mode 100644
index 0000000..a324985
--- /dev/null
+++ b/old/2021-07-02-genptable-dfs/cubetypes.h
@@ -0,0 +1,250 @@
1#ifndef CUBETYPES_H
2#define CUBETYPES_H
3
4/* Typedefs ******************************************************************/
5
6typedef enum center Center;
7typedef enum corner Corner;
8typedef enum edge Edge;
9typedef enum move Move;
10typedef enum trans Trans;
11
12typedef struct alg Alg;
13typedef struct alglist AlgList;
14typedef struct alglistnode AlgListNode;
15typedef struct block Block;
16typedef struct coordinate Coordinate;
17typedef struct cube Cube;
18typedef struct cubearray CubeArray;
19typedef struct cubetarget CubeTarget;
20typedef struct dfsdata DfsData;
21typedef struct piecefilter PieceFilter;
22typedef struct prunedata PruneData;
23typedef struct solveoptions SolveOptions;
24typedef struct step Step;
25typedef struct symdata SymData;
26
27typedef Cube (*AntiIndexer) (uint64_t);
28typedef bool (*Checker) (Cube);
29typedef int (*Estimator) (CubeTarget);
30typedef uint64_t (*Indexer) (Cube);
31typedef bool (*Moveset) (Move);
32
33
34/* Enums *********************************************************************/
35
36enum
37center
38{
39 U_center, D_center,
40 R_center, L_center,
41 F_center, B_center
42};
43
44enum
45corner
46{
47 UFR, UFL, UBL, UBR,
48 DFR, DFL, DBL, DBR
49};
50
51enum
52edge
53{
54 UF, UL, UB, UR,
55 DF, DL, DB, DR,
56 FR, FL, BL, BR
57};
58
59enum
60move
61{
62 NULLMOVE,
63 U, U2, U3, D, D2, D3,
64 R, R2, R3, L, L2, L3,
65 F, F2, F3, B, B2, B3,
66 Uw, Uw2, Uw3, Dw, Dw2, Dw3,
67 Rw, Rw2, Rw3, Lw, Lw2, Lw3,
68 Fw, Fw2, Fw3, Bw, Bw2, Bw3,
69 M, M2, M3,
70 S, S2, S3,
71 E, E2, E3,
72 x, x2, x3,
73 y, y2, y3,
74 z, z2, z3,
75};
76
77enum
78trans
79{
80 uf, ur, ub, ul,
81 df, dr, db, dl,
82 rf, rd, rb, ru,
83 lf, ld, lb, lu,
84 fu, fr, fd, fl,
85 bu, br, bd, bl,
86 uf_mirror, ur_mirror, ub_mirror, ul_mirror,
87 df_mirror, dr_mirror, db_mirror, dl_mirror,
88 rf_mirror, rd_mirror, rb_mirror, ru_mirror,
89 lf_mirror, ld_mirror, lb_mirror, lu_mirror,
90 fu_mirror, fr_mirror, fd_mirror, fl_mirror,
91 bu_mirror, br_mirror, bd_mirror, bl_mirror,
92};
93
94
95/* Structs *******************************************************************/
96
97struct
98alg
99{
100 Move * move;
101 bool * inv;
102 int len;
103 int allocated;
104};
105
106struct
107alglist
108{
109 AlgListNode * first;
110 AlgListNode * last;
111 int len;
112};
113
114struct
115alglistnode
116{
117 Alg * alg;
118 AlgListNode * next;
119};
120
121struct
122block
123{
124 bool edge[12];
125 bool corner[8];
126 bool center[6];
127};
128
129struct
130coordinate
131{
132 Indexer index;
133 AntiIndexer cube;
134 Checker check;
135 uint64_t max;
136};
137
138struct
139cube
140{
141 int epose;
142 int eposs;
143 int eposm;
144 int eofb;
145 int eorl;
146 int eoud;
147 int cp;
148 int coud;
149 int cofb;
150 int corl;
151 int cpos;
152};
153
154struct
155cubearray
156{
157 int * ep;
158 int * eofb;
159 int * eorl;
160 int * eoud;
161 int * cp;
162 int * coud;
163 int * corl;
164 int * cofb;
165 int * cpos;
166};
167
168struct
169cubetarget
170{
171 Cube cube;
172 int target;
173};
174
175struct
176dfsdata
177{
178 int d;
179 int m;
180 int lb;
181 bool niss;
182 Move last1;
183 Move last2;
184 AlgList * sols;
185 Alg * current_alg;
186 Move sorted_moves[NMOVES];
187 int move_position[NMOVES];
188};
189
190struct
191piecefilter
192{
193 bool epose;
194 bool eposs;
195 bool eposm;
196 bool eofb;
197 bool eorl;
198 bool eoud;
199 bool cp;
200 bool coud;
201 bool cofb;
202 bool corl;
203 bool cpos;
204};
205
206struct
207prunedata
208{
209 char * filename;
210 uint8_t * ptable;
211 bool generated;
212 uint64_t n;
213 Coordinate * coord;
214 Moveset moveset;
215};
216
217struct
218solveoptions
219{
220 int min_moves;
221 int max_moves;
222 int max_solutions;
223 bool optimal_only;
224 bool can_niss;
225 bool feedback;
226};
227
228struct
229step
230{
231 Estimator estimate;
232 Checker ready;
233 Moveset moveset;
234};
235
236struct
237symdata
238{
239 char * filename;
240 bool generated;
241 Coordinate * coord;
242 Coordinate * sym_coord;
243 int ntrans;
244 Trans * trans;
245 uint64_t * class;
246 Cube * rep;
247 Trans * transtorep;
248};
249
250#endif

Generated with cgit - Back to sebastiano.tronto.net