cubing 0.29.0 → 0.29.2

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 (89) hide show
  1. package/README.md +1 -6
  2. package/dist/esm/alg/index.js +1 -1
  3. package/dist/esm/bluetooth/index.js +36 -31
  4. package/dist/esm/bluetooth/index.js.map +2 -2
  5. package/dist/esm/{chunk-NI7U4XAZ.js → chunk-7OIUETFU.js} +9 -8
  6. package/dist/esm/chunk-7OIUETFU.js.map +7 -0
  7. package/dist/esm/{chunk-DZGFGBKT.js → chunk-EOEJDDXN.js} +95 -58
  8. package/dist/esm/chunk-EOEJDDXN.js.map +7 -0
  9. package/dist/esm/{chunk-WXCNEGW3.js → chunk-HR5D6SD4.js} +2 -2
  10. package/dist/esm/{chunk-WXCNEGW3.js.map → chunk-HR5D6SD4.js.map} +2 -2
  11. package/dist/esm/{chunk-LV7IKG36.js → chunk-J5KJ2WWA.js} +35 -34
  12. package/dist/esm/chunk-J5KJ2WWA.js.map +7 -0
  13. package/dist/esm/{chunk-ZNAYJGVL.js → chunk-NUMCMGLU.js} +2 -2
  14. package/dist/esm/{chunk-ZNAYJGVL.js.map → chunk-NUMCMGLU.js.map} +0 -0
  15. package/dist/esm/{chunk-LSCTPPWV.js → chunk-OT7AIIFN.js} +4 -4
  16. package/dist/esm/chunk-OT7AIIFN.js.map +7 -0
  17. package/dist/esm/{chunk-XU5ILFX5.js → chunk-POCUG6QW.js} +6 -4
  18. package/dist/esm/{chunk-XU5ILFX5.js.map → chunk-POCUG6QW.js.map} +2 -2
  19. package/dist/esm/{chunk-OX6O2ZO5.js → chunk-QHWK5RXN.js} +1 -1
  20. package/dist/esm/chunk-QHWK5RXN.js.map +7 -0
  21. package/dist/esm/{chunk-GW4FGG42.js → chunk-RH4WZIGC.js} +2 -2
  22. package/dist/esm/{chunk-GW4FGG42.js.map → chunk-RH4WZIGC.js.map} +0 -0
  23. package/dist/esm/{chunk-TGPS3CXW.js → chunk-RIXFKOD6.js} +7 -7
  24. package/dist/esm/{chunk-TGPS3CXW.js.map → chunk-RIXFKOD6.js.map} +2 -2
  25. package/dist/esm/{chunk-2IZUSAXQ.js → chunk-WEYPAZEE.js} +1 -1
  26. package/dist/esm/{chunk-2IZUSAXQ.js.map → chunk-WEYPAZEE.js.map} +1 -1
  27. package/dist/esm/{chunk-Q4W5ZR4U.js → chunk-WNZXZ4MW.js} +10 -8
  28. package/dist/esm/{chunk-Q4W5ZR4U.js.map → chunk-WNZXZ4MW.js.map} +2 -2
  29. package/dist/esm/{chunk-PYWGREIP.js → chunk-YD2TMJI2.js} +33 -31
  30. package/dist/esm/chunk-YD2TMJI2.js.map +7 -0
  31. package/dist/esm/kpuzzle/index.js +2 -2
  32. package/dist/esm/notation/index.js +2 -2
  33. package/dist/esm/protocol/index.js +4 -4
  34. package/dist/esm/puzzle-geometry/index.js +114 -88
  35. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  36. package/dist/esm/puzzles/index.js +10 -6
  37. package/dist/esm/{puzzles-dynamic-side-events-5C7LMBWX.js → puzzles-dynamic-side-events-3K26JTOG.js} +2 -2
  38. package/dist/esm/{puzzles-dynamic-side-events-5C7LMBWX.js.map → puzzles-dynamic-side-events-3K26JTOG.js.map} +1 -1
  39. package/dist/esm/scramble/index.js +3 -3
  40. package/dist/esm/search/index.js +8 -8
  41. package/dist/esm/{search-dynamic-sgs-side-events-AYX7MZO7.js → search-dynamic-sgs-side-events-AE3TLLPA.js} +6 -6
  42. package/dist/esm/search-dynamic-sgs-side-events-AE3TLLPA.js.map +7 -0
  43. package/dist/esm/{search-dynamic-sgs-unofficial-DLJOJFJL.js → search-dynamic-sgs-unofficial-JUXMNMNO.js} +122 -67
  44. package/dist/esm/search-dynamic-sgs-unofficial-JUXMNMNO.js.map +7 -0
  45. package/dist/esm/{search-dynamic-solve-3x3x3-7XZTYQMO.js → search-dynamic-solve-3x3x3-SA75BI5I.js} +649 -405
  46. package/dist/esm/search-dynamic-solve-3x3x3-SA75BI5I.js.map +7 -0
  47. package/dist/esm/{search-dynamic-solve-4x4x4-CWWTFKMR.js → search-dynamic-solve-4x4x4-ALKH43DT.js} +399 -150
  48. package/dist/esm/search-dynamic-solve-4x4x4-ALKH43DT.js.map +7 -0
  49. package/dist/esm/{search-dynamic-solve-fto-4LI23P6K.js → search-dynamic-solve-fto-5B5ZESQC.js} +74 -34
  50. package/dist/esm/search-dynamic-solve-fto-5B5ZESQC.js.map +7 -0
  51. package/dist/esm/{search-dynamic-solve-kilominx-3HEVQ4MC.js → search-dynamic-solve-kilominx-OY4VIARG.js} +136 -71
  52. package/dist/esm/search-dynamic-solve-kilominx-OY4VIARG.js.map +7 -0
  53. package/dist/esm/{search-dynamic-solve-master_tetraminx-UB32C7MM.js → search-dynamic-solve-master_tetraminx-GE2BTRGI.js} +84 -41
  54. package/dist/esm/search-dynamic-solve-master_tetraminx-GE2BTRGI.js.map +7 -0
  55. package/dist/esm/{search-dynamic-solve-sq1-HA72TYF2.js → search-dynamic-solve-sq1-W6PSSLR6.js} +129 -54
  56. package/dist/esm/search-dynamic-solve-sq1-W6PSSLR6.js.map +7 -0
  57. package/dist/esm/{search-worker-inside-generated-string-AMEXYCKK.js → search-worker-inside-generated-string-7HYFSSPW.js} +28 -28
  58. package/dist/esm/search-worker-inside-generated-string-7HYFSSPW.js.map +7 -0
  59. package/dist/esm/{search-worker-js-entry-TP2T3NUL.js → search-worker-js-entry-SNUA3SOE.js} +44 -35
  60. package/dist/esm/search-worker-js-entry-SNUA3SOE.js.map +7 -0
  61. package/dist/esm/{search-worker-ts-entry-NEH77S4I.js → search-worker-ts-entry-LNB7KNFY.js} +3 -3
  62. package/dist/esm/{search-worker-ts-entry-NEH77S4I.js.map → search-worker-ts-entry-LNB7KNFY.js.map} +0 -0
  63. package/dist/esm/stream/index.js +1 -1
  64. package/dist/esm/stream/index.js.map +2 -2
  65. package/dist/esm/twisty/index.js +287 -273
  66. package/dist/esm/twisty/index.js.map +2 -2
  67. package/dist/esm/{twisty-dynamic-3d-D3ZDBJUH.js → twisty-dynamic-3d-PU74EKRA.js} +57 -59
  68. package/dist/esm/twisty-dynamic-3d-PU74EKRA.js.map +7 -0
  69. package/dist/types/{TwizzleLink-bef52ecd.d.ts → TwizzleLink-ce20e840.d.ts} +1 -1
  70. package/dist/types/puzzles/index.d.ts +5 -3
  71. package/dist/types/twisty/index.d.ts +2 -2
  72. package/package.json +51 -147
  73. package/dist/esm/chunk-DZGFGBKT.js.map +0 -7
  74. package/dist/esm/chunk-LSCTPPWV.js.map +0 -7
  75. package/dist/esm/chunk-LV7IKG36.js.map +0 -7
  76. package/dist/esm/chunk-NI7U4XAZ.js.map +0 -7
  77. package/dist/esm/chunk-OX6O2ZO5.js.map +0 -7
  78. package/dist/esm/chunk-PYWGREIP.js.map +0 -7
  79. package/dist/esm/search-dynamic-sgs-side-events-AYX7MZO7.js.map +0 -7
  80. package/dist/esm/search-dynamic-sgs-unofficial-DLJOJFJL.js.map +0 -7
  81. package/dist/esm/search-dynamic-solve-3x3x3-7XZTYQMO.js.map +0 -7
  82. package/dist/esm/search-dynamic-solve-4x4x4-CWWTFKMR.js.map +0 -7
  83. package/dist/esm/search-dynamic-solve-fto-4LI23P6K.js.map +0 -7
  84. package/dist/esm/search-dynamic-solve-kilominx-3HEVQ4MC.js.map +0 -7
  85. package/dist/esm/search-dynamic-solve-master_tetraminx-UB32C7MM.js.map +0 -7
  86. package/dist/esm/search-dynamic-solve-sq1-HA72TYF2.js.map +0 -7
  87. package/dist/esm/search-worker-inside-generated-string-AMEXYCKK.js.map +0 -7
  88. package/dist/esm/search-worker-js-entry-TP2T3NUL.js.map +0 -7
  89. package/dist/esm/twisty-dynamic-3d-D3ZDBJUH.js.map +0 -7
