cubing 0.66.0 → 0.66.1
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.
- package/dist/bin/chunks/{chunk-VTD7RU7S.js → chunk-HS7R54XN.js} +2 -2
- package/dist/bin/order.js +1 -1
- package/dist/bin/puzzle-geometry-bin.js +1 -1
- package/dist/bin/scramble.js +1 -1
- package/dist/bin/svg.js +1 -1
- package/dist/lib/cubing/alg/index.d.ts +1 -1
- package/dist/lib/cubing/alg/index.js +1 -2
- package/dist/lib/cubing/bluetooth/index.d.ts +2 -2
- package/dist/lib/cubing/bluetooth/index.js +5 -6
- package/dist/lib/cubing/chunks/{big-puzzle-orientation-KCHMEEM7.js → big-puzzle-orientation-KJL4OFV2.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-XAOXLHYH.js → chunk-6R47S6MP.js} +24 -25
- package/dist/lib/cubing/chunks/{chunk-ZCZVKGKB.js → chunk-7LEVC3YR.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-7GUL3OBQ.js → chunk-BHVTDDUY.js} +0 -1
- package/dist/lib/cubing/chunks/{chunk-JL5REGXZ.js → chunk-IIJFVP3K.js} +6 -7
- package/dist/lib/cubing/chunks/{chunk-6RZGNWLS.js → chunk-KH2MQ7KY.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-L6OQRJJX.js → chunk-LBER75W4.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-ZV7PYR2S.js → chunk-NJ66FRKF.js} +3 -4
- package/dist/lib/cubing/chunks/{chunk-CAQY24I5.js → chunk-QOLD6GH2.js} +5 -6
- package/dist/lib/cubing/chunks/{chunk-CFZLXDM6.js → chunk-QZK3M7IM.js} +0 -1
- package/dist/lib/cubing/chunks/chunk-RDKH6CDA.js +0 -0
- package/dist/lib/cubing/chunks/{chunk-4KLW7Y6J.js → chunk-T5M3DY5P.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-K237RIQJ.js → chunk-UKAXYOG2.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-GHFBZYSV.js → chunk-YJH5LHFN.js} +0 -1
- package/dist/lib/cubing/chunks/{inside-BAQGCKLY.js → inside-UWSZBO4Y.js} +14 -15
- package/dist/lib/cubing/chunks/{puzzles-dynamic-3x3x3-FYXD7SIU.js → puzzles-dynamic-3x3x3-CMH2HHH5.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-4x4x4-AIGABOAR.js → puzzles-dynamic-4x4x4-UFAQS3QG.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-megaminx-2LVHIDL4.js → puzzles-dynamic-megaminx-EFR4GQFA.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-653A7JCM.js → puzzles-dynamic-side-events-KF3PEOJN.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-unofficial-2CY6GVZ4.js → puzzles-dynamic-unofficial-6BF3EWTI.js} +0 -1
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-KPAPKICT.js → search-dynamic-sgs-side-events-5GQDHSJR.js} +5 -6
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-WJZ2CWX5.js → search-dynamic-sgs-unofficial-YM23KVCN.js} +90 -78
- package/dist/lib/cubing/chunks/{search-dynamic-solve-3x3x3-B2L4IN34.js → search-dynamic-solve-3x3x3-6UMZH4WB.js} +3 -6
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-OLWUV6G6.js → search-dynamic-solve-4x4x4-KNSBAM7Q.js} +14 -17
- package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-WLOW7LAM.js → search-dynamic-solve-fto-CSXJYISF.js} +200 -90
- package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-KKUOVW5Y.js → search-dynamic-solve-kilominx-EHAUQJXS.js} +105 -113
- package/dist/lib/cubing/chunks/{search-dynamic-solve-master_tetraminx-GIS7T5B7.js → search-dynamic-solve-master_tetraminx-ZQ25QK7E.js} +99 -100
- package/dist/lib/cubing/chunks/search-worker-entry.js +2 -3
- package/dist/lib/cubing/chunks/{twips-J732JDZJ.js → twips-IMF5RNH5.js} +3 -4
- package/dist/lib/cubing/chunks/{twips_wasm_bg-TJNYGA2C-AP2O4LGG.js → twips_wasm_bg-TJNYGA2C-4JIZWC6Q.js} +1 -2
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-SFR3X64P.js → twisty-dynamic-3d-HSYJR5CM.js} +5 -6
- package/dist/lib/cubing/{index-Bfranlt_.d.ts → index-lAUL_nRN.d.ts} +1 -1
- package/dist/lib/cubing/{index-B2nOJwLe.d.ts → index-nWspzjVK.d.ts} +43 -39
- package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
- package/dist/lib/cubing/kpuzzle/index.js +2 -3
- package/dist/lib/cubing/notation/index.d.ts +1 -1
- package/dist/lib/cubing/notation/index.js +4 -5
- package/dist/lib/cubing/{outside-BdYfq43N.d.ts → outside-CD19aDjE.d.ts} +1 -1
- package/dist/lib/cubing/protocol/index.d.ts +1 -1
- package/dist/lib/cubing/protocol/index.js +4 -5
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +1 -1
- package/dist/lib/cubing/puzzle-geometry/index.js +375 -375
- package/dist/lib/cubing/puzzles/index.d.ts +1 -1
- package/dist/lib/cubing/puzzles/index.js +4 -5
- package/dist/lib/cubing/scramble/index.d.ts +1 -1
- package/dist/lib/cubing/scramble/index.js +8 -9
- package/dist/lib/cubing/search/index.d.ts +1 -1
- package/dist/lib/cubing/search/index.js +7 -8
- package/dist/lib/cubing/stream/index.d.ts +1 -1
- package/dist/lib/cubing/stream/index.js +1 -2
- package/dist/lib/cubing/twisty/index.d.ts +1 -1
- package/dist/lib/cubing/twisty/index.js +6 -7
- package/package.json +1 -1
- package/dist/lib/cubing/alg/index.js.map +0 -7
- package/dist/lib/cubing/bluetooth/index.js.map +0 -7
- package/dist/lib/cubing/chunks/big-puzzle-orientation-KCHMEEM7.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-4KLW7Y6J.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-6RZGNWLS.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-7GUL3OBQ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-CAQY24I5.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-CFZLXDM6.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-GHFBZYSV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-JL5REGXZ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-K237RIQJ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-L6OQRJJX.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-NAPITA3L.js +0 -1
- package/dist/lib/cubing/chunks/chunk-NAPITA3L.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-XAOXLHYH.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-ZCZVKGKB.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-ZV7PYR2S.js.map +0 -7
- package/dist/lib/cubing/chunks/inside-BAQGCKLY.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-3x3x3-FYXD7SIU.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-4x4x4-AIGABOAR.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-653A7JCM.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-unofficial-2CY6GVZ4.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-KPAPKICT.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-WJZ2CWX5.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-B2L4IN34.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-OLWUV6G6.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-fto-WLOW7LAM.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-KKUOVW5Y.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-master_tetraminx-GIS7T5B7.js.map +0 -7
- package/dist/lib/cubing/chunks/search-worker-entry.js.map +0 -7
- package/dist/lib/cubing/chunks/twips-J732JDZJ.js.map +0 -7
- package/dist/lib/cubing/chunks/twips_wasm_bg-TJNYGA2C-AP2O4LGG.js.map +0 -7
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-SFR3X64P.js.map +0 -7
- package/dist/lib/cubing/kpuzzle/index.js.map +0 -7
- package/dist/lib/cubing/notation/index.js.map +0 -7
- package/dist/lib/cubing/protocol/index.js.map +0 -7
- package/dist/lib/cubing/puzzle-geometry/index.js.map +0 -7
- package/dist/lib/cubing/puzzles/index.js.map +0 -7
- package/dist/lib/cubing/scramble/index.js.map +0 -7
- package/dist/lib/cubing/search/index.js.map +0 -7
- package/dist/lib/cubing/stream/index.js.map +0 -7
- package/dist/lib/cubing/twisty/index.js.map +0 -7
- /package/dist/bin/chunks/{chunk-VTD7RU7S.js.map → chunk-HS7R54XN.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/cubing/vendor/mpl/xyzzy/master_tetraminx-solver.
|
|
1
|
+
// src/cubing/vendor/mpl/xyzzy/master_tetraminx-solver.ts
|
|
2
2
|
import { randomUIntBelow } from "random-uint-below";
|
|
3
3
|
function factorial(n) {
|
|
4
4
|
if (n < 2) {
|
|
@@ -11,7 +11,7 @@ function factorial(n) {
|
|
|
11
11
|
return f;
|
|
12
12
|
}
|
|
13
13
|
function identity_permutation(n) {
|
|
14
|
-
|
|
14
|
+
const a = Array(n);
|
|
15
15
|
for (let i = 0; i < n; i++) {
|
|
16
16
|
a[i] = i;
|
|
17
17
|
}
|
|
@@ -24,10 +24,10 @@ function permutation_to_index(perm) {
|
|
|
24
24
|
let ind = 0;
|
|
25
25
|
while (n > 1) {
|
|
26
26
|
n--;
|
|
27
|
-
|
|
27
|
+
const e = perm[0];
|
|
28
28
|
ind += e * f;
|
|
29
29
|
for (let i = 0; i < n; i++) {
|
|
30
|
-
|
|
30
|
+
const x = perm[i + 1];
|
|
31
31
|
perm[i] = x - (x > e);
|
|
32
32
|
}
|
|
33
33
|
f /= n;
|
|
@@ -35,7 +35,7 @@ function permutation_to_index(perm) {
|
|
|
35
35
|
return ind;
|
|
36
36
|
}
|
|
37
37
|
function index_to_evenpermutation(ind, n) {
|
|
38
|
-
|
|
38
|
+
const perm = [];
|
|
39
39
|
let f = factorial(n - 1) / 2;
|
|
40
40
|
let parity = 0;
|
|
41
41
|
for (let i = 0; i < n - 1; i++) {
|
|
@@ -62,8 +62,8 @@ function evenpermutation_to_index(perm) {
|
|
|
62
62
|
return permutation_to_index(perm) >> 1;
|
|
63
63
|
}
|
|
64
64
|
var [evenpermutation12_to_index, index_to_evenpermutation12] = (() => {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const index_in_set_bits = new Int8Array(4096 * 12);
|
|
66
|
+
const look_up_set_bits = new Int8Array(4096 * 12);
|
|
67
67
|
for (let i = 0; i < 4096; i++) {
|
|
68
68
|
for (let j = 0, counter = 0; j < 12; j++) {
|
|
69
69
|
if ((i >>> j & 1) === 0) {
|
|
@@ -79,7 +79,7 @@ var [evenpermutation12_to_index, index_to_evenpermutation12] = (() => {
|
|
|
79
79
|
let f = 19958400;
|
|
80
80
|
let ind = 0;
|
|
81
81
|
for (let i = 0; i < 10; i++) {
|
|
82
|
-
|
|
82
|
+
const v = perm[i];
|
|
83
83
|
ind += index_in_set_bits[unused | v << 12] * f;
|
|
84
84
|
unused &= ~(1 << v);
|
|
85
85
|
f /= 11 - i;
|
|
@@ -91,10 +91,10 @@ var [evenpermutation12_to_index, index_to_evenpermutation12] = (() => {
|
|
|
91
91
|
let f = 19958400;
|
|
92
92
|
let parity = 0;
|
|
93
93
|
for (let i = 0; i < 10; i++) {
|
|
94
|
-
|
|
94
|
+
const a = ind / f | 0;
|
|
95
95
|
ind -= a * f;
|
|
96
96
|
parity ^= a & 1;
|
|
97
|
-
|
|
97
|
+
const v = look_up_set_bits[unused | a << 12];
|
|
98
98
|
perm[i] = v;
|
|
99
99
|
unused &= ~(1 << v);
|
|
100
100
|
f /= 11 - i;
|
|
@@ -106,21 +106,21 @@ var [evenpermutation12_to_index, index_to_evenpermutation12] = (() => {
|
|
|
106
106
|
return [evenpermutation12_to_index2, index_to_evenpermutation122];
|
|
107
107
|
})();
|
|
108
108
|
function compose(A, B) {
|
|
109
|
-
|
|
109
|
+
const C = [];
|
|
110
110
|
for (let i = 0; i < B.length; i++) {
|
|
111
111
|
C[i] = A[B[i]];
|
|
112
112
|
}
|
|
113
113
|
return C;
|
|
114
114
|
}
|
|
115
115
|
function invert(perm) {
|
|
116
|
-
|
|
116
|
+
const inv = [];
|
|
117
117
|
for (let i = 0; i < perm.length; i++) {
|
|
118
118
|
inv[perm[i]] = i;
|
|
119
119
|
}
|
|
120
120
|
return inv;
|
|
121
121
|
}
|
|
122
122
|
function permutation_from_cycle(cycle, n) {
|
|
123
|
-
|
|
123
|
+
const perm = [];
|
|
124
124
|
for (let i = 0; i < n; i++) {
|
|
125
125
|
perm[i] = i;
|
|
126
126
|
}
|
|
@@ -136,13 +136,13 @@ function permutation_from_cycles(cycles, n) {
|
|
|
136
136
|
return cycles.map((cycle) => permutation_from_cycle(cycle, n)).reduce(compose);
|
|
137
137
|
}
|
|
138
138
|
function compose_state(state1, state2) {
|
|
139
|
-
|
|
139
|
+
const co = Array(4);
|
|
140
140
|
for (let i = 0; i < 4; i++) {
|
|
141
141
|
co[i] = (state1.co[i] + state2.co[i]) % 3;
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
const mp = compose(state1.mp, state2.mp);
|
|
144
|
+
const wp = compose(state1.wp, state2.wp);
|
|
145
|
+
const cp = compose(state1.cp, state2.cp);
|
|
146
146
|
return { co, mp, wp, cp };
|
|
147
147
|
}
|
|
148
148
|
var solved = {
|
|
@@ -270,24 +270,24 @@ function moves_commute(i, j) {
|
|
|
270
270
|
return (i ^ j) === 4;
|
|
271
271
|
}
|
|
272
272
|
function stringify_move_sequence(move_sequence) {
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
const suffixes = ["0", "", "'"];
|
|
274
|
+
const s = move_sequence.map(([m, r]) => move_names[m] + suffixes[r]);
|
|
275
275
|
return s.join(" ");
|
|
276
276
|
}
|
|
277
277
|
function generate_random_state() {
|
|
278
|
-
|
|
278
|
+
const co = Array(4);
|
|
279
279
|
for (let i = 0; i < 4; i++) {
|
|
280
280
|
co[i] = randomUIntBelow(3);
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
const mp = index_to_evenpermutation(randomUIntBelow(factorial(6) / 2), 6);
|
|
283
283
|
for (let i = 0, parity = 0; i < 6; i++) {
|
|
284
|
-
|
|
284
|
+
const eo = i === 5 ? parity : randomUIntBelow(2);
|
|
285
285
|
parity ^= eo;
|
|
286
286
|
mp[i] += eo * 6;
|
|
287
287
|
mp[i + 6] = (mp[i] + 6) % 12;
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
const wp = index_to_evenpermutation(randomUIntBelow(factorial(12) / 2), 12);
|
|
290
|
+
const cp = index_to_evenpermutation(randomUIntBelow(factorial(4) / 2), 4);
|
|
291
291
|
return { co, mp, wp, cp };
|
|
292
292
|
}
|
|
293
293
|
function generate_random_state_scramble() {
|
|
@@ -300,67 +300,67 @@ function generate_scramble_sequence(tips = true, obfuscate_tips = false) {
|
|
|
300
300
|
if (!tips) {
|
|
301
301
|
return scramble_string;
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
const tip_names = ["u", "l", "r", "b"];
|
|
304
|
+
const suffixes = ["0", "", "'"];
|
|
305
305
|
if (!obfuscate_tips) {
|
|
306
306
|
for (let i = 0; i < 4; i++) {
|
|
307
|
-
|
|
307
|
+
const x = randomUIntBelow(3);
|
|
308
308
|
if (x !== 0) {
|
|
309
309
|
scramble_string += ` ${tip_names[i]}${suffixes[x]}`;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
return scramble_string.trim();
|
|
313
313
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
const amount = [];
|
|
315
|
+
const amount_pre = [];
|
|
316
|
+
const amount_post = [];
|
|
317
317
|
for (let i = 0; i < 4; i++) {
|
|
318
318
|
amount[i] = randomUIntBelow(3);
|
|
319
319
|
amount_pre[i] = randomUIntBelow(3);
|
|
320
320
|
amount_post[i] = (amount[i] - amount_pre[i] + 3) % 3;
|
|
321
321
|
}
|
|
322
|
-
|
|
322
|
+
const weight = (arr) => arr.filter((x) => x !== 0).length;
|
|
323
323
|
while (!(weight(amount_pre) >= 1 && weight(amount_post) >= 1 && weight(amount_pre) + weight(amount_post) >= 4)) {
|
|
324
324
|
for (let i = 0; i < 4; i++) {
|
|
325
325
|
amount_pre[i] = randomUIntBelow(3);
|
|
326
326
|
amount_post[i] = (amount[i] - amount_pre[i] + 3) % 3;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
const prepend = amount_pre.map((x, i) => x !== 0 ? `${tip_names[i]}${suffixes[x]} ` : "").join("");
|
|
330
|
+
const append = amount_post.map((x, i) => x !== 0 ? ` ${tip_names[i]}${suffixes[x]}` : "").join("");
|
|
331
331
|
return prepend + scramble_string + append;
|
|
332
332
|
}
|
|
333
333
|
function solve(state) {
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
const phase1_indices = index_phase1(state);
|
|
335
|
+
const phase2_mtables = [
|
|
336
336
|
generate_phase2_permutation_mtable(),
|
|
337
337
|
generate_phase2_orientation_mtable()
|
|
338
338
|
];
|
|
339
|
-
|
|
339
|
+
const phase2_ptables = [
|
|
340
340
|
generate_phase2_permutation_ptable(),
|
|
341
341
|
generate_phase2_orientation_ptable()
|
|
342
342
|
];
|
|
343
|
-
|
|
344
|
-
let best
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
const phase1gen = phase1_ida_solve_gen(phase1_indices);
|
|
344
|
+
let best;
|
|
345
|
+
const intermediate_states = /* @__PURE__ */ new Set();
|
|
346
|
+
const start_time = performance.now();
|
|
347
347
|
for (let i = 0; i < 22; i++) {
|
|
348
|
-
|
|
348
|
+
const { value: sol1, done } = phase1gen.next();
|
|
349
349
|
let new_state = state;
|
|
350
|
-
for (
|
|
350
|
+
for (const [m, r] of sol1) {
|
|
351
351
|
for (let i2 = 0; i2 < r; i2++) {
|
|
352
352
|
new_state = compose_state(new_state, moves[m]);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
const stringified_state = JSON.stringify(new_state);
|
|
356
356
|
if (intermediate_states.has(stringified_state)) {
|
|
357
357
|
continue;
|
|
358
358
|
} else {
|
|
359
359
|
intermediate_states.add(stringified_state);
|
|
360
360
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
const phase2_indices = index_phase2(new_state);
|
|
362
|
+
const moves_left = best ? best.length - sol1.length - 1 : 999999;
|
|
363
|
+
const sol2 = ida_solve_gen(
|
|
364
364
|
phase2_indices,
|
|
365
365
|
phase2_mtables,
|
|
366
366
|
phase2_ptables,
|
|
@@ -382,8 +382,8 @@ function determine_V_coset(p) {
|
|
|
382
382
|
return p[3 ^ p.indexOf(3)];
|
|
383
383
|
}
|
|
384
384
|
function index_phase1(state) {
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
const w = compose(invert(state.mp), state.wp);
|
|
386
|
+
const c = (state.co.reduce((x, y) => x + y) - determine_V_coset(state.cp) + 3) % 3;
|
|
387
387
|
return [0, 1, 2, 3, 4, 5].map(
|
|
388
388
|
(i) => i + 6 * w.indexOf(i) + 72 * w.indexOf(i + 6) + 864 * c
|
|
389
389
|
);
|
|
@@ -393,7 +393,7 @@ var phase1_permtable_minv = [];
|
|
|
393
393
|
var phase1_permtable_w = [];
|
|
394
394
|
var phase1_permtable_winv = [];
|
|
395
395
|
for (let i = 0; i < N_MOVES; i++) {
|
|
396
|
-
|
|
396
|
+
const move = moves[i];
|
|
397
397
|
phase1_permtable_m[i] = move.mp;
|
|
398
398
|
phase1_permtable_minv[i] = invert(move.mp);
|
|
399
399
|
phase1_permtable_w[i] = move.wp;
|
|
@@ -466,7 +466,7 @@ var phase1_coord_to_score = new Int8Array(6 * 12 * 12 * 3);
|
|
|
466
466
|
for (let i = 0; i < 6; i++) {
|
|
467
467
|
for (let j = 0; j < 12; j++) {
|
|
468
468
|
for (let k = 0; k < 12; k++) {
|
|
469
|
-
|
|
469
|
+
const index = i + 6 * j + 72 * k;
|
|
470
470
|
let score = 2;
|
|
471
471
|
if (j === i) {
|
|
472
472
|
score++;
|
|
@@ -485,17 +485,17 @@ for (let i = 0; i < 6; i++) {
|
|
|
485
485
|
}
|
|
486
486
|
function* phase1_ida_solve_gen(coords) {
|
|
487
487
|
let bound = 0;
|
|
488
|
-
|
|
489
|
-
|
|
488
|
+
const mtable = generate_phase1_pairingc_mtable();
|
|
489
|
+
const ptable = generate_phase1_pairing2c_ptable();
|
|
490
490
|
while (true) {
|
|
491
491
|
yield* phase1_ida_search_gen(...coords, mtable, ptable, bound, -1);
|
|
492
492
|
bound++;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
function* phase1_ida_search_gen(a, b, c, d, e, f, mtable, ptable, bound, last) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
496
|
+
const nmoves = N_MOVES;
|
|
497
|
+
const score = phase1_coord_to_score[a] + phase1_coord_to_score[b] + phase1_coord_to_score[c] + phase1_coord_to_score[d] + phase1_coord_to_score[e] + phase1_coord_to_score[f];
|
|
498
|
+
const heuristic = Math.max(
|
|
499
499
|
ptable[a % 864 + b * 864],
|
|
500
500
|
ptable[c % 864 + b * 864],
|
|
501
501
|
ptable[e % 864 + b * 864],
|
|
@@ -543,7 +543,7 @@ function* phase1_ida_search_gen(a, b, c, d, e, f, mtable, ptable, bound, last) {
|
|
|
543
543
|
D = mtable[D][m];
|
|
544
544
|
E = mtable[E][m];
|
|
545
545
|
F = mtable[F][m];
|
|
546
|
-
|
|
546
|
+
const subpath_gen = phase1_ida_search_gen(
|
|
547
547
|
A,
|
|
548
548
|
B,
|
|
549
549
|
C,
|
|
@@ -556,7 +556,7 @@ function* phase1_ida_search_gen(a, b, c, d, e, f, mtable, ptable, bound, last) {
|
|
|
556
556
|
m
|
|
557
557
|
);
|
|
558
558
|
while (true) {
|
|
559
|
-
|
|
559
|
+
const { value: subpath, done } = subpath_gen.next();
|
|
560
560
|
if (done) {
|
|
561
561
|
break;
|
|
562
562
|
}
|
|
@@ -566,11 +566,11 @@ function* phase1_ida_search_gen(a, b, c, d, e, f, mtable, ptable, bound, last) {
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
function index_phase2(state) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
const edges = state.mp;
|
|
570
|
+
const ep = evenpermutation_to_index(edges.slice(0, 6).map((x) => x % 6));
|
|
571
|
+
const eo = edges.slice(0, 5).map((x, i) => (x >= 6) * 2 ** i).reduce((x, y) => x + y);
|
|
572
|
+
const co = state.co.map((x, i) => x * 3 ** i).reduce((x, y) => x + y);
|
|
573
|
+
const cloc = state.cp.indexOf(0);
|
|
574
574
|
return [ep + 360 * cloc, eo + 32 * co];
|
|
575
575
|
}
|
|
576
576
|
var tables = {};
|
|
@@ -578,18 +578,18 @@ function generate_phase1_pairing_mtable() {
|
|
|
578
578
|
if (tables.phase1pm) {
|
|
579
579
|
return tables.phase1pm;
|
|
580
580
|
}
|
|
581
|
-
|
|
581
|
+
const mtable = Array(6 * 12 * 12).fill().map(() => Array(N_MOVES).fill(-1));
|
|
582
582
|
for (let midge = 0; midge < 6; midge++) {
|
|
583
583
|
for (let wingl = 0; wingl < 12; wingl++) {
|
|
584
584
|
for (let wingh = 0; wingh < 12; wingh++) {
|
|
585
585
|
if (wingl === wingh) {
|
|
586
586
|
continue;
|
|
587
587
|
}
|
|
588
|
-
|
|
588
|
+
const index = midge + 6 * wingl + 72 * wingh;
|
|
589
589
|
for (let m = 0; m < N_MOVES; m++) {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
590
|
+
const new_midge = phase1_permtable_minv[m][midge];
|
|
591
|
+
const new_wingl = phase1_permtable_winv[m][wingl];
|
|
592
|
+
const new_wingh = phase1_permtable_winv[m][wingh];
|
|
593
593
|
if (new_midge < 6) {
|
|
594
594
|
mtable[index][m] = new_midge + 6 * new_wingl + 72 * new_wingh;
|
|
595
595
|
} else {
|
|
@@ -605,11 +605,11 @@ function generate_phase1_pairingc_mtable() {
|
|
|
605
605
|
if (tables.phase1pcm) {
|
|
606
606
|
return tables.phase1pcm;
|
|
607
607
|
}
|
|
608
|
-
|
|
609
|
-
|
|
608
|
+
const mtable_pairing = generate_phase1_pairing_mtable();
|
|
609
|
+
const mtable = Array(mtable_pairing.length * 3).fill().map(() => Array(N_MOVES).fill(-1));
|
|
610
610
|
for (let index = 0; index < mtable_pairing.length; index++) {
|
|
611
611
|
for (let m = 0; m < N_MOVES; m++) {
|
|
612
|
-
|
|
612
|
+
const new_index = mtable_pairing[index][m];
|
|
613
613
|
mtable[index][m] = new_index + 6 * 12 * 12 * phase1_c_update[m];
|
|
614
614
|
mtable[index + 6 * 12 * 12][m] = new_index + 6 * 12 * 12 * ((phase1_c_update[m] + 1) % 3);
|
|
615
615
|
mtable[index + 2 * 6 * 12 * 12][m] = new_index + 6 * 12 * 12 * ((phase1_c_update[m] + 2) % 3);
|
|
@@ -621,11 +621,11 @@ function generate_phase1_pairing2c_ptable() {
|
|
|
621
621
|
if (tables.phase1p2cp) {
|
|
622
622
|
return tables.phase1p2cp;
|
|
623
623
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
624
|
+
const mtable_noc = generate_phase1_pairing_mtable();
|
|
625
|
+
const mtable = generate_phase1_pairingc_mtable();
|
|
626
|
+
const ptable = new Int8Array((6 * 12 * 12) ** 2 * 3);
|
|
627
627
|
ptable.fill(-1);
|
|
628
|
-
|
|
628
|
+
const g = [0, 1, 2, 3, 4, 5].map((x) => x + 6 * x + 72 * (x + 6));
|
|
629
629
|
for (let i = 0; i < 6; i++) {
|
|
630
630
|
for (let j = 0; j < 6; j++) {
|
|
631
631
|
if (i === j) {
|
|
@@ -641,15 +641,15 @@ function generate_phase1_pairing2c_ptable() {
|
|
|
641
641
|
if (ptable[index] !== dist) {
|
|
642
642
|
continue;
|
|
643
643
|
}
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
const index0 = index % 864;
|
|
645
|
+
const index1 = Math.floor(index / 864);
|
|
646
646
|
for (let m = 0; m < N_MOVES; m++) {
|
|
647
647
|
let new_index0 = index0;
|
|
648
648
|
let new_index1 = index1;
|
|
649
649
|
for (let r = 1; r <= 2; r++) {
|
|
650
650
|
new_index0 = mtable_noc[new_index0][m];
|
|
651
651
|
new_index1 = mtable[new_index1][m];
|
|
652
|
-
|
|
652
|
+
const new_index = new_index0 + 864 * new_index1;
|
|
653
653
|
if (ptable[new_index] === -1) {
|
|
654
654
|
changed = true;
|
|
655
655
|
ptable[new_index] = dist + 1;
|
|
@@ -668,19 +668,19 @@ function generate_phase2_permutation_mtable() {
|
|
|
668
668
|
if (tables.phase2pm) {
|
|
669
669
|
return tables.phase2pm;
|
|
670
670
|
}
|
|
671
|
-
|
|
671
|
+
const mtable = Array(1440).fill().map(() => Array(N_MOVES_PHASE2));
|
|
672
672
|
for (let ep = 0; ep < 360; ep++) {
|
|
673
|
-
|
|
673
|
+
const perm = index_to_evenpermutation(ep, 6);
|
|
674
674
|
for (let i = 0; i < 6; i++) {
|
|
675
675
|
perm[i + 6] = perm[i] + 6;
|
|
676
676
|
}
|
|
677
677
|
for (let m = 0; m < N_MOVES_PHASE2; m++) {
|
|
678
|
-
|
|
679
|
-
|
|
678
|
+
const new_perm = compose(perm, moves[m].mp);
|
|
679
|
+
const new_ep = evenpermutation_to_index(
|
|
680
680
|
new_perm.slice(0, 6).map((x) => x % 6)
|
|
681
681
|
);
|
|
682
682
|
for (let new_cloc = 0; new_cloc < 4; new_cloc++) {
|
|
683
|
-
|
|
683
|
+
const cloc = moves[m].cp[new_cloc];
|
|
684
684
|
mtable[ep + 360 * cloc][m] = new_ep + 360 * new_cloc;
|
|
685
685
|
}
|
|
686
686
|
}
|
|
@@ -691,25 +691,25 @@ function generate_phase2_orientation_mtable() {
|
|
|
691
691
|
if (tables.phase2om) {
|
|
692
692
|
return tables.phase2om;
|
|
693
693
|
}
|
|
694
|
-
|
|
694
|
+
const mtable = Array(32 * 81).fill().map(() => Array(N_MOVES_PHASE2));
|
|
695
695
|
for (let eo = 0; eo < 32; eo++) {
|
|
696
|
-
|
|
696
|
+
const eo_array = [0, 1, 2, 3, 4].map((i) => eo >> i & 1);
|
|
697
697
|
eo_array[5] = eo_array.reduce((x, y) => x ^ y);
|
|
698
|
-
|
|
698
|
+
const perm = [];
|
|
699
699
|
for (let i = 0; i < 6; i++) {
|
|
700
700
|
perm[i] = i + 6 * eo_array[i];
|
|
701
701
|
perm[i + 6] = i + 6 * (eo_array[i] ^ 1);
|
|
702
702
|
}
|
|
703
703
|
for (let co = 0; co < 81; co++) {
|
|
704
|
-
|
|
704
|
+
const co_array = [0, 1, 2, 3].map((i) => Math.floor(co / 3 ** i) % 3);
|
|
705
705
|
for (let m = 0; m < N_MOVES_PHASE2; m++) {
|
|
706
|
-
|
|
707
|
-
|
|
706
|
+
const new_perm = compose(perm, moves[m].mp);
|
|
707
|
+
const new_eo_array = new_perm.slice(0, 5).map((x) => +(x >= 6));
|
|
708
708
|
let new_eo = 0;
|
|
709
709
|
for (let i = 0; i < 5; i++) {
|
|
710
710
|
new_eo += new_eo_array[i] << i;
|
|
711
711
|
}
|
|
712
|
-
|
|
712
|
+
const new_co_array = co_array.map((x, i) => (x + moves[m].co[i]) % 3);
|
|
713
713
|
let new_co = 0;
|
|
714
714
|
for (let i = 0; i < 4; i++) {
|
|
715
715
|
new_co += new_co_array[i] * 3 ** i;
|
|
@@ -733,15 +733,15 @@ function generate_phase2_orientation_ptable() {
|
|
|
733
733
|
return tables.phase2op = bfs(generate_phase2_orientation_mtable(), [0]);
|
|
734
734
|
}
|
|
735
735
|
function bfs(mtable, goal_states) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
736
|
+
const N = mtable.length;
|
|
737
|
+
const nmoves = mtable[0].length;
|
|
738
|
+
const ptable = Array(N).fill(-1);
|
|
739
739
|
let queue = goal_states.slice();
|
|
740
740
|
let new_queue = [];
|
|
741
741
|
let depth = 0;
|
|
742
742
|
while (queue.length > 0) {
|
|
743
743
|
new_queue.length = 0;
|
|
744
|
-
for (
|
|
744
|
+
for (const state of queue) {
|
|
745
745
|
if (ptable[state] !== -1) {
|
|
746
746
|
continue;
|
|
747
747
|
}
|
|
@@ -760,7 +760,7 @@ function bfs(mtable, goal_states) {
|
|
|
760
760
|
return ptable;
|
|
761
761
|
}
|
|
762
762
|
function* ida_solve_gen(indices, mtables, ptables, moves_left) {
|
|
763
|
-
|
|
763
|
+
const ncoords = indices.length;
|
|
764
764
|
let bound = 0;
|
|
765
765
|
for (let i = 0; i < ncoords; i++) {
|
|
766
766
|
bound = Math.max(bound, ptables[i][indices[i]]);
|
|
@@ -771,8 +771,8 @@ function* ida_solve_gen(indices, mtables, ptables, moves_left) {
|
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
function* ida_search_gen(indices, mtables, ptables, bound, last) {
|
|
774
|
-
|
|
775
|
-
|
|
774
|
+
const ncoords = indices.length;
|
|
775
|
+
const nmoves = mtables[0][0].length;
|
|
776
776
|
let heuristic = 0;
|
|
777
777
|
for (let i = 0; i < ncoords; i++) {
|
|
778
778
|
heuristic = Math.max(heuristic, ptables[i][indices[i]]);
|
|
@@ -794,13 +794,13 @@ function* ida_search_gen(indices, mtables, ptables, bound, last) {
|
|
|
794
794
|
if (m < last && moves_commute(m, last)) {
|
|
795
795
|
continue;
|
|
796
796
|
}
|
|
797
|
-
|
|
797
|
+
const new_indices = indices.slice();
|
|
798
798
|
for (let c = 0; c < ncoords; c++) {
|
|
799
799
|
new_indices[c] = mtables[c][indices[c]][m];
|
|
800
800
|
}
|
|
801
801
|
let r = 1;
|
|
802
802
|
while (indices.some((_, i) => indices[i] !== new_indices[i])) {
|
|
803
|
-
|
|
803
|
+
const subpath_gen = ida_search_gen(
|
|
804
804
|
new_indices,
|
|
805
805
|
mtables,
|
|
806
806
|
ptables,
|
|
@@ -808,7 +808,7 @@ function* ida_search_gen(indices, mtables, ptables, bound, last) {
|
|
|
808
808
|
m
|
|
809
809
|
);
|
|
810
810
|
while (true) {
|
|
811
|
-
|
|
811
|
+
const { value: subpath, done } = subpath_gen.next();
|
|
812
812
|
if (done) {
|
|
813
813
|
break;
|
|
814
814
|
}
|
|
@@ -827,4 +827,3 @@ async function randomMasterTetraminxScrambleString() {
|
|
|
827
827
|
export {
|
|
828
828
|
randomMasterTetraminxScrambleString
|
|
829
829
|
};
|
|
830
|
-
//# sourceMappingURL=search-dynamic-solve-master_tetraminx-GIS7T5B7.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
exposeAPI
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BHVTDDUY.js";
|
|
4
4
|
|
|
5
5
|
// src/cubing/search/worker-workarounds/search-worker-entry.js
|
|
6
6
|
if (exposeAPI.expose) {
|
|
7
|
-
void import("./inside-
|
|
7
|
+
void import("./inside-UWSZBO4Y.js").then(() => {
|
|
8
8
|
if (globalThis.postMessage) {
|
|
9
9
|
globalThis.postMessage("comlink-exposed");
|
|
10
10
|
} else {
|
|
@@ -16,4 +16,3 @@ var WORKER_ENTRY_FILE_URL = import.meta.url;
|
|
|
16
16
|
export {
|
|
17
17
|
WORKER_ENTRY_FILE_URL
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=search-worker-entry.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-YJH5LHFN.js";
|
|
2
2
|
import {
|
|
3
3
|
Alg
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QZK3M7IM.js";
|
|
5
5
|
|
|
6
6
|
// src/cubing/vendor/mpl/twips/index.js
|
|
7
7
|
var wasm;
|
|
@@ -387,7 +387,7 @@ var twips_wasm_default = __wbg_init;
|
|
|
387
387
|
var cachedInitWrapper;
|
|
388
388
|
async function initWrapper() {
|
|
389
389
|
await (cachedInitWrapper ??= (async () => {
|
|
390
|
-
const wasmUint8Array = (await import("./twips_wasm_bg-TJNYGA2C-
|
|
390
|
+
const wasmUint8Array = (await import("./twips_wasm_bg-TJNYGA2C-4JIZWC6Q.js")).default;
|
|
391
391
|
await twips_wasm_default({ module_or_path: wasmUint8Array.buffer });
|
|
392
392
|
})());
|
|
393
393
|
}
|
|
@@ -430,4 +430,3 @@ export {
|
|
|
430
430
|
wasmRandomScrambleForEvent2 as wasmRandomScrambleForEvent,
|
|
431
431
|
wasmTwips2 as wasmTwips
|
|
432
432
|
};
|
|
433
|
-
//# sourceMappingURL=twips-J732JDZJ.js.map
|