aboutsummaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
Diffstat (limited to 'old')
-rw-r--r--old/_trans_move_arr.c389
-rw-r--r--old/gendata_bfs_attempt.c153
-rw-r--r--old/inverse_fast.c51
-rw-r--r--old/inverses.c71
-rwxr-xr-xold/moves_trans/genmovecode.sh19
-rwxr-xr-xold/moves_trans/gentranscode.sh42
-rw-r--r--old/moves_trans/moves_src.c264
-rwxr-xr-xold/moves_trans/v2/genmovecode.sh21
-rwxr-xr-xold/moves_trans/v2/gentranscode.sh24
9 files changed, 0 insertions, 1034 deletions
diff --git a/old/_trans_move_arr.c b/old/_trans_move_arr.c
deleted file mode 100644
index a00105f..0000000
--- a/old/_trans_move_arr.c
+++ /dev/null
@@ -1,389 +0,0 @@
1static cube_t trans_move_cube[] = {
2 [UFr] = {
3 .c = {0, 1, 2, 3, 4, 5, 6, 7},
4 .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
5 },
6 [ULr] = {
7 .c = {4, 5, 7, 6, 1, 0, 2, 3},
8 .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
9 },
10 [UBr] = {
11 .c = {1, 0, 3, 2, 5, 4, 7, 6},
12 .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
13 },
14 [URr] = {
15 .c = {5, 4, 6, 7, 0, 1, 3, 2},
16 .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
17 },
18 [DFr] = {
19 .c = {2, 3, 0, 1, 6, 7, 4, 5},
20 .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
21 },
22 [DLr] = {
23 .c = {7, 6, 4, 5, 2, 3, 1, 0},
24 .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
25 },
26 [DBr] = {
27 .c = {3, 2, 1, 0, 7, 6, 5, 4},
28 .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
29 },
30 [DRr] = {
31 .c = {6, 7, 5, 4, 3, 2, 0, 1},
32 .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
33 },
34 [RUr] = {
35 .c = {64, 67, 65, 66, 37, 38, 36, 39},
36 .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
37 },
38 [RFr] = {
39 .c = {38, 37, 36, 39, 64, 67, 66, 65},
40 .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
41 },
42 [RDr] = {
43 .c = {67, 64, 66, 65, 38, 37, 39, 36},
44 .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
45 },
46 [RBr] = {
47 .c = {37, 38, 39, 36, 67, 64, 65, 66},
48 .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
49 },
50 [LUr] = {
51 .c = {65, 66, 64, 67, 36, 39, 37, 38},
52 .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
53 },
54 [LFr] = {
55 .c = {36, 39, 38, 37, 66, 65, 64, 67},
56 .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
57 },
58 [LDr] = {
59 .c = {66, 65, 67, 64, 39, 36, 38, 37},
60 .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
61 },
62 [LBr] = {
63 .c = {39, 36, 37, 38, 65, 66, 67, 64},
64 .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
65 },
66 [FUr] = {
67 .c = {68, 70, 69, 71, 32, 34, 33, 35},
68 .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
69 },
70 [FRr] = {
71 .c = {32, 34, 35, 33, 70, 68, 69, 71},
72 .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
73 },
74 [FDr] = {
75 .c = {70, 68, 71, 69, 34, 32, 35, 33},
76 .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
77 },
78 [FLr] = {
79 .c = {34, 32, 33, 35, 68, 70, 71, 69},
80 .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
81 },
82 [BUr] = {
83 .c = {69, 71, 68, 70, 33, 35, 32, 34},
84 .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
85 },
86 [BRr] = {
87 .c = {35, 33, 32, 34, 69, 71, 70, 68},
88 .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
89 },
90 [BDr] = {
91 .c = {71, 69, 70, 68, 35, 33, 34, 32},
92 .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
93 },
94 [BLr] = {
95 .c = {33, 35, 34, 32, 71, 69, 68, 70},
96 .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
97 },
98 [UFm] = {
99 .c = {4, 5, 6, 7, 0, 1, 2, 3},
100 .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
101 },
102 [ULm] = {
103 .c = {0, 1, 3, 2, 5, 4, 6, 7},
104 .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
105 },
106 [UBm] = {
107 .c = {5, 4, 7, 6, 1, 0, 3, 2},
108 .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
109 },
110 [URm] = {
111 .c = {1, 0, 2, 3, 4, 5, 7, 6},
112 .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
113 },
114 [DFm] = {
115 .c = {6, 7, 4, 5, 2, 3, 0, 1},
116 .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
117 },
118 [DLm] = {
119 .c = {3, 2, 0, 1, 6, 7, 5, 4},
120 .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
121 },
122 [DBm] = {
123 .c = {7, 6, 5, 4, 3, 2, 1, 0},
124 .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
125 },
126 [DRm] = {
127 .c = {2, 3, 1, 0, 7, 6, 4, 5},
128 .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
129 },
130 [RUm] = {
131 .c = {68, 71, 69, 70, 33, 34, 32, 35},
132 .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
133 },
134 [RFm] = {
135 .c = {34, 33, 32, 35, 68, 71, 70, 69},
136 .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
137 },
138 [RDm] = {
139 .c = {71, 68, 70, 69, 34, 33, 35, 32},
140 .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
141 },
142 [RBm] = {
143 .c = {33, 34, 35, 32, 71, 68, 69, 70},
144 .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
145 },
146 [LUm] = {
147 .c = {69, 70, 68, 71, 32, 35, 33, 34},
148 .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
149 },
150 [LFm] = {
151 .c = {32, 35, 34, 33, 70, 69, 68, 71},
152 .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
153 },
154 [LDm] = {
155 .c = {70, 69, 71, 68, 35, 32, 34, 33},
156 .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
157 },
158 [LBm] = {
159 .c = {35, 32, 33, 34, 69, 70, 71, 68},
160 .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
161 },
162 [FUm] = {
163 .c = {64, 66, 65, 67, 36, 38, 37, 39},
164 .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
165 },
166 [FRm] = {
167 .c = {36, 38, 39, 37, 66, 64, 65, 67},
168 .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
169 },
170 [FDm] = {
171 .c = {66, 64, 67, 65, 38, 36, 39, 37},
172 .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
173 },
174 [FLm] = {
175 .c = {38, 36, 37, 39, 64, 66, 67, 65},
176 .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
177 },
178 [BUm] = {
179 .c = {65, 67, 64, 66, 37, 39, 36, 38},
180 .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
181 },
182 [BRm] = {
183 .c = {39, 37, 36, 38, 65, 67, 66, 64},
184 .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
185 },
186 [BDm] = {
187 .c = {67, 65, 66, 64, 39, 37, 38, 36},
188 .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
189 },
190 [BLm] = {
191 .c = {37, 39, 38, 36, 67, 65, 64, 66},
192 .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
193 },
194};
195
196static cube_t trans_move_cube_inverse[] = {
197 [UFr] = {
198 .c = {0, 1, 2, 3, 4, 5, 6, 7},
199 .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
200 },
201 [ULr] = {
202 .c = {5, 4, 6, 7, 0, 1, 3, 2},
203 .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
204 },
205 [UBr] = {
206 .c = {1, 0, 3, 2, 5, 4, 7, 6},
207 .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
208 },
209 [URr] = {
210 .c = {4, 5, 7, 6, 1, 0, 2, 3},
211 .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
212 },
213 [DFr] = {
214 .c = {2, 3, 0, 1, 6, 7, 4, 5},
215 .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
216 },
217 [DLr] = {
218 .c = {7, 6, 4, 5, 2, 3, 1, 0},
219 .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
220 },
221 [DBr] = {
222 .c = {3, 2, 1, 0, 7, 6, 5, 4},
223 .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
224 },
225 [DRr] = {
226 .c = {6, 7, 5, 4, 3, 2, 0, 1},
227 .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
228 },
229 [RUr] = {
230 .c = {32, 34, 35, 33, 70, 68, 69, 71},
231 .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
232 },
233 [RFr] = {
234 .c = {36, 39, 38, 37, 66, 65, 64, 67},
235 .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
236 },
237 [RDr] = {
238 .c = {33, 35, 34, 32, 71, 69, 68, 70},
239 .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
240 },
241 [RBr] = {
242 .c = {37, 38, 39, 36, 67, 64, 65, 66},
243 .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
244 },
245 [LUr] = {
246 .c = {34, 32, 33, 35, 68, 70, 71, 69},
247 .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
248 },
249 [LFr] = {
250 .c = {38, 37, 36, 39, 64, 67, 66, 65},
251 .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
252 },
253 [LDr] = {
254 .c = {35, 33, 32, 34, 69, 71, 70, 68},
255 .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
256 },
257 [LBr] = {
258 .c = {39, 36, 37, 38, 65, 66, 67, 64},
259 .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
260 },
261 [FUr] = {
262 .c = {68, 70, 69, 71, 32, 34, 33, 35},
263 .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
264 },
265 [FRr] = {
266 .c = {64, 67, 65, 66, 37, 38, 36, 39},
267 .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
268 },
269 [FDr] = {
270 .c = {69, 71, 68, 70, 33, 35, 32, 34},
271 .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
272 },
273 [FLr] = {
274 .c = {65, 66, 64, 67, 36, 39, 37, 38},
275 .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
276 },
277 [BUr] = {
278 .c = {70, 68, 71, 69, 34, 32, 35, 33},
279 .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
280 },
281 [BRr] = {
282 .c = {66, 65, 67, 64, 39, 36, 38, 37},
283 .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
284 },
285 [BDr] = {
286 .c = {71, 69, 70, 68, 35, 33, 34, 32},
287 .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
288 },
289 [BLr] = {
290 .c = {67, 64, 66, 65, 38, 37, 39, 36},
291 .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
292 },
293 [UFm] = {
294 .c = {4, 5, 6, 7, 0, 1, 2, 3},
295 .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
296 },
297 [ULm] = {
298 .c = {0, 1, 3, 2, 5, 4, 6, 7},
299 .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
300 },
301 [UBm] = {
302 .c = {5, 4, 7, 6, 1, 0, 3, 2},
303 .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
304 },
305 [URm] = {
306 .c = {1, 0, 2, 3, 4, 5, 7, 6},
307 .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
308 },
309 [DFm] = {
310 .c = {6, 7, 4, 5, 2, 3, 0, 1},
311 .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
312 },
313 [DLm] = {
314 .c = {2, 3, 1, 0, 7, 6, 4, 5},
315 .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
316 },
317 [DBm] = {
318 .c = {7, 6, 5, 4, 3, 2, 1, 0},
319 .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
320 },
321 [DRm] = {
322 .c = {3, 2, 0, 1, 6, 7, 5, 4},
323 .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
324 },
325 [RUm] = {
326 .c = {70, 68, 69, 71, 32, 34, 35, 33},
327 .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
328 },
329 [RFm] = {
330 .c = {66, 65, 64, 67, 36, 39, 38, 37},
331 .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
332 },
333 [RDm] = {
334 .c = {71, 69, 68, 70, 33, 35, 34, 32},
335 .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
336 },
337 [RBm] = {
338 .c = {67, 64, 65, 66, 37, 38, 39, 36},
339 .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
340 },
341 [LUm] = {
342 .c = {68, 70, 71, 69, 34, 32, 33, 35},
343 .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
344 },
345 [LFm] = {
346 .c = {64, 67, 66, 65, 38, 37, 36, 39},
347 .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
348 },
349 [LDm] = {
350 .c = {69, 71, 70, 68, 35, 33, 32, 34},
351 .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
352 },
353 [LBm] = {
354 .c = {65, 66, 67, 64, 39, 36, 37, 38},
355 .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
356 },
357 [FUm] = {
358 .c = {32, 34, 33, 35, 68, 70, 69, 71},
359 .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
360 },
361 [FRm] = {
362 .c = {37, 38, 36, 39, 64, 67, 65, 66},
363 .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
364 },
365 [FDm] = {
366 .c = {33, 35, 32, 34, 69, 71, 68, 70},
367 .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
368 },
369 [FLm] = {
370 .c = {36, 39, 37, 38, 65, 66, 64, 67},
371 .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
372 },
373 [BUm] = {
374 .c = {34, 32, 35, 33, 70, 68, 71, 69},
375 .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
376 },
377 [BRm] = {
378 .c = {39, 36, 38, 37, 66, 65, 67, 64},
379 .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
380 },
381 [BDm] = {
382 .c = {35, 33, 34, 32, 71, 69, 70, 68},
383 .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
384 },
385 [BLm] = {
386 .c = {38, 37, 39, 36, 67, 64, 66, 65},
387 .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
388 },
389};
diff --git a/old/gendata_bfs_attempt.c b/old/gendata_bfs_attempt.c
deleted file mode 100644
index 4cd5ae9..0000000
--- a/old/gendata_bfs_attempt.c
+++ /dev/null
@@ -1,153 +0,0 @@
1_static size_t gendata_cocsep(void *);
2_static uint32_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint32_t *);
3
4/*
5Each element of the cocsep table is a uint32_t used as follows:
6 - Lowest 8-bit block: pruning value
7 - Second-lower 8-bit block: "ttrep" (transformation to representative)
8 - Top 16-bit block: symcoord value
9After the data as described above, more auxiliary information is appended:
10 - A uint32_t representing the number of symmetry classes
11 - A uint32_t representing the highest value of the pruning table
12 - One uint32_t for each "line" of the pruning table, representing the number
13 of positions having that pruning value.
14*/
15_static size_t
16gendata_cocsep(void *buf)
17{
18 uint32_t *buf32, cc;
19 uint64_t i64;
20 uint16_t n;
21 uint8_t i, j;
22 size_t tablesize;
23
24 tablesize = _3p7 << 7U;
25
26 buf32 = (uint32_t *)buf;
27 memset(buf32, 0xFFU, 4*tablesize);
28 memset(buf32 + tablesize, 0, 21*4);
29
30/* New impl BFS
31
32 uint32_t nold = 0, nnew = 0;
33 uint64_t coord;
34 uint8_t m, olddepth;
35 cube_fast_t c, d, oldlevel[100000], newlevel[100000];
36 newlevel[0] = cubetofast(solvedcube());
37 nnew = 1;
38 buf32[coord_fast_cocsep(newlevel[0])] = UFr << 8U;
39 n = 1;
40 DBG_LOG("gendata_cocsep: found 1 position at depth 0\n");
41 for (i = 1; i < 10; i++) {
42 DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i);
43 memcpy(oldlevel, newlevel, nnew * sizeof(cube_fast_t));
44 nold = nnew;
45 nnew = 0;
46 for (j = 0; j < nold; j++) {
47 _foreach_move(m, oldlevel[j], newlevel[nnew],
48 coord = coord_fast_cocsep(newlevel[nnew]);
49 olddepth = buf32[coord] & 0xFFU;
50 buf32[coord] = i;
51 nnew += olddepth > i;
52 )
53 }
54 DBG_LOG("found %" PRIu32 "\n", nnew);
55 }
56
57End new impl BFS */
58
59 /* Pruning values */
60 buf32[tablesize+1] = 9U; /* Known max pruning value */
61 for (i = 0, cc = 0; i < 10; i++) {
62 DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i);
63 cc = dfs_cocsep(cubetofast(solvedcube()), 0, i, buf32);
64 buf32[tablesize+i+2] = cc;
65 DBG_LOG("found %" PRIu32 "\n", cc);
66 }
67
68 /* Symmetries */
69 for (i64 = 0, n = 0; i64 < tablesize; i64++) {
70 }
71 buf32[tablesize] = (uint32_t)n;
72
73 DBG_LOG("cocsep data computed, %" PRIu32 " symmetry classes\n", n);
74 DBG_LOG("Maximum pruning value: %" PRIu32 "\n", buf32[tablesize+1]);
75 DBG_LOG("Pruning value distribution:\n");
76 for (j = 0; j < 10; j++)
77 DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+2]);
78
79 return 4*(tablesize + 11);
80}
81
82_static uint32_t
83dfs_cocsep(cube_fast_t c, uint8_t depth, uint8_t maxdepth, uint32_t *buf32)
84{
85 uint8_t m, olddepth;
86 uint32_t update, cc;
87 uint64_t i;
88 cube_fast_t d;
89
90 i = coord_fast_cocsep(c);
91 olddepth = (uint8_t)(buf32[i] & 0xFFU);
92 if (olddepth < depth)
93 return 0;
94
95 if (depth == maxdepth) {
96 update = (buf32[i] & 0xFFU) == 0xFFU;
97 buf32[i] = depth;
98 return update;
99 }
100
101 cc = 0;
102 _foreach_move(m, c, d,
103 cc += dfs_cocsep(d, depth+1, maxdepth, buf32);
104 )
105
106 return cc;
107}
108
109/*
110_static uint32_t
111dfs_cocsep(
112 cube_fast_t c,
113 uint8_t depth,
114 uint8_t maxdepth,
115 uint16_t *n,
116 uint32_t *buf32
117)
118{
119 uint8_t m, t, tinv, olddepth;
120 uint32_t cc, oldvalue;
121 uint64_t i;
122 cube_fast_t d;
123
124 oldvalue = buf32[coord_fast_cocsep(c)];
125 if (depth == maxdepth) {
126 if ((oldvalue & 0xFFU) != 0xFFU)
127 return 0;
128
129 for (t = 0, cc = 0; t < 48; t++) {
130 d = transform(c, t);
131 i = coord_fast_cocsep(d);
132 tinv = inverse_trans(t);
133 if ((buf32[i] & 0xFFU) == 0xFFU)
134 cc++;
135 buf32[i] = (*n << 16U) | (tinv << 8U) | depth;
136 }
137 (*n)++;
138
139 return cc;
140 }
141
142 olddepth = (uint8_t)(oldvalue & 0xFFU);
143 if (olddepth != depth)
144 return 0;
145
146 cc = 0;
147 _foreach_move(m, c, d,
148 cc += dfs_cocsep(d, depth+1, maxdepth, n, buf32);
149 )
150
151 return cc;
152}
153*/
diff --git a/old/inverse_fast.c b/old/inverse_fast.c
deleted file mode 100644
index 13ace58..0000000
--- a/old/inverse_fast.c
+++ /dev/null
@@ -1,51 +0,0 @@
1_static_inline cube_fast_t
2cleanaftershuffle(cube_fast_t c)
3{
4 __m256i b;
5
6 b = _mm256_set_epi8(
7 ~0, ~0, ~0, ~0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8 ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0, 0, 0, 0, 0, 0, 0, 0
9 );
10
11 return _mm256_andnot_si256(b, c);
12}
13
14_static_inline cube_fast_t
15inverse_fast(cube_fast_t c)
16{
17 /* Method taken from Andrew Skalski's vcube[1]. The addition sequence
18 * was generated using [2].
19 * [1] https://github.com/Voltara/vcube
20 * [2] http://wwwhomes.uni-bielefeld.de/achim/addition_chain.html
21 */
22 cube_fast_t v3, vi, vo, vp, ret;
23
24 v3 = _mm256_shuffle_epi8(c, c);
25 v3 = _mm256_shuffle_epi8(v3, c);
26 vi = _mm256_shuffle_epi8(v3, v3);
27 vi = _mm256_shuffle_epi8(vi, vi);
28 vi = _mm256_shuffle_epi8(vi, vi);
29 vi = _mm256_shuffle_epi8(vi, v3);
30 vi = _mm256_shuffle_epi8(vi, vi);
31 vi = _mm256_shuffle_epi8(vi, vi);
32 vi = _mm256_shuffle_epi8(vi, vi);
33 vi = _mm256_shuffle_epi8(vi, vi);
34 vi = _mm256_shuffle_epi8(vi, c);
35 vi = _mm256_shuffle_epi8(vi, vi);
36 vi = _mm256_shuffle_epi8(vi, vi);
37 vi = _mm256_shuffle_epi8(vi, vi);
38 vi = _mm256_shuffle_epi8(vi, vi);
39 vi = _mm256_shuffle_epi8(vi, vi);
40 vi = _mm256_shuffle_epi8(vi, v3);
41 vi = _mm256_shuffle_epi8(vi, vi);
42 vi = _mm256_shuffle_epi8(vi, c);
43
44 vo = _mm256_and_si256(c, _mm256_or_si256(_eo_avx2, _co2_avx2));
45 vo = _mm256_shuffle_epi8(vo, vi);
46 vp = _mm256_andnot_si256(_mm256_or_si256(_eo_avx2, _co2_avx2), vi);
47 ret = _mm256_or_si256(vp, vo);
48 ret = cleanaftershuffle(ret);
49
50 return invertco_fast(ret);
51}
diff --git a/old/inverses.c b/old/inverses.c
deleted file mode 100644
index eb8e80b..0000000
--- a/old/inverses.c
+++ /dev/null
@@ -1,71 +0,0 @@
1static move_t inverse_move_arr[] = {
2 [U] = U3,
3 [U2] = U2,
4 [U3] = U,
5 [D] = D3,
6 [D2] = D2,
7 [D3] = D,
8 [R] = R3,
9 [R2] = R2,
10 [R3] = R,
11 [L] = L3,
12 [L2] = L2,
13 [L3] = L,
14 [F] = F3,
15 [F2] = F2,
16 [F3] = F,
17 [B] = B3,
18 [B2] = B2,
19 [B3] = B,
20};
21
22static trans_t inverse_trans_arr[] = {
23 [UFr] = UFr,
24 [ULr] = URr,
25 [UBr] = UBr,
26 [URr] = URr,
27 [DFr] = DFr,
28 [DLr] = DLr,
29 [DRr] = DRr,
30 [DBr] = DBr,
31 [RUr] = FRr,
32 [RFr] = LFr,
33 [RDr] = BLr,
34 [RBr] = RBr,
35 [LUr] = FLr,
36 [LFr] = RFr,
37 [LDr] = BRr,
38 [LBr] = LBr,
39 [FUr] = FUr,
40 [FRr] = RUr,
41 [FDr] = BUr,
42 [FLr] = LUr,
43 [BUr] = FDr,
44 [BLr] = RDr,
45 [BDr] = BDr,
46 [BRr] = LDr,
47 [UFm] = UFm,
48 [ULm] = ULm,
49 [UBm] = UBm,
50 [URm] = ULm,
51 [DFm] = DFm,
52 [DLm] = DRm,
53 [DRm] = DLm,
54 [DBm] = DBm,
55 [RUm] = FLm,
56 [RFm] = RFm,
57 [RDm] = BRm,
58 [RBm] = LBm,
59 [LUm] = FRm,
60 [LFm] = LFm,
61 [LDm] = BLm,
62 [LBm] = RBm,
63 [FUm] = FUm,
64 [FRm] = LUm,
65 [FDm] = BUm,
66 [FLm] = RUm,
67 [BUm] = FDm,
68 [BLm] = LDm,
69 [BDm] = BDm,
70 [BRm] = RDm,
71};
diff --git a/old/moves_trans/genmovecode.sh b/old/moves_trans/genmovecode.sh
deleted file mode 100755
index 0857f31..0000000
--- a/old/moves_trans/genmovecode.sh
+++ /dev/null
@@ -1,19 +0,0 @@
1#!/bin/sh
2
3type="${1:-src}"
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6
7genfuncs() {
8 for f in move_??_*.txt; do
9 move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
10 printf 'static inline cube_fast_t\n_move_%s' "$move"
11 printf '(cube_fast_t c)\n{\n'
12 printf '\tcube_fast_t m = '
13 ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/'
14 printf ';\n\n\treturn compose_fast(c, m);\n}\n\n'
15 done
16}
17
18genfuncs
19rm -f h48_to_"$type" invert
diff --git a/old/moves_trans/gentranscode.sh b/old/moves_trans/gentranscode.sh
deleted file mode 100755
index 198ac93..0000000
--- a/old/moves_trans/gentranscode.sh
+++ /dev/null
@@ -1,42 +0,0 @@
1#!/bin/sh
2
3type="${1:-src}"
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6gcc -DDEBUG invert.c ../cube.c -o invert
7
8# Old version
9genarray() {
10 for f in transform_??_???.txt; do
11 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
12 printf '[%s] = ' "$trans"
13 if [ "$1" = "-i" ]; then
14 ./invert <"$f" | ./h48_to_"$type"
15 else
16 ./h48_to_"$type" <"$f"
17 fi
18 printf ',\n'
19 done
20}
21
22genfuncs() {
23 for f in transform_??_???.txt; do
24 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
25 printf 'static inline cube_fast_t\n_trans_%s' "$trans"
26 printf '(cube_fast_t c)\n{\n'
27 printf '\tcube_fast_t ret;\n\n'
28 printf '\tcube_fast_t tn = '
29 ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/'
30 printf ';\n\tcube_fast_t ti = '
31 ./invert <"$f" | ./h48_to_"$type" | sed '2,4 s/^/\t/'
32 printf ';\n\n\tret = compose_fast(tn, c);\n'
33 printf '\tret = compose_fast(ret, ti);\n'
34 if [ -n "$(echo "$trans" | grep "m")" ]; then
35 printf '\tret = invertco_fast(ret);\n'
36 fi
37 printf '\n\treturn ret;\n}\n\n'
38 done
39}
40
41genfuncs
42rm -f h48_to_"$type" invert
diff --git a/old/moves_trans/moves_src.c b/old/moves_trans/moves_src.c
deleted file mode 100644
index faf4729..0000000
--- a/old/moves_trans/moves_src.c
+++ /dev/null
@@ -1,264 +0,0 @@
1#define PERM4(r, i, j, k, l) \
2 aux = r[i]; \
3 r[i] = r[l]; \
4 r[l] = r[k]; \
5 r[k] = r[j]; \
6 r[j] = aux;
7#define PERM22(r, i, j, k, l) \
8 aux = r[i]; \
9 r[i] = r[j]; \
10 r[j] = aux; \
11 aux = r[k]; \
12 r[k] = r[l]; \
13 r[l] = aux;
14#define CO(a, b) \
15 aux = (a & _cobits) + (b & _cobits); \
16 auy = (aux + _ctwist_cw) >> 2U; \
17 auz = (aux + auy) & _cobits2; \
18 a = (a & _pbits) | auz;
19#define CO4(r, i, j, k, l) \
20 CO(r[i], _ctwist_cw) \
21 CO(r[j], _ctwist_cw) \
22 CO(r[k], _ctwist_ccw) \
23 CO(r[l], _ctwist_ccw)
24#define EO4(r, i, j, k, l) \
25 r[i] ^= _eobit; \
26 r[j] ^= _eobit; \
27 r[k] ^= _eobit; \
28 r[l] ^= _eobit;
29
30_static_inline cube_fast_t
31_move_U(cube_fast_t c)
32{
33 uint8_t aux;
34 cube_fast_t ret = c;
35
36 PERM4(ret.edge, _e_uf, _e_ul, _e_ub, _e_ur)
37 PERM4(ret.corner, _c_ufr, _c_ufl, _c_ubl, _c_ubr)
38
39 return ret;
40}
41
42_static_inline cube_fast_t
43_move_U2(cube_fast_t c)
44{
45 uint8_t aux;
46 cube_fast_t ret = c;
47
48 PERM22(ret.edge, _e_uf, _e_ub, _e_ul, _e_ur)
49 PERM22(ret.corner, _c_ufr, _c_ubl, _c_ufl, _c_ubr)
50
51 return ret;
52}
53
54_static_inline cube_fast_t
55_move_U3(cube_fast_t c)
56{
57 uint8_t aux;
58 cube_fast_t ret = c;
59
60 PERM4(ret.edge, _e_uf, _e_ur, _e_ub, _e_ul)
61 PERM4(ret.corner, _c_ufr, _c_ubr, _c_ubl, _c_ufl)
62
63 return ret;
64}
65
66_static_inline cube_fast_t
67_move_D(cube_fast_t c)
68{
69 uint8_t aux;
70 cube_fast_t ret = c;
71
72 PERM4(ret.edge, _e_df, _e_dr, _e_db, _e_dl)
73 PERM4(ret.corner, _c_dfr, _c_dbr, _c_dbl, _c_dfl)
74
75 return ret;
76}
77
78_static_inline cube_fast_t
79_move_D2(cube_fast_t c)
80{
81 uint8_t aux;
82 cube_fast_t ret = c;
83
84 PERM22(ret.edge, _e_df, _e_db, _e_dr, _e_dl)
85 PERM22(ret.corner, _c_dfr, _c_dbl, _c_dbr, _c_dfl)
86
87 return ret;
88}
89
90_static_inline cube_fast_t
91_move_D3(cube_fast_t c)
92{
93 uint8_t aux;
94 cube_fast_t ret = c;
95
96 PERM4(ret.edge, _e_df, _e_dl, _e_db, _e_dr)
97 PERM4(ret.corner, _c_dfr, _c_dfl, _c_dbl, _c_dbr)
98
99 return ret;
100}
101
102_static_inline cube_fast_t
103_move_R(cube_fast_t c)
104{
105 uint8_t aux, auy, auz;
106 cube_fast_t ret = c;
107
108 PERM4(ret.edge, _e_ur, _e_br, _e_dr, _e_fr)
109 PERM4(ret.corner, _c_ufr, _c_ubr, _c_dbr, _c_dfr)
110
111 CO4(ret.corner, _c_ubr, _c_dfr, _c_ufr, _c_dbr)
112
113 return ret;
114}
115
116_static_inline cube_fast_t
117_move_R2(cube_fast_t c)
118{
119 uint8_t aux;
120 cube_fast_t ret = c;
121
122 PERM22(ret.edge, _e_ur, _e_dr, _e_fr, _e_br)
123 PERM22(ret.corner, _c_ufr, _c_dbr, _c_ubr, _c_dfr)
124
125 return ret;
126}
127
128_static_inline cube_fast_t
129_move_R3(cube_fast_t c)
130{
131 uint8_t aux, auy, auz;
132 cube_fast_t ret = c;
133
134 PERM4(ret.edge, _e_ur, _e_fr, _e_dr, _e_br)
135 PERM4(ret.corner, _c_ufr, _c_dfr, _c_dbr, _c_ubr)
136
137 CO4(ret.corner, _c_ubr, _c_dfr, _c_ufr, _c_dbr)
138
139 return ret;
140}
141
142_static_inline cube_fast_t
143_move_L(cube_fast_t c)
144{
145 uint8_t aux, auy, auz;
146 cube_fast_t ret = c;
147
148 PERM4(ret.edge, _e_ul, _e_fl, _e_dl, _e_bl)
149 PERM4(ret.corner, _c_ufl, _c_dfl, _c_dbl, _c_ubl)
150
151 CO4(ret.corner, _c_ufl, _c_dbl, _c_dfl, _c_ubl)
152
153 return ret;
154}
155
156_static_inline cube_fast_t
157_move_L2(cube_fast_t c)
158{
159 uint8_t aux;
160 cube_fast_t ret = c;
161
162 PERM22(ret.edge, _e_ul, _e_dl, _e_fl, _e_bl)
163 PERM22(ret.corner, _c_ufl, _c_dbl, _c_ubl, _c_dfl)
164
165 return ret;
166}
167
168_static_inline cube_fast_t
169_move_L3(cube_fast_t c)
170{
171 uint8_t aux, auy, auz;
172 cube_fast_t ret = c;
173
174 PERM4(ret.edge, _e_ul, _e_bl, _e_dl, _e_fl)
175 PERM4(ret.corner, _c_ufl, _c_ubl, _c_dbl, _c_dfl)
176
177 CO4(ret.corner, _c_ufl, _c_dbl, _c_dfl, _c_ubl)
178
179 return ret;
180}
181
182_static_inline cube_fast_t
183_move_F(cube_fast_t c)
184{
185 uint8_t aux, auy, auz;
186 cube_fast_t ret = c;
187
188 PERM4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl)
189 PERM4(ret.corner, _c_ufr, _c_dfr, _c_dfl, _c_ufl)
190
191 EO4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl)
192 CO4(ret.corner, _c_ufr, _c_dfl, _c_dfr, _c_ufl)
193
194 return ret;
195}
196
197_static_inline cube_fast_t
198_move_F2(cube_fast_t c)
199{
200 uint8_t aux;
201 cube_fast_t ret = c;
202
203 PERM22(ret.edge, _e_uf, _e_df, _e_fr, _e_fl)
204 PERM22(ret.corner, _c_ufr, _c_dfl, _c_ufl, _c_dfr)
205
206 return ret;
207}
208
209_static_inline cube_fast_t
210_move_F3(cube_fast_t c)
211{
212 uint8_t aux, auy, auz;
213 cube_fast_t ret = c;
214
215 PERM4(ret.edge, _e_uf, _e_fl, _e_df, _e_fr)
216 PERM4(ret.corner, _c_ufr, _c_ufl, _c_dfl, _c_dfr)
217
218 EO4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl)
219 CO4(ret.corner, _c_ufr, _c_dfl, _c_dfr, _c_ufl)
220
221 return ret;
222}
223
224_static_inline cube_fast_t
225_move_B(cube_fast_t c)
226{
227 uint8_t aux, auy, auz;
228 cube_fast_t ret = c;
229
230 PERM4(ret.edge, _e_ub, _e_bl, _e_db, _e_br)
231 PERM4(ret.corner, _c_ubr, _c_ubl, _c_dbl, _c_dbr)
232
233 EO4(ret.edge, _e_ub, _e_br, _e_db, _e_bl)
234 CO4(ret.corner, _c_ubl, _c_dbr, _c_dbl, _c_ubr)
235
236 return ret;
237}
238
239_static_inline cube_fast_t
240_move_B2(cube_fast_t c)
241{
242 uint8_t aux;
243 cube_fast_t ret = c;
244
245 PERM22(ret.edge, _e_ub, _e_db, _e_br, _e_bl)
246 PERM22(ret.corner, _c_ubr, _c_dbl, _c_ubl, _c_dbr)
247
248 return ret;
249}
250
251_static_inline cube_fast_t
252_move_B3(cube_fast_t c)
253{
254 uint8_t aux, auy, auz;
255 cube_fast_t ret = c;
256
257 PERM4(ret.edge, _e_ub, _e_br, _e_db, _e_bl)
258 PERM4(ret.corner, _c_ubr, _c_dbr, _c_dbl, _c_ubl)
259
260 EO4(ret.edge, _e_ub, _e_br, _e_db, _e_bl)
261 CO4(ret.corner, _c_ubl, _c_dbr, _c_dbl, _c_ubr)
262
263 return ret;
264}
diff --git a/old/moves_trans/v2/genmovecode.sh b/old/moves_trans/v2/genmovecode.sh
deleted file mode 100755
index 9d5fa7a..0000000
--- a/old/moves_trans/v2/genmovecode.sh
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/sh
2
3type="${1:-src}"
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6
7lineavx() { printf '#define _move_cube_%s ' "$1"; }
8linesrc() { printf '_static cube_fast_t _move_cube_%s = ' "$1"; }
9sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
10sedsrc() { sed '3s/$/ };/ ; 3q'; }
11
12gen() {
13 for f in move_??_*.txt; do
14 move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
15 line$type "$move"
16 ./h48_to_"$type" <"$f" | sed$type
17 done
18}
19
20gen
21rm -f h48_to_"$type" invert
diff --git a/old/moves_trans/v2/gentranscode.sh b/old/moves_trans/v2/gentranscode.sh
deleted file mode 100755
index b9d41b6..0000000
--- a/old/moves_trans/v2/gentranscode.sh
+++ /dev/null
@@ -1,24 +0,0 @@
1#!/bin/sh
2
3type="${1:-src}"
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6gcc -DDEBUG invert.c ../cube.c -o invert
7
8lineavx() { printf '#define _trans_cube_%s ' "$1"; }
9linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; }
10sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
11sedsrc() { sed '3s/$/ };/ ; 3q'; }
12
13gen() {
14 for f in transform_??_???.txt; do
15 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
16 line$type "$trans"
17 ./h48_to_"$type" <"$f" | sed$type
18 line$type "${trans}_inverse"
19 ./invert <"$f" | ./h48_to_"$type" | sed$type
20 done
21}
22
23gen
24rm -f h48_to_"$type" invert

Generated with cgit - Back to sebastiano.tronto.net