@@ -1,26 +1,30 @@
1
1
  import {
2
2
  randomUIntBelowFactory
3
- } from "./chunk-WXCNEGW3.js";
3
+ } from "./chunk-HR5D6SD4.js";
4
4
  import {
5
5
  Alg
6
- } from "./chunk-NI7U4XAZ.js";
6
+ } from "./chunk-7OIUETFU.js";
7
7
  import "./chunk-SBZRVSPK.js";
8
8
 
9
9
  // src/cubing/vendor/xyzzy/kilosolver.js
10
10
  var PHASE4_THRESHOLD = 7;
11
11
  function factorial(n) {
12
- if (n < 2)
12
+ if (n < 2) {
13
13
  return n;
14
+ }
14
15
  let f = 1;
15
- for (let i = 2; i <= n; i++)
16
+ for (let i = 2; i <= n; i++) {
16
17
  f *= i;
18
+ }
17
19
  return f;
18
20
  }
19
21
  function C(n, k) {
20
- if (k < 0 || k > n)
22
+ if (k < 0 || k > n) {
21
23
  return 0;
22
- if (k === 0 || k === n)
24
+ }
25
+ if (k === 0 || k === n) {
23
26
  return 1;
27
+ }
24
28
  let c = 1;
25
29
  for (let i = 0; i < k; i++) {
26
30
  c = c * (n - i) / (i + 1) | 0;
@@ -49,8 +53,9 @@ function permutation_parity(A) {
49
53
  let parity = 0;
50
54
  for (let i = 0; i < n - 1; i++) {
51
55
  for (let j = i; j < n; j++) {
52
- if (A[i] > A[j])
56
+ if (A[i] > A[j]) {
53
57
  parity ^= 1;
58
+ }
54
59
  }
55
60
  }
56
61
  return parity;
@@ -105,11 +110,13 @@ var [evenpermutation10_to_index, index_to_evenpermutation10] = (() => {
105
110
  function comb_to_index(l) {
106
111
  let bits = l.length;
107
112
  let ones = 0;
108
- for (let i = 0; i < bits; i++)
113
+ for (let i = 0; i < bits; i++) {
109
114
  ones += +(l[i] === 1);
115
+ }
110
116
  let zeros = bits - ones;
111
- if (zeros === 0 || ones === 0 || bits === 1)
117
+ if (zeros === 0 || ones === 0 || bits === 1) {
112
118
  return 0;
119
+ }
113
120
  let b = C(bits - 1, ones);
114
121
  let ind = 0;
115
122
  for (let i = 0; zeros > 0 && ones > 0 && bits > 1; i++) {
@@ -144,8 +151,9 @@ function index_to_comb(ind, ones, bits) {
144
151
  }
145
152
  function compose(A, B) {
146
153
  let C2 = [];
147
- for (let i = 0; i < B.length; i++)
154
+ for (let i = 0; i < B.length; i++) {
148
155
  C2[i] = A[B[i]];
156
+ }
149
157
  return C2;
150
158
  }
151
159
  function compose_o(A, B) {
@@ -159,8 +167,9 @@ function compose_o(A, B) {
159
167
  }
160
168
  function permutation_from_cycle(cycle, n) {
161
169
  let perm = [];
162
- for (let i = 0; i < n; i++)
170
+ for (let i = 0; i < n; i++) {
163
171
  perm[i] = i;
172
+ }
164
173
  for (let i = 0; i < cycle.length; i++) {
165
174
  perm[cycle[i]] = cycle[(i + 1) % cycle.length];
166
175
  }
@@ -168,8 +177,9 @@ function permutation_from_cycle(cycle, n) {
168
177
  }
169
178
  function unsparsify_list(d, n) {
170
179
  let l = Array(n).fill(0);
171
- for (let k in d)
180
+ for (let k in d) {
172
181
  l[k] = d[k];
182
+ }
173
183
  return l;
174
184
  }
175
185
  var move_U = [
@@ -210,8 +220,9 @@ var id = compose_o(move_x2, move_x2);
210
220
  var moves_full = [];
211
221
  for (let i = 0; i < moves.length; i++) {
212
222
  moves_full[i] = [id];
213
- for (let j = 1; j < 5; j++)
223
+ for (let j = 1; j < 5; j++) {
214
224
  moves_full[i][j] = compose_o(moves_full[i][j - 1], moves[i]);
225
+ }
215
226
  }
216
227
  function random_state(randomUintBelow2) {
217
228
  let p = [0];
@@ -220,8 +231,9 @@ function random_state(randomUintBelow2) {
220
231
  p[i] = p[r];
221
232
  p[r] = i;
222
233
  }
223
- if (permutation_parity(p) === 1)
234
+ if (permutation_parity(p) === 1) {
224
235
  [p[0], p[1]] = [p[1], p[0]];
236
+ }
225
237
  let o = Array(20).fill(0);
226
238
  for (let i = 0; i < 19; i++) {
227
239
  o[i] = randomUintBelow2(3);
@@ -237,8 +249,9 @@ function stringify_move_sequence(move_sequence) {
237
249
  }
238
250
  function apply_move_sequence(state, move_sequence) {
239
251
  for (let [m, r] of move_sequence) {
240
- for (let i = 0; i < r; i++)
252
+ for (let i = 0; i < r; i++) {
241
253
  state = compose_o(state, moves[m]);
254
+ }
242
255
  }
243
256
  return state;
244
257
  }
@@ -247,8 +260,10 @@ function generate_random_state_scramble(randomUintBelow2) {
247
260
  }
248
261
  var translation_amounts;
249
262
  {
250
- let A = Math.sin(Math.PI / 5), B = Math.cos(Math.PI / 10);
251
- let C2 = Math.cos(Math.PI / 5), D = Math.sin(Math.PI / 10);
263
+ let A = Math.sin(Math.PI / 5);
264
+ let B = Math.cos(Math.PI / 10);
265
+ let C2 = Math.cos(Math.PI / 5);
266
+ let D = Math.sin(Math.PI / 10);
252
267
  translation_amounts = {
253
268
  U: [0, 0],
254
269
  L: [-A - B, C2 - D],
@@ -266,12 +281,15 @@ var translation_amounts;
266
281
  }
267
282
  function solve_phase1(state) {
268
283
  let p = state[0];
269
- if (p.slice(15, 20).every((x) => x < 15))
284
+ if (p.slice(15, 20).every((x) => x < 15)) {
270
285
  return [];
271
- if (p.slice(0, 5).every((x) => x < 15))
286
+ }
287
+ if (p.slice(0, 5).every((x) => x < 15)) {
272
288
  return [[6, 1]];
289
+ }
273
290
  let flags = p.map((x) => x >= 15);
274
- let depth = 0, sol;
291
+ let depth = 0;
292
+ let sol;
275
293
  while (sol === void 0) {
276
294
  depth++;
277
295
  sol = search_phase1(flags, depth, -1);
@@ -280,30 +298,35 @@ function solve_phase1(state) {
280
298
  return sol;
281
299
  }
282
300
  function search_phase1(flags, depth, last) {
283
- if (depth == 0) {
284
- if (flags.slice(0, 5).some((x) => x))
301
+ if (depth === 0) {
302
+ if (flags.slice(0, 5).some((x) => x)) {
285
303
  return;
304
+ }
286
305
  return [];
287
306
  }
288
307
  for (let move_index = 0; move_index < 6; move_index++) {
289
- if (move_index === last)
308
+ if (move_index === last) {
290
309
  continue;
310
+ }
291
311
  for (let r = 1; r < 5; r++) {
292
312
  let new_flags = compose(flags, moves_full[move_index][r][0]);
293
313
  let sol = search_phase1(new_flags, depth - 1, move_index);
294
- if (sol !== void 0)
314
+ if (sol !== void 0) {
295
315
  return [[move_index, r]].concat(sol);
316
+ }
296
317
  }
297
318
  }
298
319
  return;
299
320
  }
300
321
  function index_phase2(state) {
301
- let p = state[0].slice(0, 15), o = state[1];
322
+ let p = state[0].slice(0, 15);
323
+ let o = state[1];
302
324
  let index_c = comb_to_index(p.map((x) => +(x >= 15)));
303
325
  let index_o = 243 * index_c;
304
326
  for (let i = 0, j = 0; i < 15; i++) {
305
- if (p[i] < 15)
327
+ if (p[i] < 15) {
306
328
  continue;
329
+ }
307
330
  index_o += o[i] * Math.pow(3, j);
308
331
  j++;
309
332
  }
@@ -326,12 +349,14 @@ function solve_phase2(state) {
326
349
  }
327
350
  function index_phase3(state) {
328
351
  let pieces = [5, 6, 7, 8, 14];
329
- let p = state[0].slice(0, 15), o = state[1];
352
+ let p = state[0].slice(0, 15);
353
+ let o = state[1];
330
354
  let index_c = comb_to_index(p.map((x) => +(pieces.indexOf(x) !== -1)));
331
355
  let index_o = 243 * index_c;
332
356
  for (let i = 0, j = 0; i < 15; i++) {
333
- if (pieces.indexOf(p[i]) === -1)
357
+ if (pieces.indexOf(p[i]) === -1) {
334
358
  continue;
359
+ }
335
360
  index_o += o[i] * Math.pow(3, j);
336
361
  j++;
337
362
  }
@@ -353,12 +378,15 @@ function solve_phase3(state) {
353
378
  return ida_solve(index_phase3(state), mtables, ptables);
354
379
  }
355
380
  function index_phase4(state) {
356
- let p = state[0].slice(0, 14), o = state[1];
357
- let index_o = 0, perm = [];
381
+ let p = state[0].slice(0, 14);
382
+ let o = state[1];
383
+ let index_o = 0;
384
+ let perm = [];
358
385
  let j = 0;
359
386
  for (let i of [0, 1, 2, 3, 4, 9, 10, 11, 12, 13]) {
360
- if (i !== 13)
387
+ if (i !== 13) {
361
388
  index_o += o[i] * Math.pow(3, j);
389
+ }
362
390
  perm[j] = p[i] < 5 ? p[i] : p[i] - 4;
363
391
  j++;
364
392
  }
@@ -383,9 +411,11 @@ function solve(state) {
383
411
  }
384
412
  var tables = {};
385
413
  function generate_phase23_orientation_mtable() {
386
- if (tables.phase23om)
414
+ if (tables.phase23om) {
387
415
  return tables.phase23om;
388
- const C15_5 = C(15, 5), THREE = [1, 3, 9, 27, 81, 243];
416
+ }
417
+ const C15_5 = C(15, 5);
418
+ const THREE = [1, 3, 9, 27, 81, 243];
389
419
  let phase23om = Array(C(15, 5) * THREE[5]);
390
420
  tables.phase23om = phase23om;
391
421
  for (let i = 0; i < C15_5; i++) {
@@ -402,8 +432,9 @@ function generate_phase23_orientation_mtable() {
402
432
  if (comb[k] === 1) {
403
433
  orient_full[k] = (j / THREE[l] | 0) % 3;
404
434
  l++;
405
- } else
435
+ } else {
406
436
  orient_full[k] = 99;
437
+ }
407
438
  }
408
439
  for (let move_index = 0; move_index < 6; move_index++) {
409
440
  let move = moves[move_index];
@@ -423,20 +454,23 @@ function generate_phase23_orientation_mtable() {
423
454
  return phase23om;
424
455
  }
425
456
  function generate_phase2_orientation_ptable() {
426
- if (tables.phase2op)
457
+ if (tables.phase2op) {
427
458
  return tables.phase2op;
459
+ }
428
460
  let mtable = generate_phase23_orientation_mtable();
429
461
  return tables.phase2op = bfs(mtable, [243 * 3002]);
430
462
  }
431
463
  function generate_phase3_orientation_ptable() {
432
- if (tables.phase3op)
464
+ if (tables.phase3op) {
433
465
  return tables.phase3op;
466
+ }
434
467
  let mtable = generate_phase23_orientation_mtable();
435
468
  return tables.phase3op = bfs(mtable, [243 * 246]);
436
469
  }
437
470
  function generate_phase23_permutation_mtable() {
438
- if (tables.phase23pm)
471
+ if (tables.phase23pm) {
439
472
  return tables.phase23pm;
473
+ }
440
474
  const FIFTEEN = [
441
475
  1,
442
476
  15,
@@ -474,20 +508,23 @@ function generate_phase23_permutation_mtable() {
474
508
  return tables.phase23pm = phase23pm;
475
509
  }
476
510
  function generate_phase2_permutation_ptable() {
477
- if (tables.phase2pp)
511
+ if (tables.phase2pp) {
478
512
  return tables.phase2pp;
513
+ }
479
514
  let mtable = generate_phase23_permutation_mtable();
480
515
  return tables.phase2pp = bfs(mtable, [213090]);
481
516
  }
482
517
  function generate_phase3_permutation_ptable() {
483
- if (tables.phase3pp)
518
+ if (tables.phase3pp) {
484
519
  return tables.phase3pp;
520
+ }
485
521
  let mtable = generate_phase23_permutation_mtable();
486
522
  return tables.phase3pp = bfs(mtable, [737420]);
487
523
  }
488
524
  function generate_phase4_orientation_mtable() {
489
- if (tables.phase4om)
525
+ if (tables.phase4om) {
490
526
  return tables.phase4om;
527
+ }
491
528
  const THREE = [1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049];
492
529
  let mtable = Array(THREE[9]);
493
530
  for (let i = 0; i < THREE[9]; i++) {
@@ -505,17 +542,20 @@ function generate_phase4_orientation_mtable() {
505
542
  (i2) => o[move[0][i2]] + move[1][i2]
506
543
  );
507
544
  let new_i = 0;
508
- for (let j = 0; j < 9; j++)
545
+ for (let j = 0; j < 9; j++) {
509
546
  new_i += new_o[j] % 3 * THREE[j];
547
+ }
510
548
  mtable[i][move_index] = new_i;
511
549
  }
512
550
  }
513
551
  return tables.phase4om = mtable;
514
552
  }
515
553
  function generate_phase4_permutation_mtable() {
516
- if (tables.phase4pm)
554
+ if (tables.phase4pm) {
517
555
  return tables.phase4pm;
518
- const HALFFACT10 = factorial(10) / 2, n = 10;
556
+ }
557
+ const HALFFACT10 = factorial(10) / 2;
558
+ const n = 10;
519
559
  let pre = [0, 1, 2, 3, 4, -1, -1, -1, -1, 5, 6, 7, 8, 9];
520
560
  let post = [0, 1, 2, 3, 4, 9, 10, 11, 12, 13];
521
561
  let move_permutations = [
@@ -536,20 +576,23 @@ function generate_phase4_permutation_mtable() {
536
576
  return tables.phase4pm = mtable;
537
577
  }
538
578
  function generate_phase4_orientation_ptable() {
539
- if (tables.phase4op)
579
+ if (tables.phase4op) {
540
580
  return tables.phase4op;
581
+ }
541
582
  let mtable = generate_phase4_orientation_mtable();
542
583
  return tables.phase4op = bfs(mtable, [0]);
543
584
  }
544
585
  function generate_phase4_permutation_ptable() {
545
- if (tables.phase4pp)
586
+ if (tables.phase4pp) {
546
587
  return tables.phase4pp;
588
+ }
547
589
  let mtable = generate_phase4_permutation_mtable();
548
590
  return tables.phase4pp = bfs(mtable, [0]);
549
591
  }
550
592
  function generate_phase4_near_ptable_list(threshold) {
551
- if (tables.phase4np_list && tables.phase4np_list.threshold === threshold)
593
+ if (tables.phase4np_list && tables.phase4np_list.threshold === threshold) {
552
594
  return tables.phase4np_list;
595
+ }
553
596
  let mtables = [
554
597
  generate_phase4_orientation_mtable(),
555
598
  generate_phase4_permutation_mtable()
@@ -559,12 +602,14 @@ function generate_phase4_near_ptable_list(threshold) {
559
602
  populate(threshold, [0, 0], -1);
560
603
  function populate(depth, state, last2) {
561
604
  states.push(state[0] + base * state[1]);
562
- if (depth === 0)
605
+ if (depth === 0) {
563
606
  return;
607
+ }
564
608
  let new_state = [];
565
609
  for (let move_index = 0; move_index < 3; move_index++) {
566
- if (move_index === last2)
610
+ if (move_index === last2) {
567
611
  continue;
612
+ }
568
613
  new_state[0] = state[0];
569
614
  new_state[1] = state[1];
570
615
  for (let r = 1; r < 5; r++) {
@@ -576,21 +621,26 @@ function generate_phase4_near_ptable_list(threshold) {
576
621
  return;
577
622
  }
578
623
  states.sort((x, y) => x - y);
579
- let unique_states = [], last = -1;
580
- for (let state of states)
581
- if (state !== last)
624
+ let unique_states = [];
625
+ let last = -1;
626
+ for (let state of states) {
627
+ if (state !== last) {
582
628
  unique_states.push(last = state);
629
+ }
630
+ }
583
631
  unique_states.threshold = threshold;
584
632
  return tables.phase4np_list = unique_states;
585
633
  }
586
634
  function binary_search(A, x) {
587
- let lo = 0, hi = A.length - 1;
635
+ let lo = 0;
636
+ let hi = A.length - 1;
588
637
  while (hi - lo > 1) {
589
638
  let mid = lo + hi >> 1;
590
- if (x > A[mid])
639
+ if (x > A[mid]) {
591
640
  lo = mid + 1;
592
- else
641
+ } else {
593
642
  hi = mid;
643
+ }
594
644
  }
595
645
  return x === A[lo] || x === A[hi];
596
646
  }
@@ -627,12 +677,14 @@ function bfs(mtable, goal_states) {
627
677
  function ida_solve(indices, mtables, ptables) {
628
678
  let ncoords = indices.length;
629
679
  let bound = 0;
630
- for (let i = 0; i < ncoords; i++)
680
+ for (let i = 0; i < ncoords; i++) {
631
681
  bound = Math.max(bound, ptables[i][indices[i]]);
682
+ }
632
683
  while (true) {
633
684
  let path = ida_search(indices, mtables, ptables, bound, -1);
634
- if (path !== void 0)
685
+ if (path !== void 0) {
635
686
  return path;
687
+ }
636
688
  bound++;
637
689
  }
638
690
  }
@@ -640,23 +692,29 @@ function ida_search(indices, mtables, ptables, bound, last) {
640
692
  let ncoords = indices.length;
641
693
  let nmoves = mtables[0][0].length;
642
694
  let heuristic = 0;
643
- for (let i = 0; i < ncoords; i++)
695
+ for (let i = 0; i < ncoords; i++) {
644
696
  heuristic = Math.max(heuristic, ptables[i][indices[i]]);
645
- if (heuristic > bound)
697
+ }
698
+ if (heuristic > bound) {
646
699
  return;
647
- if (bound === 0 || heuristic === 0)
700
+ }
701
+ if (bound === 0 || heuristic === 0) {
648
702
  return [];
703
+ }
649
704
  for (let m = 0; m < nmoves; m++) {
650
- if (m === last)
705
+ if (m === last) {
651
706
  continue;
707
+ }
652
708
  let new_indices = indices.slice();
653
- for (let c = 0; c < ncoords; c++)
709
+ for (let c = 0; c < ncoords; c++) {
654
710
  new_indices[c] = mtables[c][indices[c]][m];
711
+ }
655
712
  let r = 1;
656
- while (indices.some((_, i) => indices[i] != new_indices[i])) {
713
+ while (indices.some((_, i) => indices[i] !== new_indices[i])) {
657
714
  let subpath = ida_search(new_indices, mtables, ptables, bound - 1, m);
658
- if (subpath !== void 0)
715
+ if (subpath !== void 0) {
659
716
  return [[m, r]].concat(subpath);
717
+ }
660
718
  for (let c = 0; c < ncoords; c++) {
661
719
  new_indices[c] = mtables[c][new_indices[c]][m];
662
720
  }
@@ -683,24 +741,30 @@ function phase4_ida_solve(indices) {
683
741
  ptable_p,
684
742
  ptable_n
685
743
  );
686
- if (path !== void 0)
744
+ if (path !== void 0) {
687
745
  return path;
746
+ }
688
747
  bound++;
689
748
  }
690
749
  }
691
750
  function phase4_ida_search(indices, bound, last, mtable_o, mtable_p, ptable_o, ptable_p, ptable_n) {
692
751
  let heuristic = Math.max(ptable_o[indices[0]], ptable_p[indices[1]]);
693
- if (heuristic > bound)
752
+ if (heuristic > bound) {
694
753
  return;
695
- if (heuristic <= PHASE4_THRESHOLD && !binary_search(ptable_n, indices[0] + 19683 * indices[1]))
754
+ }
755
+ if (heuristic <= PHASE4_THRESHOLD && !binary_search(ptable_n, indices[0] + 19683 * indices[1])) {
696
756
  heuristic = PHASE4_THRESHOLD + 1;
697
- if (heuristic > bound)
757
+ }
758
+ if (heuristic > bound) {
698
759
  return;
699
- if (bound === 0 || heuristic === 0)
760
+ }
761
+ if (bound === 0 || heuristic === 0) {
700
762
  return [];
763
+ }
701
764
  for (let m = 0; m < 3; m++) {
702
- if (m === last)
765
+ if (m === last) {
703
766
  continue;
767
+ }
704
768
  let new_indices = indices.slice();
705
769
  for (let r = 1; r < 5; r++) {
706
770
  new_indices[0] = mtable_o[new_indices[0]][m];
@@ -715,8 +779,9 @@ function phase4_ida_search(indices, bound, last, mtable_o, mtable_p, ptable_o, p
715
779
  ptable_p,
716
780
  ptable_n
717
781
  );
718
- if (subpath !== void 0)
782
+ if (subpath !== void 0) {
719
783
  return [[m, r]].concat(subpath);
784
+ }
720
785
  }
721
786
  }
722
787
  return;
@@ -733,4 +798,4 @@ getRandomKilominxScramble().then((alg) => alg.log());
733
798
  export {
734
799
  getRandomKilominxScramble
735
800
  };
736
- //# sourceMappingURL=search-dynamic-solve-kilominx-3HEVQ4MC.js.map
801
+ //# sourceMappingURL=search-dynamic-solve-kilominx-OY4VIARG.js.map