cubing 0.53.14 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/lib/cubing/{TwizzleLink.d-yDfHSjux.d.ts → TwizzleLink.d-Bxv5QZmG.d.ts} +1 -1
  2. package/dist/lib/cubing/bluetooth/index.d.ts +4 -4
  3. package/dist/lib/cubing/bluetooth/index.js +3 -3
  4. package/dist/lib/cubing/{bluetooth-puzzle.d-B2L3nzXn.d.ts → bluetooth-puzzle.d-SLdses2g.d.ts} +1 -1
  5. package/dist/lib/cubing/chunks/{chunk-US5D7CVM.js → chunk-3BBB7S32.js} +2 -2
  6. package/dist/lib/cubing/chunks/{chunk-YSHXHFL2.js → chunk-4I3ZAHTY.js} +2 -2
  7. package/dist/lib/cubing/chunks/{chunk-7LAJDOI3.js → chunk-AO7CUKKT.js} +25 -3
  8. package/dist/lib/cubing/chunks/{chunk-7LAJDOI3.js.map → chunk-AO7CUKKT.js.map} +2 -2
  9. package/dist/lib/cubing/chunks/{chunk-IWH3E6EY.js → chunk-M5HEP6ZE.js} +13 -9
  10. package/dist/lib/cubing/chunks/{chunk-IWH3E6EY.js.map → chunk-M5HEP6ZE.js.map} +2 -2
  11. package/dist/lib/cubing/chunks/{chunk-JVHCFNBL.js → chunk-OPV6VG3X.js} +1 -1
  12. package/dist/lib/cubing/chunks/{chunk-63PE4ND6.js → chunk-ZANKU5L6.js} +3 -3
  13. package/dist/lib/cubing/chunks/{chunk-KIC77KAO.js → chunk-ZU3V6SKO.js} +3 -3
  14. package/dist/lib/cubing/chunks/{inside-JHHWCKZI.js → inside-LUDELYNF.js} +11 -29
  15. package/dist/lib/cubing/chunks/{inside-JHHWCKZI.js.map → inside-LUDELYNF.js.map} +3 -3
  16. package/dist/lib/cubing/chunks/{puzzles-dynamic-unofficial-NCMLO2AJ.js → puzzles-dynamic-unofficial-P3TW433I.js} +277 -217
  17. package/dist/lib/cubing/chunks/puzzles-dynamic-unofficial-P3TW433I.js.map +7 -0
  18. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-JOC5DT7H.js → search-dynamic-sgs-side-events-J5XLLQJY.js} +3 -3
  19. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-ZKP3UOZQ.js → search-dynamic-sgs-unofficial-L7LGZT63.js} +3 -3
  20. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-DKSRKWDZ.js → search-dynamic-solve-4x4x4-6JR6MPNN.js} +5 -5
  21. package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
  22. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-YGAIMWZ2.js → twisty-dynamic-3d-J5TBHBOJ.js} +4 -4
  23. package/dist/lib/cubing/chunks/{twsearch-2T5RAJYA.js → twsearch-KODGQJMW.js} +3 -3
  24. package/dist/lib/cubing/chunks/{twsearch-2T5RAJYA.js.map → twsearch-KODGQJMW.js.map} +2 -2
  25. package/dist/lib/cubing/chunks/twsearch_wasm_bg-ZVADHDTY-KT5WT5OX.js +15 -0
  26. package/dist/lib/cubing/chunks/twsearch_wasm_bg-ZVADHDTY-KT5WT5OX.js.map +7 -0
  27. package/dist/lib/cubing/{index-nwbgtVtK.d.ts → index-C0GtBTdp.d.ts} +1 -1
  28. package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
  29. package/dist/lib/cubing/notation/index.d.ts +2 -2
  30. package/dist/lib/cubing/notation/index.js +2 -2
  31. package/dist/lib/cubing/protocol/index.d.ts +1 -1
  32. package/dist/lib/cubing/protocol/index.js +2 -2
  33. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
  34. package/dist/lib/cubing/puzzles/index.d.ts +2 -2
  35. package/dist/lib/cubing/puzzles/index.js +2 -2
  36. package/dist/lib/cubing/scramble/index.d.ts +2 -2
  37. package/dist/lib/cubing/scramble/index.js +4 -4
  38. package/dist/lib/cubing/search/index.d.ts +2 -2
  39. package/dist/lib/cubing/search/index.js +4 -4
  40. package/dist/lib/cubing/stream/index.d.ts +3 -3
  41. package/dist/lib/cubing/twisty/index.d.ts +3 -3
  42. package/dist/lib/cubing/twisty/index.js +4 -4
  43. package/package.json +1 -2
  44. package/dist/lib/cubing/chunks/puzzles-dynamic-unofficial-NCMLO2AJ.js.map +0 -7
  45. package/dist/lib/cubing/chunks/search-dynamic-solve-sq1-YESVPPLF.js +0 -820
  46. package/dist/lib/cubing/chunks/search-dynamic-solve-sq1-YESVPPLF.js.map +0 -7
  47. package/dist/lib/cubing/chunks/twsearch_wasm_bg-VKUQN4MD-IPLXEKL7.js +0 -15
  48. package/dist/lib/cubing/chunks/twsearch_wasm_bg-VKUQN4MD-IPLXEKL7.js.map +0 -7
  49. package/dist/lib/cubing/{index-ByJRFnO6.d.ts → KPattern.d-B8PBnjzZ.d.ts} +103 -103
  50. /package/dist/lib/cubing/chunks/{chunk-US5D7CVM.js.map → chunk-3BBB7S32.js.map} +0 -0
  51. /package/dist/lib/cubing/chunks/{chunk-YSHXHFL2.js.map → chunk-4I3ZAHTY.js.map} +0 -0
  52. /package/dist/lib/cubing/chunks/{chunk-JVHCFNBL.js.map → chunk-OPV6VG3X.js.map} +0 -0
  53. /package/dist/lib/cubing/chunks/{chunk-63PE4ND6.js.map → chunk-ZANKU5L6.js.map} +0 -0
  54. /package/dist/lib/cubing/chunks/{chunk-KIC77KAO.js.map → chunk-ZU3V6SKO.js.map} +0 -0
  55. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-JOC5DT7H.js.map → search-dynamic-sgs-side-events-J5XLLQJY.js.map} +0 -0
  56. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-ZKP3UOZQ.js.map → search-dynamic-sgs-unofficial-L7LGZT63.js.map} +0 -0
  57. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-DKSRKWDZ.js.map → search-dynamic-solve-4x4x4-6JR6MPNN.js.map} +0 -0
  58. /package/dist/lib/cubing/chunks/{twisty-dynamic-3d-YGAIMWZ2.js.map → twisty-dynamic-3d-J5TBHBOJ.js.map} +0 -0
