aboutsummaryrefslogtreecommitdiff
path: root/old/2021-06-15-before-separating-steps/cubetypes.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
commit3568412f8f230774d0d11d7ed1c897424f95d3ef (patch)
tree77223792d8c925a9b1fc32b3f4341e943b5f8209 /old/2021-06-15-before-separating-steps/cubetypes.h
parent67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff)
downloadnissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz
nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-06-15-before-separating-steps/cubetypes.h')
-rw-r--r--old/2021-06-15-before-separating-steps/cubetypes.h201
1 files changed, 201 insertions, 0 deletions
diff --git a/old/2021-06-15-before-separating-steps/cubetypes.h b/old/2021-06-15-before-separating-steps/cubetypes.h
new file mode 100644
index 0000000..6ba3675
--- /dev/null
+++ b/old/2021-06-15-before-separating-steps/cubetypes.h
@@ -0,0 +1,201 @@
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 block Block;
13typedef struct cube Cube;
14typedef struct cubearray CubeArray;
15typedef struct dfsdata DfsData;
16typedef struct piecefilter PieceFilter;
17typedef struct prunedata PruneData;
18typedef struct solveoptions SolveOptions;
19typedef struct step Step;
20
21/* Enums *********************************************************************/
22
23enum
24center
25{
26 U_center, D_center,
27 R_center, L_center,
28 F_center, B_center
29};
30
31enum
32corner
33{
34 UFR, UFL, UBL, UBR,
35 DFR, DFL, DBL, DBR
36};
37
38enum
39edge
40{
41 UF, UL, UB, UR,
42 DF, DL, DB, DR,
43 FR, FL, BL, BR
44};
45
46enum
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};
63
64enum
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 mirror, /* R|L */
74};
75
76
77/* Structs *******************************************************************/
78
79struct
80alg
81{
82 Move * move;
83 bool * inv;
84 int len;
85 int allocated;
86};
87
88struct
89alglist
90{
91 AlgListNode * first;
92 AlgListNode * last;
93 int len;
94};
95
96struct
97alglistnode
98{
99 Alg * alg;
100 AlgListNode * next;
101};
102
103struct
104block
105{
106 bool edge[12];
107 bool corner[8];
108 bool center[6];
109};
110
111struct
112cube
113{
114 uint16_t epose;
115 uint16_t eposs;
116 uint16_t eposm;
117 uint16_t eofb;
118 uint16_t eorl;
119 uint16_t eoud;
120 uint16_t cp;
121 uint16_t coud;
122 uint16_t cofb;
123 uint16_t corl;
124 uint16_t cpos;
125};
126
127struct
128cubearray
129{
130 int * ep;
131 int * eofb;
132 int * eorl;
133 int * eoud;
134 int * cp;
135 int * coud;
136 int * corl;
137 int * cofb;
138 int * cpos;
139};
140
141struct
142dfsdata
143{
144 int d;
145 int m;
146 bool niss;
147 Move last1;
148 Move last2;
149 AlgList * sols;
150 Alg * current_alg;
151 Move sorted_moves[z3+1];
152};
153
154struct
155piecefilter
156{
157 bool epose;
158 bool eposs;
159 bool eposm;
160 bool eofb;
161 bool eorl;
162 bool eoud;
163 bool cp;
164 bool coud;
165 bool cofb;
166 bool corl;
167 bool cpos;
168};
169
170struct
171prunedata
172{
173 char * filename;
174 uint8_t * ptable;
175 uint8_t * reached;
176 bool generated;
177 uint64_t n;
178 uint64_t size;
179 uint64_t (*index)(Cube);
180 bool (*moveset)(Move);
181};
182
183struct
184solveoptions
185{
186 int min_moves;
187 int max_moves;
188 int max_solutions;
189 bool optimal_only;
190 bool can_niss;
191 bool feedback;
192};
193
194struct
195step
196{
197 int (*check)(Cube);
198 int (*ready)(Cube);
199 bool (*moveset)(Move);
200 Trans pre_trans;
201};

Generated with cgit - Back to sebastiano.tronto.net