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

Generated with cgit - Back to sebastiano.tronto.net