@@ -1,820 +0,0 @@
1
- // src/cubing/vendor/mit/cs0x7f/sq12phase/sq1-solver.js
2
- import { randomUIntBelow } from "random-uint-below";
3
- function FullCube_copy(obj, c) {
4
- obj.ul = c.ul;
5
- obj.ur = c.ur;
6
- obj.dl = c.dl;
7
- obj.dr = c.dr;
8
- obj.ml = c.ml;
9
- }
10
- function FullCube_doMove(obj, move) {
11
- var temp;
12
- move <<= 2;
13
- if (move > 24) {
14
- move = 48 - move;
15
- temp = obj.ul;
16
- obj.ul = (~~obj.ul >> move | obj.ur << 24 - move) & 16777215;
17
- obj.ur = (~~obj.ur >> move | temp << 24 - move) & 16777215;
18
- } else if (move > 0) {
19
- temp = obj.ul;
20
- obj.ul = (obj.ul << move | ~~obj.ur >> 24 - move) & 16777215;
21
- obj.ur = (obj.ur << move | ~~temp >> 24 - move) & 16777215;
22
- } else if (move === 0) {
23
- temp = obj.ur;
24
- obj.ur = obj.dl;
25
- obj.dl = temp;
26
- obj.ml = 1 - obj.ml;
27
- } else if (move >= -24) {
28
- move = -move;
29
- temp = obj.dl;
30
- obj.dl = (obj.dl << move | ~~obj.dr >> 24 - move) & 16777215;
31
- obj.dr = (obj.dr << move | ~~temp >> 24 - move) & 16777215;
32
- } else if (move < -24) {
33
- move = 48 + move;
34
- temp = obj.dl;
35
- obj.dl = (~~obj.dl >> move | obj.dr << 24 - move) & 16777215;
36
- obj.dr = (~~obj.dr >> move | temp << 24 - move) & 16777215;
37
- }
38
- }
39
- function FullCube_getParity(obj) {
40
- var a;
41
- var b;
42
- var cnt;
43
- var i;
44
- var p;
45
- cnt = 0;
46
- obj.arr[0] = FullCube_pieceAt(obj, 0);
47
- for (i = 1; i < 24; ++i) {
48
- FullCube_pieceAt(obj, i) !== obj.arr[cnt] && (obj.arr[++cnt] = FullCube_pieceAt(obj, i));
49
- }
50
- p = 0;
51
- for (a = 0; a < 16; ++a) {
52
- for (b = a + 1; b < 16; ++b) {
53
- obj.arr[a] > obj.arr[b] && (p ^= 1);
54
- }
55
- }
56
- return p;
57
- }
58
- function FullCube_getShapeIdx(obj) {
59
- var dlx;
60
- var drx;
61
- var ulx;
62
- var urx;
63
- urx = obj.ur & 1118481;
64
- urx |= ~~urx >> 3;
65
- urx |= ~~urx >> 6;
66
- urx = urx & 15 | ~~urx >> 12 & 48;
67
- ulx = obj.ul & 1118481;
68
- ulx |= ~~ulx >> 3;
69
- ulx |= ~~ulx >> 6;
70
- ulx = ulx & 15 | ~~ulx >> 12 & 48;
71
- drx = obj.dr & 1118481;
72
- drx |= ~~drx >> 3;
73
- drx |= ~~drx >> 6;
74
- drx = drx & 15 | ~~drx >> 12 & 48;
75
- dlx = obj.dl & 1118481;
76
- dlx |= ~~dlx >> 3;
77
- dlx |= ~~dlx >> 6;
78
- dlx = dlx & 15 | ~~dlx >> 12 & 48;
79
- return Shape_getShape2Idx(
80
- FullCube_getParity(obj) << 24 | ulx << 18 | urx << 12 | dlx << 6 | drx
81
- );
82
- }
83
- function FullCube_getSquare(obj, sq) {
84
- var a;
85
- var b;
86
- for (a = 0; a < 8; ++a) {
87
- obj.prm[a] = ~~(~~FullCube_pieceAt(obj, a * 3 + 1) >> 1 << 24) >> 24;
88
- }
89
- sq.cornperm = get8Perm(obj.prm);
90
- sq.topEdgeFirst = FullCube_pieceAt(obj, 0) === FullCube_pieceAt(obj, 1);
91
- a = sq.topEdgeFirst ? 2 : 0;
92
- for (b = 0; b < 4; a += 3, ++b) {
93
- obj.prm[b] = ~~(~~FullCube_pieceAt(obj, a) >> 1 << 24) >> 24;
94
- }
95
- sq.botEdgeFirst = FullCube_pieceAt(obj, 12) === FullCube_pieceAt(obj, 13);
96
- a = sq.botEdgeFirst ? 14 : 12;
97
- for (; b < 8; a += 3, ++b) {
98
- obj.prm[b] = ~~(~~FullCube_pieceAt(obj, a) >> 1 << 24) >> 24;
99
- }
100
- sq.edgeperm = get8Perm(obj.prm);
101
- sq.ml = obj.ml;
102
- }
103
- function FullCube_pieceAt(obj, idx) {
104
- var ret;
105
- idx < 6 ? ret = ~~obj.ul >> (5 - idx << 2) : idx < 12 ? ret = ~~obj.ur >> (11 - idx << 2) : idx < 18 ? ret = ~~obj.dl >> (17 - idx << 2) : ret = ~~obj.dr >> (23 - idx << 2);
106
- return ~~((ret & 15) << 24) >> 24;
107
- }
108
- function FullCube_setPiece(obj, idx, value) {
109
- if (idx < 6) {
110
- obj.ul &= ~(15 << (5 - idx << 2));
111
- obj.ul |= value << (5 - idx << 2);
112
- } else if (idx < 12) {
113
- obj.ur &= ~(15 << (11 - idx << 2));
114
- obj.ur |= value << (11 - idx << 2);
115
- } else if (idx < 18) {
116
- obj.dl &= ~(15 << (17 - idx << 2));
117
- obj.dl |= value << (17 - idx << 2);
118
- } else {
119
- obj.dr &= ~(15 << (23 - idx << 2));
120
- obj.dr |= value << (23 - idx << 2);
121
- }
122
- }
123
- function FullCube_FullCube__Ljava_lang_String_2V() {
124
- this.arr = [];
125
- this.prm = [];
126
- }
127
- function FullCube_randomCube() {
128
- var f;
129
- var i;
130
- var shape;
131
- var edge;
132
- var corner;
133
- var n_edge;
134
- var n_corner;
135
- var rnd;
136
- var m;
137
- f = new FullCube_FullCube__Ljava_lang_String_2V();
138
- shape = Shape_ShapeIdx[randomUIntBelow(3678)];
139
- corner = 19088743 << 1 | 286331153;
140
- edge = 19088743 << 1;
141
- n_corner = n_edge = 8;
142
- for (i = 0; i < 24; i++) {
143
- if ((shape >> i & 1) === 0) {
144
- rnd = randomUIntBelow(n_edge) << 2;
145
- FullCube_setPiece(f, 23 - i, edge >> rnd & 15);
146
- m = (1 << rnd) - 1;
147
- edge = (edge & m) + (edge >> 4 & ~m);
148
- --n_edge;
149
- } else {
150
- rnd = randomUIntBelow(n_corner) << 2;
151
- FullCube_setPiece(f, 23 - i, corner >> rnd & 15);
152
- FullCube_setPiece(f, 22 - i, corner >> rnd & 15);
153
- m = (1 << rnd) - 1;
154
- corner = (corner & m) + (corner >> 4 & ~m);
155
- --n_corner;
156
- ++i;
157
- }
158
- }
159
- f.ml = randomUIntBelow(2);
160
- return f;
161
- }
162
- function FullCube() {
163
- }
164
- var _ = FullCube_FullCube__Ljava_lang_String_2V.prototype = FullCube.prototype;
165
- _.dl = 10062778;
166
- _.dr = 14536702;
167
- _.ml = 0;
168
- _.ul = 70195;
169
- _.ur = 4544119;
170
- function Search_init2(obj) {
171
- var corner;
172
- var edge;
173
- var i;
174
- var j;
175
- var ml;
176
- var prun;
177
- FullCube_copy(obj.Search_d, obj.Search_c);
178
- for (i = 0; i < obj.Search_length1; ++i) {
179
- FullCube_doMove(obj.Search_d, obj.Search_move[i]);
180
- }
181
- FullCube_getSquare(obj.Search_d, obj.Search_sq);
182
- edge = obj.Search_sq.edgeperm;
183
- corner = obj.Search_sq.cornperm;
184
- ml = obj.Search_sq.ml;
185
- prun = Math.max(
186
- SquarePrun[obj.Search_sq.edgeperm << 1 | ml],
187
- SquarePrun[obj.Search_sq.cornperm << 1 | ml]
188
- );
189
- for (i = prun; i < obj.Search_maxlen2; ++i) {
190
- if (Search_phase2(
191
- obj,
192
- edge,
193
- corner,
194
- obj.Search_sq.topEdgeFirst,
195
- obj.Search_sq.botEdgeFirst,
196
- ml,
197
- i,
198
- obj.Search_length1,
199
- 0
200
- )) {
201
- for (j = 0; j < i; ++j) {
202
- FullCube_doMove(obj.Search_d, obj.Search_move[obj.Search_length1 + j]);
203
- }
204
- obj.Search_sol_string = Search_move2string(obj, i + obj.Search_length1);
205
- return true;
206
- }
207
- }
208
- return false;
209
- }
210
- function Search_move2string(obj, len) {
211
- var s = "";
212
- var top = 0;
213
- var bottom = 0;
214
- for (var i = len - 1; i >= 0; i--) {
215
- var val = obj.Search_move[i];
216
- if (val > 0) {
217
- val = 12 - val;
218
- top = val > 6 ? val - 12 : val;
219
- } else if (val < 0) {
220
- val = 12 + val;
221
- bottom = val > 6 ? val - 12 : val;
222
- } else {
223
- if (top === 0 && bottom === 0) {
224
- s += " / ";
225
- } else {
226
- s += `(${top}, ${bottom}) / `;
227
- }
228
- top = bottom = 0;
229
- }
230
- }
231
- if (top !== 0 || bottom !== 0) {
232
- s += `(${top}, ${bottom})`;
233
- }
234
- return s;
235
- }
236
- function Search_phase1(obj, shape, prunvalue, maxl, depth, lm) {
237
- var m;
238
- var prunx;
239
- var shapex;
240
- if (prunvalue === 0 && maxl < 4) {
241
- return maxl === 0 && Search_init2(obj);
242
- }
243
- if (lm !== 0) {
244
- shapex = Shape_TwistMove[shape];
245
- prunx = ShapePrun[shapex];
246
- if (prunx < maxl) {
247
- obj.Search_move[depth] = 0;
248
- if (Search_phase1(obj, shapex, prunx, maxl - 1, depth + 1, 0)) {
249
- return true;
250
- }
251
- }
252
- }
253
- shapex = shape;
254
- if (lm <= 0) {
255
- m = 0;
256
- for (; ; ) {
257
- m += Shape_TopMove[shapex];
258
- shapex = ~~m >> 4;
259
- m &= 15;
260
- if (m >= 12) {
261
- break;
262
- }
263
- prunx = ShapePrun[shapex];
264
- if (prunx > maxl) {
265
- break;
266
- } else if (prunx < maxl) {
267
- obj.Search_move[depth] = m;
268
- if (Search_phase1(obj, shapex, prunx, maxl - 1, depth + 1, 1)) {
269
- return true;
270
- }
271
- }
272
- }
273
- }
274
- shapex = shape;
275
- if (lm <= 1) {
276
- m = 0;
277
- for (; ; ) {
278
- m += Shape_BottomMove[shapex];
279
- shapex = ~~m >> 4;
280
- m &= 15;
281
- if (m >= 6) {
282
- break;
283
- }
284
- prunx = ShapePrun[shapex];
285
- if (prunx > maxl) {
286
- break;
287
- } else if (prunx < maxl) {
288
- obj.Search_move[depth] = -m;
289
- if (Search_phase1(obj, shapex, prunx, maxl - 1, depth + 1, 2)) {
290
- return true;
291
- }
292
- }
293
- }
294
- }
295
- return false;
296
- }
297
- function Search_phase2(obj, edge, corner, topEdgeFirst, botEdgeFirst, ml, maxl, depth, lm) {
298
- var botEdgeFirstx;
299
- var cornerx;
300
- var edgex;
301
- var m;
302
- var prun1;
303
- var prun2;
304
- var topEdgeFirstx;
305
- if (maxl === 0 && !topEdgeFirst && botEdgeFirst) {
306
- return true;
307
- }
308
- if (lm !== 0 && topEdgeFirst === botEdgeFirst) {
309
- edgex = Square_TwistMove[edge];
310
- cornerx = Square_TwistMove[corner];
311
- if (SquarePrun[edgex << 1 | 1 - ml] < maxl && SquarePrun[cornerx << 1 | 1 - ml] < maxl) {
312
- obj.Search_move[depth] = 0;
313
- if (Search_phase2(
314
- obj,
315
- edgex,
316
- cornerx,
317
- topEdgeFirst,
318
- botEdgeFirst,
319
- 1 - ml,
320
- maxl - 1,
321
- depth + 1,
322
- 0
323
- )) {
324
- return true;
325
- }
326
- }
327
- }
328
- if (lm <= 0) {
329
- topEdgeFirstx = !topEdgeFirst;
330
- edgex = topEdgeFirstx ? Square_TopMove[edge] : edge;
331
- cornerx = topEdgeFirstx ? corner : Square_TopMove[corner];
332
- m = topEdgeFirstx ? 1 : 2;
333
- prun1 = SquarePrun[edgex << 1 | ml];
334
- prun2 = SquarePrun[cornerx << 1 | ml];
335
- while (m < 12 && prun1 <= maxl && prun1 <= maxl) {
336
- if (prun1 < maxl && prun2 < maxl) {
337
- obj.Search_move[depth] = m;
338
- if (Search_phase2(
339
- obj,
340
- edgex,
341
- cornerx,
342
- topEdgeFirstx,
343
- botEdgeFirst,
344
- ml,
345
- maxl - 1,
346
- depth + 1,
347
- 1
348
- )) {
349
- return true;
350
- }
351
- }
352
- topEdgeFirstx = !topEdgeFirstx;
353
- if (topEdgeFirstx) {
354
- edgex = Square_TopMove[edgex];
355
- prun1 = SquarePrun[edgex << 1 | ml];
356
- m += 1;
357
- } else {
358
- cornerx = Square_TopMove[cornerx];
359
- prun2 = SquarePrun[cornerx << 1 | ml];
360
- m += 2;
361
- }
362
- }
363
- }
364
- if (lm <= 1) {
365
- botEdgeFirstx = !botEdgeFirst;
366
- edgex = botEdgeFirstx ? Square_BottomMove[edge] : edge;
367
- cornerx = botEdgeFirstx ? corner : Square_BottomMove[corner];
368
- m = botEdgeFirstx ? 1 : 2;
369
- prun1 = SquarePrun[edgex << 1 | ml];
370
- prun2 = SquarePrun[cornerx << 1 | ml];
371
- while (m < (maxl > 3 ? 6 : 12) && prun1 <= maxl && prun1 <= maxl) {
372
- if (prun1 < maxl && prun2 < maxl) {
373
- obj.Search_move[depth] = -m;
374
- if (Search_phase2(
375
- obj,
376
- edgex,
377
- cornerx,
378
- topEdgeFirst,
379
- botEdgeFirstx,
380
- ml,
381
- maxl - 1,
382
- depth + 1,
383
- 2
384
- )) {
385
- return true;
386
- }
387
- }
388
- botEdgeFirstx = !botEdgeFirstx;
389
- if (botEdgeFirstx) {
390
- edgex = Square_BottomMove[edgex];
391
- prun1 = SquarePrun[edgex << 1 | ml];
392
- m += 1;
393
- } else {
394
- cornerx = Square_BottomMove[cornerx];
395
- prun2 = SquarePrun[cornerx << 1 | ml];
396
- m += 2;
397
- }
398
- }
399
- }
400
- return false;
401
- }
402
- function Search_solution(obj, c) {
403
- var shape;
404
- obj.Search_c = c;
405
- shape = FullCube_getShapeIdx(c);
406
- for (obj.Search_length1 = ShapePrun[shape]; obj.Search_length1 < 100; ++obj.Search_length1) {
407
- obj.Search_maxlen2 = Math.min(31 - obj.Search_length1, 17);
408
- if (Search_phase1(obj, shape, ShapePrun[shape], obj.Search_length1, 0, -1)) {
409
- break;
410
- }
411
- }
412
- return obj.Search_sol_string;
413
- }
414
- function Search_Search() {
415
- this.Search_move = [];
416
- this.Search_d = new FullCube_FullCube__Ljava_lang_String_2V();
417
- this.Search_sq = new Square_Square();
418
- }
419
- function Search() {
420
- }
421
- _ = Search_Search.prototype = Search.prototype;
422
- _.Search_c = null;
423
- _.Search_length1 = 0;
424
- _.Search_maxlen2 = 0;
425
- _.Search_sol_string = null;
426
- var Shape_$clinit_ran = false;
427
- function Shape_$clinit() {
428
- if (Shape_$clinit_ran) {
429
- return;
430
- }
431
- Shape_$clinit_ran = true;
432
- Shape_halflayer = [0, 3, 6, 12, 15, 24, 27, 30, 48, 51, 54, 60, 63];
433
- Shape_ShapeIdx = [];
434
- ShapePrun = [];
435
- Shape_TopMove = [];
436
- Shape_BottomMove = [];
437
- Shape_TwistMove = [];
438
- Shape_init();
439
- }
440
- function Shape_bottomMove(obj) {
441
- var move;
442
- var moveParity;
443
- move = 0;
444
- moveParity = 0;
445
- do {
446
- if ((obj.bottom & 2048) === 0) {
447
- move += 1;
448
- obj.bottom = obj.bottom << 1;
449
- } else {
450
- move += 2;
451
- obj.bottom = obj.bottom << 2 ^ 12291;
452
- }
453
- moveParity = 1 - moveParity;
454
- } while ((bitCount(obj.bottom & 63) & 1) !== 0);
455
- (bitCount(obj.bottom) & 2) === 0 && (obj.Shape_parity ^= moveParity);
456
- return move;
457
- }
458
- function Shape_getIdx(obj) {
459
- var ret;
460
- ret = binarySearch(Shape_ShapeIdx, obj.top << 12 | obj.bottom) << 1 | obj.Shape_parity;
461
- return ret;
462
- }
463
- function Shape_setIdx(obj, idx) {
464
- obj.Shape_parity = idx & 1;
465
- obj.top = Shape_ShapeIdx[~~idx >> 1];
466
- obj.bottom = obj.top & 4095;
467
- obj.top >>= 12;
468
- }
469
- function Shape_topMove(obj) {
470
- var move;
471
- var moveParity;
472
- move = 0;
473
- moveParity = 0;
474
- do {
475
- if ((obj.top & 2048) === 0) {
476
- move += 1;
477
- obj.top = obj.top << 1;
478
- } else {
479
- move += 2;
480
- obj.top = obj.top << 2 ^ 12291;
481
- }
482
- moveParity = 1 - moveParity;
483
- } while ((bitCount(obj.top & 63) & 1) !== 0);
484
- (bitCount(obj.top) & 2) === 0 && (obj.Shape_parity ^= moveParity);
485
- return move;
486
- }
487
- function Shape_Shape() {
488
- }
489
- function Shape_getShape2Idx(shp) {
490
- var ret;
491
- ret = binarySearch(Shape_ShapeIdx, shp & 16777215) << 1 | ~~shp >> 24;
492
- return ret;
493
- }
494
- function Shape_init() {
495
- var count;
496
- var depth;
497
- var dl;
498
- var done;
499
- var done0;
500
- var dr;
501
- var i;
502
- var idx;
503
- var m;
504
- var s;
505
- var ul;
506
- var ur;
507
- var value;
508
- var p1;
509
- var p3;
510
- var temp;
511
- count = 0;
512
- for (i = 0; i < 28561; ++i) {
513
- dr = Shape_halflayer[i % 13];
514
- dl = Shape_halflayer[~~(i / 13) % 13];
515
- ur = Shape_halflayer[~~(~~(i / 13) / 13) % 13];
516
- ul = Shape_halflayer[~~(~~(~~(i / 13) / 13) / 13)];
517
- value = ul << 18 | ur << 12 | dl << 6 | dr;
518
- bitCount(value) === 16 && (Shape_ShapeIdx[count++] = value);
519
- }
520
- s = new Shape_Shape();
521
- for (i = 0; i < 7356; ++i) {
522
- Shape_setIdx(s, i);
523
- Shape_TopMove[i] = Shape_topMove(s);
524
- Shape_TopMove[i] |= Shape_getIdx(s) << 4;
525
- Shape_setIdx(s, i);
526
- Shape_BottomMove[i] = Shape_bottomMove(s);
527
- Shape_BottomMove[i] |= Shape_getIdx(s) << 4;
528
- Shape_setIdx(s, i);
529
- temp = s.top & 63;
530
- p1 = bitCount(temp);
531
- p3 = bitCount(s.bottom & 4032);
532
- s.Shape_parity ^= 1 & ~~(p1 & p3) >> 1;
533
- s.top = s.top & 4032 | ~~s.bottom >> 6 & 63;
534
- s.bottom = s.bottom & 63 | temp << 6;
535
- Shape_TwistMove[i] = Shape_getIdx(s);
536
- }
537
- for (i = 0; i < 7536; ++i) {
538
- ShapePrun[i] = -1;
539
- }
540
- ShapePrun[Shape_getShape2Idx(14378715)] = 0;
541
- ShapePrun[Shape_getShape2Idx(31157686)] = 0;
542
- ShapePrun[Shape_getShape2Idx(23967451)] = 0;
543
- ShapePrun[Shape_getShape2Idx(7191990)] = 0;
544
- done = 4;
545
- done0 = 0;
546
- depth = -1;
547
- while (done !== done0) {
548
- done0 = done;
549
- ++depth;
550
- for (i = 0; i < 7536; ++i) {
551
- if (ShapePrun[i] === depth) {
552
- m = 0;
553
- idx = i;
554
- do {
555
- idx = Shape_TopMove[idx];
556
- m += idx & 15;
557
- idx >>= 4;
558
- if (ShapePrun[idx] === -1) {
559
- ++done;
560
- ShapePrun[idx] = depth + 1;
561
- }
562
- } while (m !== 12);
563
- m = 0;
564
- idx = i;
565
- do {
566
- idx = Shape_BottomMove[idx];
567
- m += idx & 15;
568
- idx >>= 4;
569
- if (ShapePrun[idx] === -1) {
570
- ++done;
571
- ShapePrun[idx] = depth + 1;
572
- }
573
- } while (m !== 12);
574
- idx = Shape_TwistMove[i];
575
- if (ShapePrun[idx] === -1) {
576
- ++done;
577
- ShapePrun[idx] = depth + 1;
578
- }
579
- }
580
- }
581
- }
582
- }
583
- function Shape() {
584
- }
585
- _ = Shape_Shape.prototype = Shape.prototype;
586
- _.bottom = 0;
587
- _.Shape_parity = 0;
588
- _.top = 0;
589
- var Shape_BottomMove;
590
- var Shape_ShapeIdx;
591
- var ShapePrun;
592
- var Shape_TopMove;
593
- var Shape_TwistMove;
594
- var Shape_halflayer;
595
- var Square_$clinit_ran = false;
596
- function Square_$clinit() {
597
- if (Square_$clinit_ran) {
598
- return;
599
- }
600
- Square_$clinit_ran = true;
601
- SquarePrun = [];
602
- Square_TwistMove = [];
603
- Square_TopMove = [];
604
- Square_BottomMove = [];
605
- fact = [1, 1, 2, 6, 24, 120, 720, 5040];
606
- Cnk = [];
607
- for (var i = 0; i < 12; ++i) {
608
- Cnk[i] = [];
609
- }
610
- Square_init();
611
- }
612
- function Square_Square() {
613
- }
614
- function get8Perm(arr) {
615
- var i;
616
- var idx;
617
- var v;
618
- var val;
619
- idx = 0;
620
- val = 1985229328;
621
- for (i = 0; i < 7; ++i) {
622
- v = arr[i] << 2;
623
- idx = (8 - i) * idx + (~~val >> v & 7);
624
- val -= 286331152 << v;
625
- }
626
- return idx & 65535;
627
- }
628
- function Square_init() {
629
- var check;
630
- var depth;
631
- var done;
632
- var find;
633
- var i;
634
- var idx;
635
- var idxx;
636
- var inv;
637
- var j;
638
- var m;
639
- var ml;
640
- var pos;
641
- var temp;
642
- for (i = 0; i < 12; ++i) {
643
- Cnk[i][0] = 1;
644
- Cnk[i][i] = 1;
645
- for (j = 1; j < i; ++j) {
646
- Cnk[i][j] = Cnk[i - 1][j - 1] + Cnk[i - 1][j];
647
- }
648
- }
649
- pos = [];
650
- for (i = 0; i < 40320; ++i) {
651
- set8Perm(pos, i);
652
- temp = pos[2];
653
- pos[2] = pos[4];
654
- pos[4] = temp;
655
- temp = pos[3];
656
- pos[3] = pos[5];
657
- pos[5] = temp;
658
- Square_TwistMove[i] = get8Perm(pos);
659
- set8Perm(pos, i);
660
- temp = pos[0];
661
- pos[0] = pos[1];
662
- pos[1] = pos[2];
663
- pos[2] = pos[3];
664
- pos[3] = temp;
665
- Square_TopMove[i] = get8Perm(pos);
666
- set8Perm(pos, i);
667
- temp = pos[4];
668
- pos[4] = pos[5];
669
- pos[5] = pos[6];
670
- pos[6] = pos[7];
671
- pos[7] = temp;
672
- Square_BottomMove[i] = get8Perm(pos);
673
- }
674
- for (i = 0; i < 80640; ++i) {
675
- SquarePrun[i] = -1;
676
- }
677
- SquarePrun[0] = 0;
678
- depth = 0;
679
- done = 1;
680
- while (done < 80640) {
681
- inv = depth >= 11;
682
- find = inv ? -1 : depth;
683
- check = inv ? depth : -1;
684
- ++depth;
685
- OUT: for (i = 0; i < 80640; ++i) {
686
- if (SquarePrun[i] === find) {
687
- idx = ~~i >> 1;
688
- ml = i & 1;
689
- idxx = Square_TwistMove[idx] << 1 | 1 - ml;
690
- if (SquarePrun[idxx] === check) {
691
- ++done;
692
- SquarePrun[inv ? i : idxx] = ~~(depth << 24) >> 24;
693
- if (inv) {
694
- continue OUT;
695
- }
696
- }
697
- idxx = idx;
698
- for (m = 0; m < 4; ++m) {
699
- idxx = Square_TopMove[idxx];
700
- if (SquarePrun[idxx << 1 | ml] === check) {
701
- ++done;
702
- SquarePrun[inv ? i : idxx << 1 | ml] = ~~(depth << 24) >> 24;
703
- if (inv) {
704
- continue OUT;
705
- }
706
- }
707
- }
708
- for (m = 0; m < 4; ++m) {
709
- idxx = Square_BottomMove[idxx];
710
- if (SquarePrun[idxx << 1 | ml] === check) {
711
- ++done;
712
- SquarePrun[inv ? i : idxx << 1 | ml] = ~~(depth << 24) >> 24;
713
- if (inv) {
714
- continue OUT;
715
- }
716
- }
717
- }
718
- }
719
- }
720
- }
721
- }
722
- function set8Perm(arr, idx) {
723
- var i;
724
- var m;
725
- var p;
726
- var v;
727
- var val;
728
- val = 1985229328;
729
- for (i = 0; i < 7; ++i) {
730
- p = fact[7 - i];
731
- v = ~~(idx / p);
732
- idx -= v * p;
733
- v <<= 2;
734
- arr[i] = ~~((~~val >> v & 7) << 24) >> 24;
735
- m = (1 << v) - 1;
736
- val = (val & m) + (~~val >> 4 & ~m);
737
- }
738
- arr[7] = ~~(val << 24) >> 24;
739
- }
740
- function Square() {
741
- }
742
- _ = Square_Square.prototype = Square.prototype;
743
- _.botEdgeFirst = false;
744
- _.cornperm = 0;
745
- _.edgeperm = 0;
746
- _.ml = 0;
747
- _.topEdgeFirst = false;
748
- var Square_BottomMove;
749
- var Cnk;
750
- var SquarePrun;
751
- var Square_TopMove;
752
- var Square_TwistMove;
753
- var fact;
754
- function bitCount(x) {
755
- x -= ~~x >> 1 & 1431655765;
756
- x = (~~x >> 2 & 858993459) + (x & 858993459);
757
- x = (~~x >> 4) + x & 252645135;
758
- x += ~~x >> 8;
759
- x += ~~x >> 16;
760
- return x & 63;
761
- }
762
- function binarySearch(sortedArray, key) {
763
- var high;
764
- var low;
765
- var mid;
766
- var midVal;
767
- low = 0;
768
- high = sortedArray.length - 1;
769
- while (low <= high) {
770
- mid = low + (~~(high - low) >> 1);
771
- midVal = sortedArray[mid];
772
- if (midVal < key) {
773
- low = mid + 1;
774
- } else if (midVal > key) {
775
- high = mid - 1;
776
- } else {
777
- return mid;
778
- }
779
- }
780
- return -low - 1;
781
- }
782
- var square1Solver_initialized = false;
783
- var square1SolverInitialize = function(doneCallback, _2, statusCallback) {
784
- if (!square1Solver_initialized) {
785
- Shape_$clinit();
786
- Square_$clinit();
787
- }
788
- if (statusCallback) {
789
- statusCallback("Done initializing Square-1.");
790
- }
791
- square1Solver_initialized = true;
792
- if (doneCallback != null) {
793
- doneCallback();
794
- }
795
- };
796
- var square1SolverGetRandomPosition = function() {
797
- if (!square1Solver_initialized) {
798
- square1SolverInitialize();
799
- }
800
- return FullCube_randomCube();
801
- };
802
- var square1SolverGenerate = function(pattern) {
803
- var search_search = new Search_Search();
804
- return Search_solution(search_search, pattern);
805
- };
806
- var square1SolverGetRandomScramble = function() {
807
- var randomPattern = square1SolverGetRandomPosition();
808
- var scrambleString = square1SolverGenerate(randomPattern);
809
- return {
810
- pattern: randomPattern,
811
- scramble_string: scrambleString
812
- };
813
- };
814
- function getRandomSquare1ScrambleString() {
815
- return square1SolverGetRandomScramble().scramble_string;
816
- }
817
- export {
818
- getRandomSquare1ScrambleString
819
- };
820
- //# sourceMappingURL=search-dynamic-solve-sq1-YESVPPLF.js.map