cubing 0.63.0 → 0.63.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.
- package/dist/bin/chunks/{chunk-MDLXCG2G.js → chunk-52ODPET6.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/lib/cubing/{PuzzleLoader-B2JfN7uX.d.ts → PuzzleLoader-R-puDLmC.d.ts} +1 -1
- package/dist/lib/cubing/alg/index.d.ts +2 -2
- package/dist/lib/cubing/bluetooth/index.d.ts +2 -2
- package/dist/lib/cubing/bluetooth/index.js +1 -1
- package/dist/lib/cubing/bluetooth/index.js.map +2 -2
- package/dist/lib/cubing/chunks/{chunk-VOOMUOPU.js → chunk-M7YKTETT.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-Z4RAYVT2.js → chunk-V27EM5TJ.js} +13 -4
- package/dist/lib/cubing/chunks/{chunk-Z4RAYVT2.js.map → chunk-V27EM5TJ.js.map} +2 -2
- package/dist/lib/cubing/chunks/{inside-HKXM4LRT.js → inside-Q56GLXG4.js} +4 -17
- package/dist/lib/cubing/chunks/inside-Q56GLXG4.js.map +7 -0
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-CUTIKECO.js → search-dynamic-solve-4x4x4-E576AITS.js} +3 -3
- package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
- package/dist/lib/cubing/{events-BDkOaqlG.d.ts → events-IfSwQLYm.d.ts} +1 -1
- package/dist/lib/cubing/{index-DWA95mSl.d.ts → index-btIxbuNp.d.ts} +1 -1
- package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
- package/dist/lib/cubing/notation/index.d.ts +1 -1
- package/dist/lib/cubing/protocol/index.d.ts +1 -1
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
- package/dist/lib/cubing/puzzles/index.d.ts +1 -1
- package/dist/lib/cubing/scramble/index.d.ts +2 -2
- package/dist/lib/cubing/scramble/index.js +2 -2
- package/dist/lib/cubing/search/index.d.ts +3 -3
- package/dist/lib/cubing/search/index.js +2 -2
- package/dist/lib/cubing/stream/index.d.ts +3 -3
- package/dist/lib/cubing/twisty/index.d.ts +2 -2
- package/dist/lib/cubing/twisty/index.js +2 -2
- package/dist/lib/cubing/twisty/index.js.map +2 -2
- package/package.json +6 -6
- package/dist/lib/cubing/chunks/inside-HKXM4LRT.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-CD57C3C4.js +0 -771
- package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-CD57C3C4.js.map +0 -7
- /package/dist/bin/chunks/{chunk-MDLXCG2G.js.map → chunk-52ODPET6.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-VOOMUOPU.js.map → chunk-M7YKTETT.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-CUTIKECO.js.map → search-dynamic-solve-4x4x4-E576AITS.js.map} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/cubing/vendor/mpl/xyzzy/kilosolver.js"],
|
|
4
|
-
"sourcesContent": ["// @ts-nocheck\n\n/* kilosolver.js - A kilominx solver\nversion 0.7 (2021-04-03)\nCopyright (c) 2016, 2020, 2021\n\nFrom https://torchlight.github.io/kiloscrambler.html\nOriginally MIT licensed, added to `cubing.js` under the GPL license by permission from the author (@torchlight/xyzzy).\n\nThis is a port of the kilominx solver originally written in Python with a few minor optimisations.\n\nHow to run this:\n(0) Save this file somewhere.\n(1) Install any JavaScript shell and run it with this file.\n(2) Type stuff into the shell.\n\n(or just use the HTML interface! it exists now!)\n\nThere is currently not much of a public interface. Useful stuff:\ncache_all_tables()\n to generate all the lookup tables\nprint_move_sequence(generate_random_state_scramble())\n to get a random-state scramble\nprint_move_sequence(generate_hybrid_scramble())\n to get a hybrid random-move scramble\n\nFor the full solver (used in the random-state scrambler), a few hundred megabytes of RAM may be used\nfor the lookup tables, which will also take roughly a minute to generate. Once generated, each solve\ntakes roughly 0.08 second.\n\nThe hybrid scrambler uses much smaller lookup tables that take less memory and are generated faster,\nbut produces somewhat longer scramble sequences and isn't fully random-state. It should nevertheless\nbe good enough for non-competition purposes.\n\nOn the to-do list:\n- optimise the heck out of the lookup table generation\n- a GUI for the solver\n- optimise the solver with colour neutrality and NISS(tm) techniques\n- throw all the global variables into a namespace\n\nCompatibility notes:\nThis code makes fairly heavy use of ES6 syntactic sugar because writing code in JavaScript's already\nan exercise in masochism and I'm not going to make my life harder by restricting myself to ES5. Some\nof the features used are:\n- let, const\n- destructuring assignment\n- for-of\n- arrow functions\n- 'use strict'\n\nAny web browser from 2016 or later should support all of these; the code has been tested only on the\nlatest versions of Firefox and Chrome, as well as a somewhat outdated SpiderMonkey shell, but should\nalso work with recent versions of Edge, Safari, etc.\n*/\n\n\"use strict\";\n\nimport { Alg } from \"../../../alg\";\nimport { randomUIntBelow } from \"random-uint-below\";\n\nlet PHASE4_THRESHOLD = 7;\n// change this to 8 to make the individual solves faster, at the cost of slower initialisation\n\nfunction counter(A) {\n let counts = [];\n for (let a of A) {\n counts[a] = (counts[a] || 0) + 1;\n }\n return counts;\n}\n\n/* Combinatoric functions */\n\nfunction factorial(n) {\n if (n < 2) {\n return n;\n }\n let f = 1;\n for (let i = 2; i <= n; i++) {\n f *= i;\n }\n return f;\n}\n\nfunction C(n, k) {\n if (k < 0 || k > n) {\n return 0;\n }\n if (k === 0 || k === n) {\n return 1;\n }\n let c = 1;\n for (let i = 0; i < k; i++) {\n c = ((c * (n - i)) / (i + 1)) | 0;\n }\n return c;\n}\n\nfunction permutation_to_index(perm) {\n perm = perm.slice();\n let n = perm.length;\n let f = factorial(n - 1);\n let ind = 0;\n while (n > 1) {\n n--;\n // invariant: f === factorial(n)\n // also, perm stores meaningful values up to perm[n]\n let e = perm[0];\n ind += e * f;\n for (let i = 0; i < n; i++) {\n let x = perm[i + 1];\n perm[i] = x - (x > e);\n }\n f /= n;\n }\n return ind;\n}\n\nfunction index_to_permutation(ind, n) {\n let perm = [];\n let f = factorial(n - 1);\n for (let i = 0; i < n; i++) {\n perm[i] = (ind / f) | 0;\n ind %= f;\n f /= n - 1 - i;\n }\n for (let i = n - 2; i >= 0; i--) {\n for (let j = i + 1; j < n; j++) {\n perm[j] += +(perm[j] >= perm[i]);\n }\n }\n return perm;\n}\n\nfunction permutation_parity(A) {\n let n = A.length;\n let parity = 0;\n for (let i = 0; i < n - 1; i++) {\n for (let j = i; j < n; j++) {\n if (A[i] > A[j]) {\n parity ^= 1;\n }\n }\n }\n return parity;\n}\n\nfunction index_to_evenpermutation(ind, n) {\n let perm = [];\n let f = factorial(n - 1) / 2;\n let parity = 0;\n for (let i = 0; i < n - 1; i++) {\n perm[i] = (ind / f) | 0;\n ind %= f;\n f /= n - 1 - i;\n }\n perm[n - 1] = 0;\n for (let i = n - 2; i >= 0; i--) {\n for (let j = i + 1; j < n; j++) {\n if (perm[j] >= perm[i]) {\n perm[j]++;\n } else {\n parity ^= 1;\n }\n }\n }\n if (parity === 1) {\n [perm[n - 2], perm[n - 1]] = [perm[n - 1], perm[n - 2]];\n }\n return perm;\n}\n\nfunction evenpermutation_to_index(perm) {\n return permutation_to_index(perm) >> 1;\n}\n\nlet [evenpermutation10_to_index, index_to_evenpermutation10] = (() => {\n let index_in_set_bits = new Int8Array(1024 * 10);\n let look_up_set_bits = new Int8Array(1024 * 10);\n for (let i = 0; i < 1024; i++) {\n for (let j = 0, counter = 0; j < 10; j++) {\n if (((i >>> j) & 1) === 0) {\n continue;\n }\n index_in_set_bits[(j << 10) | i] = counter;\n look_up_set_bits[(counter << 10) | i] = j;\n counter++;\n }\n }\n\n function evenpermutation10_to_index(perm) {\n let unused = 0x3ff; // track which values in 0..9 haven't been used so far\n let f = 181440; // = 9!/2\n let ind = 0;\n for (let i = 0; i < 8; i++) {\n let v = perm[i];\n ind += index_in_set_bits[unused | (v << 10)] * f;\n unused &= ~(1 << v);\n f /= 9 - i;\n }\n return ind;\n }\n\n // note: this is *not* a drop-in replacement for index_to_evenpermutation!\n function index_to_evenpermutation10(ind, perm) {\n let unused = 0x3ff;\n let f = 181440; // = 9!/2\n let parity = 0;\n for (let i = 0; i < 8; i++) {\n let a = (ind / f) | 0;\n ind -= a * f;\n parity ^= a & 1;\n let v = look_up_set_bits[unused | (a << 10)];\n perm[i] = v;\n unused &= ~(1 << v);\n f /= 9 - i;\n }\n // the last two elements are uniquely determined by the other ten\n perm[8] = look_up_set_bits[unused | (parity << 10)];\n perm[9] = look_up_set_bits[unused | ((parity ^ 1) << 10)];\n return perm;\n }\n\n return [evenpermutation10_to_index, index_to_evenpermutation10];\n})();\n\nfunction comb_to_index(l) {\n let bits = l.length;\n let ones = 0;\n for (let i = 0; i < bits; i++) {\n ones += +(l[i] === 1);\n }\n let zeros = bits - ones;\n if (zeros === 0 || ones === 0 || bits === 1) {\n return 0;\n }\n let b = C(bits - 1, ones);\n let ind = 0;\n for (let i = 0; zeros > 0 && ones > 0 && bits > 1; i++) {\n bits--;\n if (l[i] === 0) {\n b = (b * --zeros) / bits;\n } else {\n // l[i] === 1\n ind += b;\n b = (b * ones--) / bits;\n }\n }\n return ind;\n}\n\nfunction index_to_comb(ind, ones, bits) {\n let zeros = bits - ones;\n let b = C(bits - 1, ones);\n let l = [];\n let n = bits - 1;\n for (let i = 0; i < n; i++) {\n bits--;\n if (ind < b) {\n l.push(0);\n b = (b * --zeros) / bits;\n } else {\n l.push(1);\n ind -= b;\n b = (b * ones--) / bits;\n }\n }\n l.push(ones);\n return l;\n}\n\nfunction compose(A, B) {\n let C = [];\n for (let i = 0; i < B.length; i++) {\n C[i] = A[B[i]];\n }\n return C;\n}\n\nfunction compose_o(A, B) {\n // note: we hardcode the modulus to 3 here, because ~optimisations~\n // (unnecessary abstraction is bad, actually)\n let p = compose(A[0], B[0]);\n let o = [];\n let n = B[0].length;\n for (let i = 0; i < n; i++) {\n o[i] = (A[1][B[0][i]] + B[1][i]) % 3;\n }\n return [p, o];\n}\n\nfunction permutation_from_cycle(cycle, n) {\n let perm = [];\n for (let i = 0; i < n; i++) {\n perm[i] = i;\n }\n for (let i = 0; i < cycle.length; i++) {\n perm[cycle[i]] = cycle[(i + 1) % cycle.length];\n }\n return perm;\n}\n\nfunction unsparsify_list(d, n) {\n let l = Array(n).fill(0);\n for (let k in d) {\n l[k] = d[k];\n }\n return l;\n}\n\n/* The basic moves */\n\nconst move_U = [\n permutation_from_cycle([0, 1, 2, 3, 4], 20),\n unsparsify_list({}, 20),\n];\nconst move_R = [\n permutation_from_cycle([4, 3, 11, 12, 13], 20),\n unsparsify_list({ 4: 2, 3: 1, 11: 1, 12: 1, 13: 1 }, 20),\n];\nconst move_F = [\n permutation_from_cycle([3, 2, 9, 10, 11], 20),\n unsparsify_list({ 3: 2, 2: 1, 9: 1, 10: 1, 11: 1 }, 20),\n];\nconst move_L = [\n permutation_from_cycle([2, 1, 7, 8, 9], 20),\n unsparsify_list({ 2: 2, 1: 1, 7: 1, 8: 1, 9: 1 }, 20),\n];\nlet move_BL = [\n permutation_from_cycle([1, 0, 5, 6, 7], 20),\n unsparsify_list({ 1: 2, 0: 1, 5: 1, 6: 1, 7: 1 }, 20),\n];\nlet move_BR = [\n permutation_from_cycle([0, 4, 13, 14, 5], 20),\n unsparsify_list({ 0: 2, 4: 1, 13: 1, 14: 1, 5: 1 }, 20),\n];\nlet move_x2 = [\n [15, 16, 17, 18, 19, 10, 9, 8, 7, 6, 5, 14, 13, 12, 11, 0, 1, 2, 3, 4],\n unsparsify_list({}, 20),\n];\nlet move_y = [\n [1, 2, 3, 4, 0, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 19, 15, 16, 17, 18],\n unsparsify_list({}, 20),\n];\nlet move_rot = [\n [9, 10, 11, 3, 2, 8, 16, 15, 19, 12, 13, 4, 0, 1, 7, 14, 18, 17, 6, 5],\n [2, 0, 1, 2, 1, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 1, 2, 1, 2, 0],\n];\n\nconst moves = [move_U, move_R, move_F, move_L, move_BL, move_BR, move_x2];\nconst move_names = [\"U\", \"R\", \"F\", \"L\", \"BL\", \"BR\", \"x2\"];\n\nlet id = compose_o(move_x2, move_x2);\n\nlet moves_full = [];\nfor (let i = 0; i < moves.length; i++) {\n moves_full[i] = [id];\n for (let j = 1; j < 5; j++) {\n moves_full[i][j] = compose_o(moves_full[i][j - 1], moves[i]);\n }\n}\n\nfunction random_state() {\n let p = [0];\n for (let i = 1; i < 20; i++) {\n let r = randomUIntBelow(i + 1);\n p[i] = p[r];\n p[r] = i;\n }\n if (permutation_parity(p) === 1) {\n [p[0], p[1]] = [p[1], p[0]];\n }\n let o = Array(20).fill(0);\n for (let i = 0; i < 19; i++) {\n o[i] = randomUIntBelow(3);\n o[19] += 3 - o[i];\n }\n o[19] %= 3;\n return [p, o];\n}\n\n/* Human interface stuff */\n\nfunction stringify_move_sequence(move_sequence) {\n let suffixes = [\"0\", \"\", \"2\", \"2'\", \"'\"];\n let s = move_sequence.map(([m, r]) => move_names[m] + suffixes[r]);\n return s.join(\" \");\n}\n\nfunction print_move_sequence(move_sequence) {\n console.log(stringify_move_sequence(move_sequence));\n}\n\nfunction apply_move_sequence(state, move_sequence) {\n for (let [m, r] of move_sequence) {\n for (let i = 0; i < r; i++) {\n state = compose_o(state, moves[m]);\n }\n }\n return state;\n}\n\nfunction generate_random_state_scramble() {\n return solve(random_state());\n}\n\n/* a brief note on analysing random-move scrambles\n\nLet M = num flips and N = num moves between flips.\n\nTracking just corner orientation is pretty much useless to determine if a scramble is good, at least\nfor the choice of CO reference used in the solver (<U,flip,(R'FRF')3>); even M=1, N=8 is good enough\nto randomise the CO, despite leaving a bunch of obvious blocks.\n\nInstead, we can track the location of, say, the white pieces. There are C(20, 5) combinations, so we\njust try out a million random-move scrambles and do a chi-squared test. (Except I don't have a stats\npackage installed, so this is just a qualitative approximation.)\n\nM=4, N=5 (29 moves): +2.7 stddev\nM=3, N=8 (35 moves): +15.7 stddev\nM=5, N=5 (35 moves): -0.1 stddev\nM=4, N=7 (39 moves): +3.8 stddev\nM=5, N=6 (41 moves): -0.4 stddev\nM=4, N=8 (44 moves): +2.2 stddev\n\n(the 95% confidence interval for these estimated values should be taken to be +-2, as usual)\n\nObviously we get closer to a uniform distribution with more moves, but we also want the scrambles to\nbe of a reasonable length. M=5, N=6 seems to be a good tradeoff.\n\nThis is until you realise that the five grey pieces are effectively scrambled with M reduced by one,\nso we compensate for that by using M=6, N=6, which gives 48-move scrambles.\n\n(tl;dr: use the hybrid scrambler if you can stomach 0.3-second initialisation; don't use this)\n*/\n\n/* Solver logic\n\nFor scrambling purposes, we have these two options:\n(i) generate a random state, solve it, then invert the solution\n(ii) generate a random state, solve it, return the solution as is\n\nThe former has a caveat that \"solve\" really means \"solve into the scramble orientation\". If we solve\ninto an arbitrary orientation, the result is a random-modulo-orientation state, in that the scramble\nhas the same relative positions of pieces as the random state, but possibly with the wrong colours.\n\nThe latter works here because the kilominx states form a group and taking the inverse doesn't affect\nthe randomness, and we do have the freedom to solve into any orientation. Since the WCA regs specify\nthat scrambled puzzles are delivered to the competitor in an arbitrary orientation, we may take this\nto be equivalent to right-composing with a random rotation, and this would \"cancel out\" any rotation\nshowing up at the end of the solution.\n\nSolving to orientations other than white-top-green-front saves a few moves (~2.2 moves by testing 10\norientations out of 60), but it's also proportionally slower for marginal gain.\n\nPhases used:\n\nPhase 1: get the five grey corners out of the U layer (6-gen), then rotate.\n\nPhase 2: form the U layer out of the grey corners (6-gen), then rotate.\n\nPhase 3: solve five more corners at the back/left to reduce to <U,R,F> (6-gen).\n\nPhase 4: finish last three faces (3-gen).\n\nPhase 1 is a skip (all five grey corners are already not on the D layer) ~19% of the time, and takes\njust one flip ~18% of the time, so there's a ~37% chance this step is basically trivial. With colour\nneutrality, this could be something like 99.9% trivial.\n\nPhases 2 and 3 make use of the same permutation/orientation move tables. Ideally, we'd use only one,\nbut it would be kinda terrible for a web app to eat hundreds of megabytes of memory. Luckily for us,\nIDA* settles these phases quickly enough that it doesn't really matter. Unluckily for us, this makes\nthe code a bit more complicated.\n\nPhase 4 is the problematic one, with 35.7 billion states. We use three pruning tables:\n- orientation (3^9 = 19683 states)\n- permutation (10!/2 = 1814400 states)\n- list of states up to 7 moves (3565896 states)\n\nWe don't even need to store the actual distances for the almost-solved states; we just let IDA* work\nits magic with the other pruning tables. Basically, if a state is in the list, the heuristic reports\na lower bound of 0, and if it's not, it reports a lower bound of 8.\n*/\n\nfunction solve_phase1(state) {\n // we don't care about orientation.\n let p = state[0];\n // x < 15 tests if a piece is non-grey.\n if (p.slice(15, 20).every((x) => x < 15)) {\n return [];\n }\n if (p.slice(0, 5).every((x) => x < 15)) {\n return [[6, 1]];\n }\n let flags = p.map((x) => x >= 15);\n let depth = 0;\n let sol;\n while (sol === undefined) {\n depth++;\n sol = search_phase1(flags, depth, -1);\n }\n sol.push([6, 1]);\n return sol;\n}\n\nfunction search_phase1(flags, depth, last) {\n if (depth === 0) {\n if (flags.slice(0, 5).some((x) => x)) {\n return;\n }\n return [];\n }\n for (let move_index = 0; move_index < 6; move_index++) {\n if (move_index === last) {\n continue;\n }\n for (let r = 1; r < 5; r++) {\n let new_flags = compose(flags, moves_full[move_index][r][0]);\n let sol = search_phase1(new_flags, depth - 1, move_index);\n if (sol !== undefined) {\n return [[move_index, r]].concat(sol);\n }\n }\n }\n return;\n}\n\nfunction index_phase2(state) {\n let p = state[0].slice(0, 15);\n let o = state[1];\n let index_c = comb_to_index(p.map((x) => +(x >= 15)));\n let index_o = 243 * index_c;\n for (let i = 0, j = 0; i < 15; i++) {\n if (p[i] < 15) {\n continue;\n }\n index_o += o[i] * Math.pow(3, j);\n // as it so happens, my JS shell is too outdated and doesn't support **\n j++;\n }\n let index_p = 0;\n for (let i = 0; i < 5; i++) {\n index_p += p.indexOf(15 + i) * Math.pow(15, i);\n }\n return [index_o, index_p];\n}\n\nfunction solve_phase2(state) {\n let mtables = [\n generate_phase23_orientation_mtable(),\n generate_phase23_permutation_mtable(),\n ];\n let ptables = [\n generate_phase2_orientation_ptable(),\n generate_phase2_permutation_ptable(),\n ];\n return ida_solve(index_phase2(state), mtables, ptables).concat([[6, 1]]);\n}\n\nfunction index_phase3(state) {\n let pieces = [5, 6, 7, 8, 14];\n let p = state[0].slice(0, 15);\n let o = state[1];\n let index_c = comb_to_index(p.map((x) => +(pieces.indexOf(x) !== -1)));\n let index_o = 243 * index_c;\n for (let i = 0, j = 0; i < 15; i++) {\n if (pieces.indexOf(p[i]) === -1) {\n continue;\n }\n index_o += o[i] * Math.pow(3, j);\n j++;\n }\n let index_p = 0;\n for (let i = 0; i < 5; i++) {\n index_p += p.indexOf(pieces[i]) * Math.pow(15, i);\n }\n return [index_o, index_p];\n}\n\nfunction solve_phase3(state) {\n let mtables = [\n generate_phase23_orientation_mtable(),\n generate_phase23_permutation_mtable(),\n ];\n let ptables = [\n generate_phase3_orientation_ptable(),\n generate_phase3_permutation_ptable(),\n ];\n return ida_solve(index_phase3(state), mtables, ptables);\n}\n\nfunction index_phase4(state) {\n let p = state[0].slice(0, 14);\n let o = state[1];\n let index_o = 0;\n let perm = [];\n let j = 0;\n for (let i of [0, 1, 2, 3, 4, 9, 10, 11, 12, 13]) {\n if (i !== 13) {\n index_o += o[i] * Math.pow(3, j);\n }\n perm[j] = p[i] < 5 ? p[i] : p[i] - 4;\n j++;\n }\n return [index_o, evenpermutation_to_index(perm)];\n}\n\nfunction solve_phase4(state) {\n let mtables = [\n generate_phase4_orientation_mtable(),\n generate_phase4_permutation_mtable(),\n ];\n let ptables = [\n generate_phase4_orientation_ptable(),\n generate_phase4_permutation_ptable(),\n ];\n return ida_solve(index_phase4(state), mtables, ptables);\n}\n\nfunction solve_phase4_fast(state) {\n return phase4_ida_solve(index_phase4(state));\n}\n\nfunction solve(state) {\n let sol = [];\n for (let solver of [\n solve_phase1,\n solve_phase2,\n solve_phase3,\n solve_phase4_fast,\n ]) {\n //console.log(`solving with ${solver.name}`);\n let phase_sol = solver(state);\n state = apply_move_sequence(state, phase_sol);\n //console.log(`solution: ${stringify_move_sequence(phase_sol)}`);\n sol = sol.concat(phase_sol);\n }\n return sol;\n}\n\nfunction cn_solve(state) {\n // Solve with partial colour neutrality. We don't want to check all 120 cases, so we look only\n // at <y, flip>-neutrality, which has 10 cases.\n let sol_lengths = [];\n let shortest_sol;\n let shortest_sol_length = 999999;\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 5; y++) {\n let sol = solve(state);\n sol_lengths.push(sol.length);\n if (shortest_sol_length > sol.length) {\n shortest_sol_length = sol.length;\n shortest_sol = sol;\n }\n state = compose_o(move_y, state);\n }\n state = compose_o(move_x2, state);\n }\n console.log(`solution lengths: ${sol_lengths.join(\", \")}`);\n return shortest_sol;\n}\n\nconst tables = {};\n\nfunction generate_phase23_orientation_mtable() {\n if (tables.phase23om) {\n return tables.phase23om;\n }\n const C15_5 = C(15, 5);\n const THREE = [1, 3, 9, 27, 81, 243];\n let phase23om = Array(C(15, 5) * THREE[5]);\n tables.phase23om = phase23om;\n for (let i = 0; i < C15_5; i++) {\n let comb = index_to_comb(i, 5, 15).concat(Array(5).fill(0));\n let new_comb_indices = [];\n for (let move_index = 0; move_index < 6; move_index++) {\n let new_comb = compose(comb, moves[move_index][0]).slice(0, 15);\n new_comb_indices[move_index] = comb_to_index(new_comb);\n }\n for (let j = 0; j < THREE[5]; j++) {\n phase23om[j + 243 * i] = [];\n let orient_full = [];\n for (let k = 0, l = 0; k < 20; k++) {\n if (comb[k] === 1) {\n orient_full[k] = ((j / THREE[l]) | 0) % 3;\n l++;\n } else {\n orient_full[k] = 99; // some irrelevant garbage value\n }\n }\n for (let move_index = 0; move_index < 6; move_index++) {\n let move = moves[move_index];\n let new_orient_full = [];\n for (let k = 0; k < 15; k++) {\n new_orient_full[k] = orient_full[move[0][k]] + move[1][k];\n }\n let new_orient = new_orient_full.filter((x) => x < 10); // get rid of garbage\n let J = 0;\n for (let k = 0; k < 5; k++) {\n J += (new_orient[k] % 3) * THREE[k];\n }\n phase23om[j + 243 * i][move_index] =\n J + 243 * new_comb_indices[move_index];\n }\n }\n }\n return phase23om;\n}\n\nfunction generate_phase2_orientation_ptable() {\n if (tables.phase2op) {\n return tables.phase2op;\n }\n let mtable = generate_phase23_orientation_mtable();\n return (tables.phase2op = bfs(mtable, [243 * 3002]));\n}\n\nfunction generate_phase3_orientation_ptable() {\n if (tables.phase3op) {\n return tables.phase3op;\n }\n let mtable = generate_phase23_orientation_mtable();\n return (tables.phase3op = bfs(mtable, [243 * 246]));\n}\n\nfunction generate_phase23_permutation_mtable() {\n if (tables.phase23pm) {\n return tables.phase23pm;\n }\n const FIFTEEN = [\n 1,\n 15,\n 225,\n Math.pow(15, 3),\n Math.pow(15, 4),\n Math.pow(15, 5),\n ];\n let phase23pm = Array(FIFTEEN[5]);\n let single = Array(15);\n for (let i = 0; i < 15; i++) {\n single[i] = Array(6);\n for (let move_index = 0; move_index < 6; move_index++) {\n single[i][move_index] = moves[move_index][0].indexOf(i);\n }\n }\n let locations = [0, 0, 0, 0, 0];\n for (let ind = 0; ind < FIFTEEN[5]; ind++) {\n phase23pm[ind] = Array(6);\n for (let move_index = 0; move_index < 6; move_index++) {\n let new_ind = 0;\n for (let i = 0; i < 5; i++) {\n new_ind += single[locations[i]][move_index] * FIFTEEN[i];\n }\n phase23pm[ind][move_index] = new_ind;\n }\n locations[0]++;\n for (let i = 0; i < 4; i++) {\n if (locations[i] === 15) {\n locations[i] = 0;\n locations[i + 1]++;\n }\n }\n }\n return (tables.phase23pm = phase23pm);\n}\n\nfunction generate_phase2_permutation_ptable() {\n if (tables.phase2pp) {\n return tables.phase2pp;\n }\n let mtable = generate_phase23_permutation_mtable();\n return (tables.phase2pp = bfs(mtable, [213090]));\n}\n\nfunction generate_phase3_permutation_ptable() {\n if (tables.phase3pp) {\n return tables.phase3pp;\n }\n let mtable = generate_phase23_permutation_mtable();\n return (tables.phase3pp = bfs(mtable, [737420]));\n}\n\nfunction generate_phase4_orientation_mtable() {\n if (tables.phase4om) {\n return tables.phase4om;\n }\n const THREE = [1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049];\n let mtable = Array(THREE[9]);\n for (let i = 0; i < THREE[9]; i++) {\n let o = Array(14).fill(0);\n for (let j = 0; j < 9; j++) {\n let J = j < 5 ? j : j + 4;\n o[J] = ((i / THREE[j]) | 0) % 3;\n o[13] -= o[J];\n }\n o[13] = (o[13] + 999) % 3;\n mtable[i] = [];\n for (let move_index = 0; move_index < 3; move_index++) {\n let move = moves[move_index];\n let new_o = [0, 1, 2, 3, 4, 9, 10, 11, 12, 13].map(\n (i) => o[move[0][i]] + move[1][i],\n );\n let new_i = 0;\n for (let j = 0; j < 9; j++) {\n new_i += (new_o[j] % 3) * THREE[j];\n }\n mtable[i][move_index] = new_i;\n }\n }\n return (tables.phase4om = mtable);\n}\n\nfunction generate_phase4_permutation_mtable() {\n if (tables.phase4pm) {\n return tables.phase4pm;\n }\n const HALFFACT10 = factorial(10) / 2;\n const n = 10;\n let pre = [0, 1, 2, 3, 4, -1, -1, -1, -1, 5, 6, 7, 8, 9];\n let post = [0, 1, 2, 3, 4, 9, 10, 11, 12, 13];\n let move_permutations = [\n compose(pre, compose(move_U[0], post)),\n compose(pre, compose(move_R[0], post)),\n compose(pre, compose(move_F[0], post)),\n ];\n let mtable = Array(HALFFACT10);\n let perm = Array(10);\n for (let i = 0; i < HALFFACT10; i++) {\n index_to_evenpermutation10(i, perm);\n mtable[i] = [];\n for (let move_index = 0; move_index < 3; move_index++) {\n let new_perm = compose(perm, move_permutations[move_index]);\n mtable[i][move_index] = evenpermutation10_to_index(new_perm);\n }\n }\n return (tables.phase4pm = mtable);\n}\n\nfunction generate_phase4_orientation_ptable() {\n if (tables.phase4op) {\n return tables.phase4op;\n }\n let mtable = generate_phase4_orientation_mtable();\n return (tables.phase4op = bfs(mtable, [0]));\n}\n\nfunction generate_phase4_permutation_ptable() {\n if (tables.phase4pp) {\n return tables.phase4pp;\n }\n let mtable = generate_phase4_permutation_mtable();\n return (tables.phase4pp = bfs(mtable, [0]));\n}\n\nfunction generate_phase4_near_ptable_list(threshold) {\n if (tables.phase4np_list && tables.phase4np_list.threshold === threshold) {\n return tables.phase4np_list;\n }\n let mtables = [\n generate_phase4_orientation_mtable(),\n generate_phase4_permutation_mtable(),\n ];\n let base = Math.pow(3, 9);\n let states = [0];\n populate(threshold, [0, 0], -1);\n function populate(depth, state, last) {\n states.push(state[0] + base * state[1]);\n if (depth === 0) {\n return;\n }\n let new_state = [];\n for (let move_index = 0; move_index < 3; move_index++) {\n if (move_index === last) {\n continue;\n }\n new_state[0] = state[0];\n new_state[1] = state[1];\n for (let r = 1; r < 5; r++) {\n new_state[0] = mtables[0][new_state[0]][move_index];\n new_state[1] = mtables[1][new_state[1]][move_index];\n populate(depth - 1, new_state, move_index);\n }\n }\n return;\n }\n states.sort((x, y) => x - y);\n let unique_states = [];\n let last = -1;\n for (let state of states) {\n if (state !== last) {\n unique_states.push((last = state));\n }\n }\n unique_states.threshold = threshold;\n return (tables.phase4np_list = unique_states);\n}\n\nfunction binary_search(A, x) {\n let lo = 0;\n let hi = A.length - 1;\n while (hi - lo > 1) {\n // invariants: hi - lo >= 2; x > A[lo-1]; x < A[hi+1]\n let mid = (lo + hi) >> 1; // lo < mid < hi\n if (x > A[mid]) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n return x === A[lo] || x === A[hi];\n}\n\nfunction cache_all_tables() {\n let time = +new Date();\n let splits = [time];\n console.log(\"generating phase 2/3 move tables...\");\n generate_phase23_orientation_mtable();\n generate_phase23_permutation_mtable();\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\"generating phase 2 pruning tables...\");\n generate_phase2_orientation_ptable();\n generate_phase2_permutation_ptable();\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\"generating phase 3 pruning tables...\");\n generate_phase3_orientation_ptable();\n generate_phase3_permutation_ptable();\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\"generating phase 4 move tables...\");\n generate_phase4_orientation_mtable();\n generate_phase4_permutation_mtable();\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\"generating phase 4 pruning tables...\");\n generate_phase4_orientation_ptable();\n generate_phase4_permutation_ptable();\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\"generating phase 4 bonus pruning table...\");\n generate_phase4_near_ptable_list(PHASE4_THRESHOLD);\n splits.push(+new Date());\n console.log(\n `done ${(\n (splits[splits.length - 1] - splits[splits.length - 2]) /\n 1e3\n ).toFixed(3)}`,\n );\n\n console.log(\n `total elapsed: ${((splits[splits.length - 1] - splits[0]) / 1000).toFixed(\n 3,\n )}`,\n );\n}\n\nfunction bfs(mtable, goal_states) {\n let N = mtable.length;\n let nmoves = mtable[0].length;\n let ptable = Array(N).fill(-1);\n for (let state of goal_states) {\n ptable[state] = 0;\n }\n let depth = 0;\n let done = false;\n while (!done) {\n done = true;\n for (let state = 0; state < N; state++) {\n if (ptable[state] !== depth) {\n continue;\n }\n for (let move_index = 0; move_index < nmoves; move_index++) {\n let new_state = mtable[state][move_index];\n while (new_state !== state) {\n if (ptable[new_state] === -1) {\n done = false;\n ptable[new_state] = depth + 1;\n }\n new_state = mtable[new_state][move_index];\n }\n }\n }\n depth++;\n }\n return ptable;\n}\n\nfunction ida_solve(indices, mtables, ptables) {\n let ncoords = indices.length;\n let bound = 0;\n for (let i = 0; i < ncoords; i++) {\n bound = Math.max(bound, ptables[i][indices[i]]);\n }\n while (true) {\n let path = ida_search(indices, mtables, ptables, bound, -1);\n if (path !== undefined) {\n return path;\n }\n bound++;\n }\n}\n\nfunction ida_search(indices, mtables, ptables, bound, last) {\n let ncoords = indices.length;\n let nmoves = mtables[0][0].length;\n let heuristic = 0;\n for (let i = 0; i < ncoords; i++) {\n heuristic = Math.max(heuristic, ptables[i][indices[i]]);\n }\n if (heuristic > bound) {\n return;\n }\n if (bound === 0 || heuristic === 0) {\n return [];\n }\n for (let m = 0; m < nmoves; m++) {\n if (m === last) {\n continue;\n }\n let new_indices = indices.slice();\n for (let c = 0; c < ncoords; c++) {\n new_indices[c] = mtables[c][indices[c]][m];\n }\n let r = 1;\n while (indices.some((_, i) => indices[i] !== new_indices[i])) {\n let subpath = ida_search(new_indices, mtables, ptables, bound - 1, m);\n if (subpath !== undefined) {\n return [[m, r]].concat(subpath);\n }\n for (let c = 0; c < ncoords; c++) {\n new_indices[c] = mtables[c][new_indices[c]][m];\n }\n r++;\n }\n }\n return;\n}\n\nfunction phase4_ida_solve(indices) {\n let mtable_o = generate_phase4_orientation_mtable();\n let mtable_p = generate_phase4_permutation_mtable();\n let ptable_o = generate_phase4_orientation_ptable();\n let ptable_p = generate_phase4_permutation_ptable();\n let ptable_n = generate_phase4_near_ptable_list(PHASE4_THRESHOLD);\n let bound = Math.max(ptable_o[indices[0]], ptable_p[indices[1]]);\n while (true) {\n let path = phase4_ida_search(\n indices,\n bound,\n -1,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n );\n if (path !== undefined) {\n return path;\n }\n bound++;\n }\n}\n\nfunction phase4_ida_search(\n indices,\n bound,\n last,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n) {\n let heuristic = Math.max(ptable_o[indices[0]], ptable_p[indices[1]]);\n if (heuristic > bound) {\n return;\n }\n if (\n heuristic <= PHASE4_THRESHOLD &&\n !binary_search(ptable_n, indices[0] + 19683 * indices[1])\n ) {\n heuristic = PHASE4_THRESHOLD + 1;\n }\n if (heuristic > bound) {\n return;\n }\n if (bound === 0 || heuristic === 0) {\n return [];\n }\n for (let m = 0; m < 3; m++) {\n if (m === last) {\n continue;\n }\n let new_indices = indices.slice();\n for (let r = 1; r < 5; r++) {\n new_indices[0] = mtable_o[new_indices[0]][m];\n new_indices[1] = mtable_p[new_indices[1]][m];\n let subpath = phase4_ida_search(\n new_indices,\n bound - 1,\n m,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n );\n if (subpath !== undefined) {\n return [[m, r]].concat(subpath);\n }\n }\n }\n return;\n}\n\nfunction* phase4_ida_solve_gen(indices) {\n let mtable_o = generate_phase4_orientation_mtable();\n let mtable_p = generate_phase4_permutation_mtable();\n let ptable_o = generate_phase4_orientation_ptable();\n let ptable_p = generate_phase4_permutation_ptable();\n let ptable_n = generate_phase4_near_ptable_list(PHASE4_THRESHOLD);\n let bound = Math.max(ptable_o[indices[0]], ptable_p[indices[1]]);\n while (true) {\n yield* phase4_ida_search_gen(\n indices,\n bound,\n -1,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n );\n bound++;\n }\n}\n\nfunction* phase4_ida_search_gen(\n indices,\n bound,\n last,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n) {\n let heuristic = Math.max(ptable_o[indices[0]], ptable_p[indices[1]]);\n if (heuristic > bound) {\n return;\n }\n if (\n heuristic <= PHASE4_THRESHOLD &&\n !binary_search(ptable_n, indices[0] + 19683 * indices[1])\n ) {\n heuristic = PHASE4_THRESHOLD + 1;\n }\n if (heuristic > bound) {\n return;\n }\n if (bound === 0 || heuristic === 0) {\n yield [];\n }\n for (let m = 0; m < 3; m++) {\n if (m === last) {\n continue;\n }\n let new_indices = indices.slice();\n for (let r = 1; r < 5; r++) {\n new_indices[0] = mtable_o[new_indices[0]][m];\n new_indices[1] = mtable_p[new_indices[1]][m];\n let subpath_gen = phase4_ida_search_gen(\n new_indices,\n bound - 1,\n m,\n mtable_o,\n mtable_p,\n ptable_o,\n ptable_p,\n ptable_n,\n );\n while (true) {\n let { value: subpath, done } = subpath_gen.next();\n if (done) {\n break;\n }\n yield [[m, r]].concat(subpath);\n }\n }\n }\n}\n\n/* Additional solving logic for the hybrid scrambler\n\nRather than being a purely random-move or random-state scramble (the former isn't random enough, but\nthe latter is too slow), we fully randomise the locations of the white pieces and of the grey pieces\nthen apply a bunch of random moves afterwards.\n\nThis is in the sense that the C(20,10,5,5) = 46558512 possible combinations of where the white, grey\nand E-slice pieces are (without distinguishing between the white pieces, etc.) are equally likely.\n\nCorner orientation is effectively randomised by doing at least 8 random moves on each hemisphere, so\nfor all intents and purposes, this should be as good as a random-state scramble.\n*/\n\nfunction generate_hs_mtable() {\n if (tables.hsm) {\n return tables.hsm;\n }\n const C20_5 = C(20, 5); // = 15504\n let mtable = Array(C20_5);\n for (let i = 0; i < C20_5; i++) {\n mtable[i] = Array(7);\n let comb = index_to_comb(i, 5, 20);\n for (let m = 0; m < 7; m++) {\n let new_comb = compose(comb, moves[m][0]);\n mtable[i][m] = comb_to_index(new_comb);\n }\n }\n return (tables.hsm = mtable);\n}\n\nfunction generate_hs_u_ptable() {\n if (tables.hsup) {\n return tables.hsup;\n }\n let mtable = generate_hs_mtable();\n return (tables.hsup = bfs(mtable, [15503]));\n}\n\nfunction generate_hs_d_ptable() {\n if (tables.hsdp) {\n return tables.hsdp;\n }\n let mtable = generate_hs_mtable();\n return (tables.hsdp = bfs(mtable, [0]));\n}\n\nfunction index_hs(state) {\n let p = state[0];\n return [\n comb_to_index(p.map((x) => +(x < 5))),\n comb_to_index(p.map((x) => +(x >= 15))),\n ];\n}\n\n// this is too unpredictably slow\n// (obv we could generate a full pruning table, but that defeats the purpose of fast initialisation)\nfunction solve_hs(state) {\n let mtables = Array(2).fill(generate_hs_mtable());\n let ptables = [generate_hs_u_ptable(), generate_hs_d_ptable()];\n return ida_solve(index_hs(state), mtables, ptables);\n}\n\n// this gives sequences ~2 moves longer on average, but is way faster\nfunction solve_hs_twophase(state) {\n let mtable = generate_hs_mtable();\n let u_ptable = generate_hs_u_ptable();\n let d_ptable = generate_hs_d_ptable();\n let indices = index_hs(state);\n let sol1;\n /*\n\tif (u_ptable[indices[0]] < d_ptable[indices[1]]) sol1 = ida_solve([indices[0]], [mtable], [u_ptable]);\n\telse sol1 = ida_solve([indices[1]], [mtable], [d_ptable]);\n\t// don't do this because it'd give solutions starting with flip pretty often.\n\t*/\n sol1 = ida_solve([indices[1]], [mtable], [d_ptable]);\n let s1 = apply_move_sequence(state, sol1);\n let sol2 = ida_solve(index_hs(s1), [mtable, mtable], [u_ptable, d_ptable]);\n return sol1.concat(sol2);\n}\n\nfunction generate_hybrid_scramble() {\n let move_sequence = [];\n let sort_seq = solve_hs_twophase(random_state());\n for (let [m, r] of sort_seq) {\n let period = m === 6 ? 2 : 5;\n move_sequence.unshift([m, (period - r) % period]);\n }\n\n // TODO: remove possible move cancellations between the random-state and random-move phases\n return move_sequence.concat(generate_random_move_scramble(2, 9));\n}\n\nfunction generate_fullseparate_mtable() {\n if (tables.fsm) {\n return tables.fsm;\n }\n const C20_10 = C(20, 10); // = 184756\n const C19_9 = C(19, 9); // = 92378\n let moves12 = moves.slice(0, 6);\n moves12 = moves12.concat(\n moves12.map((move) => compose_o(compose_o(move_x2, move), move_x2)),\n );\n // get all 12 face moves by conjugating the six \"top half\" moves with a flip\n let moves15 = moves12.concat([move_x2, move_y, move_rot]);\n let mtable = Array(C20_10 * 2);\n let mtable15 = Array(C20_10 * 2);\n for (let i = 0; i < C20_10; i++) {\n mtable[i * 2] = Array(12);\n mtable[i * 2 + 1] = Array(12);\n mtable15[i * 2] = Array(15);\n mtable15[i * 2 + 1] = Array(15);\n let comb = index_to_comb(i, 10, 20);\n let perm = [];\n for (let j = 0, k = 0; j < 20; j++) {\n if (comb[j] === 0) {\n perm[j] = -1;\n } else {\n perm[j] = k++;\n }\n }\n for (let m = 0; m < 15; m++) {\n let new_perm = compose(perm, moves15[m][0]);\n let new_comb = compose(comb, moves15[m][0]);\n let parity = permutation_parity(new_perm.filter((x) => x >= 0));\n let I = comb_to_index(new_comb);\n mtable15[i * 2][m] = I * 2 + parity;\n mtable15[i * 2 + 1][m] = I * 2 + (parity ^ 1);\n if (m < 12) {\n mtable[i * 2][m] = I * 2 + parity;\n mtable[i * 2 + 1][m] = I * 2 + (parity ^ 1);\n }\n }\n }\n tables.fsm = mtable;\n tables.fsm15 = mtable15;\n return mtable;\n}\n\nfunction generate_fullseparate_ptable() {\n if (tables.fsp) {\n return tables.fsp;\n }\n let mtable = generate_fullseparate_mtable();\n /*\n\tlet separations = [\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n\t\t[0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1],\n\t\t[0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],\n\t\t[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1],\n\t\t[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1],\n\t\t[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1],\n\t\t[1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1].map(x => 1-x),\n\t\t[1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0].map(x => 1-x),\n\t\t[1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0].map(x => 1-x),\n\t\t[0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0],\n\t];\n\t*/\n let goal_states = [0];\n let l = 1;\n while (true) {\n for (let ind of goal_states) {\n for (let m = 12; m < 15; m++) {\n let new_ind = tables.fsm15[ind][m];\n if (goal_states.indexOf(new_ind) === -1) {\n goal_states.push(new_ind);\n goal_states.sort((x, y) => x - y); // slow but w/e\n }\n }\n }\n if (goal_states.length === l) {\n break;\n }\n l = goal_states.length;\n }\n print(goal_states.toSource());\n return (tables.fsp = bfs5(mtable, goal_states));\n}\n\nfunction bfs5(mtable, goal_states) {\n let N = mtable.length;\n let nmoves = mtable[0].length;\n let ptable = Array(N).fill(-1);\n let queue = goal_states.slice();\n let new_queue = [];\n let depth = 0;\n while (queue.length > 0) {\n new_queue.length = 0;\n for (let state of queue) {\n if (ptable[state] !== -1) {\n continue;\n }\n ptable[state] = depth;\n for (let move_index = 0; move_index < nmoves; move_index++) {\n let new_state = mtable[state][move_index];\n for (let r = 1; r <= 4; r++) {\n if (r === 1 || r === 4) {\n new_queue.push(new_state);\n }\n new_state = mtable[new_state][move_index];\n }\n }\n }\n [queue, new_queue] = [new_queue, queue];\n depth += 1;\n }\n return ptable;\n}\n\nexport function getRandomKilominxScramble() {\n return new Alg(stringify_move_sequence(generate_random_state_scramble()));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AA0DA,SAAS,uBAAuB;AAEhC,IAAI,mBAAmB;AAavB,SAAS,UAAU,GAAG;AACpB,MAAI,IAAI,GAAG;AACT,WAAO;AAAA,EACT;AACA,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,KAAK,GAAG,KAAK;AAC3B,SAAK;AAAA,EACP;AACA,SAAO;AACT;AAEA,SAAS,EAAE,GAAG,GAAG;AACf,MAAI,IAAI,KAAK,IAAI,GAAG;AAClB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,KAAK,MAAM,GAAG;AACtB,WAAO;AAAA,EACT;AACA,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,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,EACF;AACA;AACF;AA+RO,SAAS,4BAA4B;AAC1C,SAAO,IAAI,IAAI,wBAAwB,+BAA+B,CAAC,CAAC;AAC1E;",
|
|
6
|
-
"names": ["evenpermutation10_to_index", "index_to_evenpermutation10", "C", "i", "last"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|