cubing
Version:
A collection of JavaScript cubing libraries.
2,153 lines (2,150 loc) • 69.4 kB
JavaScript
import "./chunk-NAPITA3L.js";
import "./chunk-OUM32GEA.js";
import {
random333Scramble
} from "./chunk-SGJ5WPE4.js";
import "./chunk-7GUL3OBQ.js";
import "./chunk-VRTKWZPL.js";
import "./chunk-RINY3U6G.js";
import {
Alg
} from "./chunk-O6HEZXGY.js";
// src/cubing/vendor/mit/cs0x7f/cstimer/src/js/lib/mathlib.ts
var Cnk = [];
var fact = [1];
for (let i = 0; i < 32; ++i) {
Cnk[i] = [];
for (let j = 0; j < 32; ++j) {
Cnk[i][j] = 0;
}
}
for (let i = 0; i < 32; ++i) {
Cnk[i][0] = Cnk[i][i] = 1;
fact[i + 1] = fact[i] * (i + 1);
for (let j = 1; j < i; ++j) {
Cnk[i][j] = Cnk[i - 1][j - 1] + Cnk[i - 1][j];
}
}
function circle(arr, ...moreArgs) {
const length = moreArgs.length;
const temp = arr[moreArgs[length - 1]];
for (let i = length; i > 0; i--) {
arr[moreArgs[i]] = arr[moreArgs[i - 1]];
}
arr[moreArgs[0]] = temp;
return circle;
}
function set8Perm(arr, idx, n, even) {
n = (n || 8) - 1;
let val = 1985229328;
let prt = 0;
even ??= 0;
if (even < 0) {
idx <<= 1;
}
for (let i = 0; i < n; ++i) {
const p = fact[n - i];
let v = ~~(idx / p);
prt ^= v;
idx %= p;
v <<= 2;
arr[i] = val >> v & 7;
const m = (1 << v) - 1;
val = (val & m) + (val >> 4 & ~m);
}
if (even < 0 && (prt & 1) !== 0) {
arr[n] = arr[n - 1];
arr[n - 1] = val & 7;
} else {
arr[n] = val & 7;
}
return arr;
}
// src/cubing/vendor/mit/cs0x7f/cstimer/src/js/scramble/444-solver.ts
import { randomUIntBelow } from "random-uint-below";
function createArray(length1, length2) {
const result = new Array(length1);
if (length2 !== void 0) {
for (let i = 0; i < length1; i++) {
result[i] = new Array(length2);
}
}
return result;
}
var _;
var seedTable = {};
var CM$ = {};
var Q$Object = 0;
var Q$Serializable = 30;
var Q$Center1 = 21;
var Q$CornerCube = 22;
var Q$Edge3 = 23;
var Q$FullCube_0 = 24;
var Q$FullCube_$1 = 25;
var Q$Comparable = 34;
var Q$Search_0 = 26;
var Q$Object_$1 = 40;
function newSeed(id) {
return new seedTable[id]();
}
function defineSeed(id, superSeed, castableTypeMap, ...moreArgs) {
let seed = seedTable[id];
if (seed && !seed.___clazz$) {
_ = seed.prototype;
} else {
!seed && (seed = seedTable[id] = function() {
});
_ = seed.prototype = superSeed < 0 ? {} : newSeed(superSeed);
_.castableTypeMap$ = castableTypeMap;
}
for (const arg of moreArgs) {
arg.prototype = _;
}
if (seed.___clazz$) {
_.___clazz$ = seed.___clazz$;
seed.___clazz$ = null;
}
}
function makeCastMap(a) {
const result = {};
for (let i_0 = 0, c = a.length; i_0 < c; ++i_0) {
result[a[i_0]] = 1;
}
return result;
}
defineSeed(1, -1, CM$);
_.value = null;
function Array_0() {
}
function createFrom(a, length_0) {
const result = createFromSeed(0, length_0);
initValues(a.___clazz$, a.castableTypeMap$, a.queryId$, result);
return result;
}
function createFromSeed(seedType, length_0) {
const array = new Array(length_0);
if (seedType === 3) {
for (let i_0 = 0; i_0 < length_0; ++i_0) {
const value = {
m: 0,
l: 0,
h: 0
};
value.l = value.m = value.h = 0;
array[i_0] = value;
}
} else if (seedType > 0) {
const value = [null, 0, false][seedType];
for (let i_0 = 0; i_0 < length_0; ++i_0) {
array[i_0] = value;
}
}
return array;
}
function initDim(arrayClass, castableTypeMap, queryId, length_0, seedType) {
const result = createFromSeed(seedType, length_0);
initValues(arrayClass, castableTypeMap, queryId, result);
return result;
}
function initValues(arrayClass, castableTypeMap, queryId, array) {
$clinit_Array$ExpandoWrapper();
wrapArray(array, expandoNames_0, expandoValues_0);
array.___clazz$ = arrayClass;
array.castableTypeMap$ = castableTypeMap;
array.queryId$ = queryId;
return array;
}
function setCheck(array, index, value) {
return array[index] = value;
}
defineSeed(73, 1, {}, Array_0);
_.queryId$ = 0;
var ran$clinit_Array$ExpandoWrapper = false;
function $clinit_Array$ExpandoWrapper() {
if (ran$clinit_Array$ExpandoWrapper) {
return;
}
ran$clinit_Array$ExpandoWrapper = true;
expandoNames_0 = [];
expandoValues_0 = [];
initExpandos(new Array_0(), expandoNames_0, expandoValues_0);
}
function initExpandos(protoType, expandoNames, expandoValues) {
let i_0 = 0;
let value;
for (const name_0 in protoType) {
if (value = protoType[name_0]) {
expandoNames[i_0] = name_0;
expandoValues[i_0] = value;
++i_0;
}
}
}
function wrapArray(array, expandoNames, expandoValues) {
$clinit_Array$ExpandoWrapper();
for (let i_0 = 0, c = expandoNames.length; i_0 < c; ++i_0) {
array[expandoNames[i_0]] = expandoValues[i_0];
}
}
var expandoNames_0;
var expandoValues_0;
function canCast(src, dstId) {
return src.castableTypeMap$ && !!src.castableTypeMap$[dstId];
}
function instanceOf(src, dstId) {
return src !== null && canCast(src, dstId);
}
var ran$clinit_Center1 = false;
function $clinit_Center1() {
if (ran$clinit_Center1) {
return false;
}
ran$clinit_Center1 = true;
ctsmv = createArray(15582, 36);
sym2raw = createArray(15582);
csprun = createArray(15582);
symmult = createArray(48, 48);
symmove = createArray(48, 36);
syminv = createArray(48);
finish_0 = createArray(48);
}
function $$init_1(this$static) {
this$static.ct = createArray(24);
}
function $equals(this$static, obj) {
let c;
let i_0;
if (instanceOf(obj, Q$Center1)) {
c = obj;
for (i_0 = 0; i_0 < 24; ++i_0) {
if (this$static.ct[i_0] !== c.ct[i_0]) {
return false;
}
}
return true;
}
return false;
}
function $get_1(this$static) {
let i_0;
let idx;
let r;
idx = 0;
r = 8;
for (i_0 = 23; i_0 >= 0; --i_0) {
this$static.ct[i_0] === 1 && (idx += Cnk[i_0][r--]);
}
return idx;
}
function $getsym(this$static) {
let cord;
let j;
if (raw2sym !== null) {
return raw2sym[$get_1(this$static)];
}
for (j = 0; j < 48; ++j) {
cord = raw2sym_0($get_1(this$static));
if (cord !== -1) {
return cord * 64 + j;
}
$rot(this$static, 0);
j % 2 === 1 && $rot(this$static, 1);
j % 8 === 7 && $rot(this$static, 2);
j % 16 === 15 && $rot(this$static, 3);
}
}
function $move(this$static, m_0) {
const key = m_0 % 3;
m_0 = ~~(m_0 / 3);
switch (m_0) {
case 0: {
swap(this$static.ct, 0, 1, 2, 3, key);
break;
}
case 1: {
swap(this$static.ct, 16, 17, 18, 19, key);
break;
}
case 2: {
swap(this$static.ct, 8, 9, 10, 11, key);
break;
}
case 3: {
swap(this$static.ct, 4, 5, 6, 7, key);
break;
}
case 4: {
swap(this$static.ct, 20, 21, 22, 23, key);
break;
}
case 5: {
swap(this$static.ct, 12, 13, 14, 15, key);
break;
}
case 6: {
swap(this$static.ct, 0, 1, 2, 3, key);
swap(this$static.ct, 8, 20, 12, 16, key);
swap(this$static.ct, 9, 21, 13, 17, key);
break;
}
case 7: {
swap(this$static.ct, 16, 17, 18, 19, key);
swap(this$static.ct, 1, 15, 5, 9, key);
swap(this$static.ct, 2, 12, 6, 10, key);
break;
}
case 8: {
swap(this$static.ct, 8, 9, 10, 11, key);
swap(this$static.ct, 2, 19, 4, 21, key);
swap(this$static.ct, 3, 16, 5, 22, key);
break;
}
case 9: {
swap(this$static.ct, 4, 5, 6, 7, key);
swap(this$static.ct, 10, 18, 14, 22, key);
swap(this$static.ct, 11, 19, 15, 23, key);
break;
}
case 10: {
swap(this$static.ct, 20, 21, 22, 23, key);
swap(this$static.ct, 0, 8, 4, 14, key);
swap(this$static.ct, 3, 11, 7, 13, key);
break;
}
case 11: {
swap(this$static.ct, 12, 13, 14, 15, key);
swap(this$static.ct, 1, 20, 7, 18, key);
swap(this$static.ct, 0, 23, 6, 17, key);
}
}
}
function $rot(this$static, r) {
switch (r) {
case 0: {
$move(this$static, 19);
$move(this$static, 28);
break;
}
case 1: {
$move(this$static, 21);
$move(this$static, 32);
break;
}
case 2: {
swap(this$static.ct, 0, 3, 1, 2, 1);
swap(this$static.ct, 8, 11, 9, 10, 1);
swap(this$static.ct, 4, 7, 5, 6, 1);
swap(this$static.ct, 12, 15, 13, 14, 1);
swap(this$static.ct, 16, 19, 21, 22, 1);
swap(this$static.ct, 17, 18, 20, 23, 1);
break;
}
case 3: {
$move(this$static, 18);
$move(this$static, 29);
$move(this$static, 24);
$move(this$static, 35);
}
}
}
function $rotate(this$static, r) {
let j;
for (j = 0; j < r; ++j) {
$rot(this$static, 0);
j % 2 === 1 && $rot(this$static, 1);
j % 8 === 7 && $rot(this$static, 2);
j % 16 === 15 && $rot(this$static, 3);
}
}
function $set_0(this$static, idx) {
let i_0;
let r;
r = 8;
for (i_0 = 23; i_0 >= 0; --i_0) {
this$static.ct[i_0] = 0;
if (idx >= Cnk[i_0][r]) {
idx -= Cnk[i_0][r--];
this$static.ct[i_0] = 1;
}
}
}
function $set_1(this$static, c) {
let i_0;
for (i_0 = 0; i_0 < 24; ++i_0) {
this$static.ct[i_0] = c.ct[i_0];
}
}
function Center1_0() {
let i_0;
$$init_1(this);
for (i_0 = 0; i_0 < 8; ++i_0) {
this.ct[i_0] = 1;
}
for (i_0 = 8; i_0 < 24; ++i_0) {
this.ct[i_0] = 0;
}
}
function Center1_1(c, urf) {
let i_0;
$$init_1(this);
for (i_0 = 0; i_0 < 24; ++i_0) {
this.ct[i_0] = ~~(c.ct[i_0] / 2) === urf ? 1 : 0;
}
}
function Center1_2(ct) {
let i_0;
$$init_1(this);
for (i_0 = 0; i_0 < 24; ++i_0) {
this.ct[i_0] = ct[i_0];
}
}
function createMoveTable() {
let i_0;
let m_0;
const c = new Center1_0();
const d = new Center1_0();
for (i_0 = 0; i_0 < 15582; ++i_0) {
$set_0(d, sym2raw[i_0]);
for (m_0 = 0; m_0 < 36; ++m_0) {
$set_1(c, d);
$move(c, m_0);
ctsmv[i_0][m_0] = $getsym(c);
}
}
}
function createPrun() {
let check;
let depth;
let done;
let i_0;
let idx;
let inv;
let m_0;
let select;
fill_0(csprun);
csprun[0] = 0;
depth = 0;
done = 1;
while (done !== 15582) {
inv = depth > 4;
select = inv ? -1 : depth;
check = inv ? depth : -1;
++depth;
for (i_0 = 0; i_0 < 15582; ++i_0) {
if (csprun[i_0] !== select) {
continue;
}
for (m_0 = 0; m_0 < 27; ++m_0) {
idx = ~~ctsmv[i_0][m_0] >>> 6;
if (csprun[idx] !== check) {
continue;
}
++done;
if (inv) {
csprun[i_0] = depth;
break;
} else {
csprun[idx] = depth;
}
}
}
}
}
function getSolvedSym(cube) {
let check;
let i_0;
let j;
const c = new Center1_2(cube.ct);
for (j = 0; j < 48; ++j) {
check = true;
for (i_0 = 0; i_0 < 24; ++i_0) {
if (c.ct[i_0] !== ~~(i_0 / 4)) {
check = false;
break;
}
}
if (check) {
return j;
}
$rot(c, 0);
j % 2 === 1 && $rot(c, 1);
j % 8 === 7 && $rot(c, 2);
j % 16 === 15 && $rot(c, 3);
}
return -1;
}
function initSym_0() {
let i_0;
let j;
let k_0;
const c = new Center1_0();
for (i_0 = 0; i_0 < 24; ++i_0) {
c.ct[i_0] = i_0;
}
const d = new Center1_2(c.ct);
const e = new Center1_2(c.ct);
const f = new Center1_2(c.ct);
for (i_0 = 0; i_0 < 48; ++i_0) {
for (j = 0; j < 48; ++j) {
for (k_0 = 0; k_0 < 48; ++k_0) {
if ($equals(c, d)) {
symmult[i_0][j] = k_0;
k_0 === 0 && (syminv[i_0] = j);
}
$rot(d, 0);
k_0 % 2 === 1 && $rot(d, 1);
k_0 % 8 === 7 && $rot(d, 2);
k_0 % 16 === 15 && $rot(d, 3);
}
$rot(c, 0);
j % 2 === 1 && $rot(c, 1);
j % 8 === 7 && $rot(c, 2);
j % 16 === 15 && $rot(c, 3);
}
$rot(c, 0);
i_0 % 2 === 1 && $rot(c, 1);
i_0 % 8 === 7 && $rot(c, 2);
i_0 % 16 === 15 && $rot(c, 3);
}
for (i_0 = 0; i_0 < 48; ++i_0) {
$set_1(c, e);
$rotate(c, syminv[i_0]);
for (j = 0; j < 36; ++j) {
$set_1(d, c);
$move(d, j);
$rotate(d, i_0);
for (k_0 = 0; k_0 < 36; ++k_0) {
$set_1(f, e);
$move(f, k_0);
if ($equals(f, d)) {
symmove[i_0][j] = k_0;
break;
}
}
}
}
$set_0(c, 0);
for (i_0 = 0; i_0 < 48; ++i_0) {
finish_0[syminv[i_0]] = $get_1(c);
$rot(c, 0);
i_0 % 2 === 1 && $rot(c, 1);
i_0 % 8 === 7 && $rot(c, 2);
i_0 % 16 === 15 && $rot(c, 3);
}
}
function initSym2Raw() {
let count;
let i_0;
let idx;
let j;
const c = new Center1_0();
const occ = createArray(22984);
for (i_0 = 0; i_0 < 22984; i_0++) {
occ[i_0] = 0;
}
count = 0;
for (i_0 = 0; i_0 < 735471; ++i_0) {
if ((occ[~~i_0 >>> 5] & 1 << (i_0 & 31)) === 0) {
$set_0(c, i_0);
for (j = 0; j < 48; ++j) {
idx = $get_1(c);
occ[~~idx >>> 5] |= 1 << (idx & 31);
raw2sym !== null && (raw2sym[idx] = count << 6 | syminv[j]);
$rot(c, 0);
j % 2 === 1 && $rot(c, 1);
j % 8 === 7 && $rot(c, 2);
j % 16 === 15 && $rot(c, 3);
}
sym2raw[count++] = i_0;
}
}
}
function raw2sym_0(n) {
const m_0 = binarySearch_0(sym2raw, n);
return m_0 >= 0 ? m_0 : -1;
}
defineSeed(153, 1, makeCastMap([Q$Center1]), Center1_0, Center1_1, Center1_2);
var csprun;
var ctsmv;
var finish_0;
var raw2sym = null;
var sym2raw;
var syminv;
var symmove;
var symmult;
var ran$clinit_Center2 = false;
function $clinit_Center2() {
if (ran$clinit_Center2) {
return;
}
ran$clinit_Center2 = true;
rlmv = createArray(70, 28);
ctmv = createArray(6435, 28);
rlrot = createArray(70, 16);
ctrot = createArray(6435, 16);
ctprun = createArray(450450);
pmv = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0
];
}
function $getct(this$static) {
let i_0;
let idx;
let r;
idx = 0;
r = 8;
for (i_0 = 14; i_0 >= 0; --i_0) {
this$static.ct[i_0] !== this$static.ct[15] && (idx += Cnk[i_0][r--]);
}
return idx;
}
function $getrl(this$static) {
let i_0;
let idx;
let r;
idx = 0;
r = 4;
for (i_0 = 6; i_0 >= 0; --i_0) {
this$static.rl[i_0] !== this$static.rl[7] && (idx += Cnk[i_0][r--]);
}
return idx * 2 + this$static.parity;
}
function $move_0(this$static, m_0) {
this$static.parity ^= pmv[m_0];
const key = m_0 % 3;
m_0 = ~~(m_0 / 3);
switch (m_0) {
case 0: {
swap(this$static.ct, 0, 1, 2, 3, key);
break;
}
case 1: {
swap(this$static.rl, 0, 1, 2, 3, key);
break;
}
case 2: {
swap(this$static.ct, 8, 9, 10, 11, key);
break;
}
case 3: {
swap(this$static.ct, 4, 5, 6, 7, key);
break;
}
case 4: {
swap(this$static.rl, 4, 5, 6, 7, key);
break;
}
case 5: {
swap(this$static.ct, 12, 13, 14, 15, key);
break;
}
case 6: {
swap(this$static.ct, 0, 1, 2, 3, key);
swap(this$static.rl, 0, 5, 4, 1, key);
swap(this$static.ct, 8, 9, 12, 13, key);
break;
}
case 7: {
swap(this$static.rl, 0, 1, 2, 3, key);
swap(this$static.ct, 1, 15, 5, 9, key);
swap(this$static.ct, 2, 12, 6, 10, key);
break;
}
case 8: {
swap(this$static.ct, 8, 9, 10, 11, key);
swap(this$static.rl, 0, 3, 6, 5, key);
swap(this$static.ct, 3, 2, 5, 4, key);
break;
}
case 9: {
swap(this$static.ct, 4, 5, 6, 7, key);
swap(this$static.rl, 3, 2, 7, 6, key);
swap(this$static.ct, 11, 10, 15, 14, key);
break;
}
case 10: {
swap(this$static.rl, 4, 5, 6, 7, key);
swap(this$static.ct, 0, 8, 4, 14, key);
swap(this$static.ct, 3, 11, 7, 13, key);
break;
}
case 11: {
swap(this$static.ct, 12, 13, 14, 15, key);
swap(this$static.rl, 1, 4, 7, 2, key);
swap(this$static.ct, 1, 0, 7, 6, key);
}
}
}
function $rot_0(this$static, r) {
switch (r) {
case 0: {
$move_0(this$static, 19);
$move_0(this$static, 28);
break;
}
case 1: {
$move_0(this$static, 21);
$move_0(this$static, 32);
break;
}
case 2: {
swap(this$static.ct, 0, 3, 1, 2, 1);
swap(this$static.ct, 8, 11, 9, 10, 1);
swap(this$static.ct, 4, 7, 5, 6, 1);
swap(this$static.ct, 12, 15, 13, 14, 1);
swap(this$static.rl, 0, 3, 5, 6, 1);
swap(this$static.rl, 1, 2, 4, 7, 1);
}
}
}
function $set_2(this$static, c, edgeParity) {
let i_0;
for (i_0 = 0; i_0 < 16; ++i_0) {
this$static.ct[i_0] = ~~(c.ct[i_0] / 2);
}
for (i_0 = 0; i_0 < 8; ++i_0) {
this$static.rl[i_0] = c.ct[i_0 + 16];
}
this$static.parity = edgeParity;
}
function $setct(this$static, idx) {
let i_0;
let r;
r = 8;
this$static.ct[15] = 0;
for (i_0 = 14; i_0 >= 0; --i_0) {
if (idx >= Cnk[i_0][r]) {
idx -= Cnk[i_0][r--];
this$static.ct[i_0] = 1;
} else {
this$static.ct[i_0] = 0;
}
}
}
function $setrl(this$static, idx) {
let i_0;
let r;
this$static.parity = idx & 1;
idx >>>= 1;
r = 4;
this$static.rl[7] = 0;
for (i_0 = 6; i_0 >= 0; --i_0) {
if (idx >= Cnk[i_0][r]) {
idx -= Cnk[i_0][r--];
this$static.rl[i_0] = 1;
} else {
this$static.rl[i_0] = 0;
}
}
}
function Center2_0() {
this.rl = createArray(8);
this.ct = createArray(16);
}
function init_3() {
let ct;
let ctx;
let depth;
let done;
let i_0;
let idx;
let j;
let m_0;
let rl;
let rlx;
const c = new Center2_0();
for (i_0 = 0; i_0 < 70; ++i_0) {
for (m_0 = 0; m_0 < 28; ++m_0) {
$setrl(c, i_0);
$move_0(c, move2std[m_0]);
rlmv[i_0][m_0] = $getrl(c);
}
}
for (i_0 = 0; i_0 < 70; ++i_0) {
$setrl(c, i_0);
for (j = 0; j < 16; ++j) {
rlrot[i_0][j] = $getrl(c);
$rot_0(c, 0);
j % 2 === 1 && $rot_0(c, 1);
j % 8 === 7 && $rot_0(c, 2);
}
}
for (i_0 = 0; i_0 < 6435; ++i_0) {
$setct(c, i_0);
for (j = 0; j < 16; ++j) {
ctrot[i_0][j] = $getct(c) & 65535;
$rot_0(c, 0);
j % 2 === 1 && $rot_0(c, 1);
j % 8 === 7 && $rot_0(c, 2);
}
}
for (i_0 = 0; i_0 < 6435; ++i_0) {
for (m_0 = 0; m_0 < 28; ++m_0) {
$setct(c, i_0);
$move_0(c, move2std[m_0]);
ctmv[i_0][m_0] = $getct(c) & 65535;
}
}
fill_0(ctprun);
ctprun[0] = ctprun[18] = ctprun[28] = ctprun[46] = ctprun[54] = ctprun[56] = 0;
depth = 0;
done = 6;
while (done !== 450450) {
const inv = depth > 6;
const select = inv ? -1 : depth;
const check = inv ? depth : -1;
++depth;
for (i_0 = 0; i_0 < 450450; ++i_0) {
if (ctprun[i_0] !== select) {
continue;
}
ct = ~~(i_0 / 70);
rl = i_0 % 70;
for (m_0 = 0; m_0 < 23; ++m_0) {
ctx = ctmv[ct][m_0];
rlx = rlmv[rl][m_0];
idx = ctx * 70 + rlx;
if (ctprun[idx] !== check) {
continue;
}
++done;
if (inv) {
ctprun[i_0] = depth;
break;
} else {
ctprun[idx] = depth;
}
}
}
}
}
defineSeed(154, 1, {}, Center2_0);
_.parity = 0;
var ctmv;
var ctprun;
var ctrot;
var pmv;
var rlmv;
var rlrot;
var ran$clinit_Center3 = false;
function $clinit_Center3() {
if (ran$clinit_Center3) {
return;
}
ran$clinit_Center3 = true;
ctmove = createArray(29400, 20);
pmove = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1];
prun_0 = createArray(29400);
rl2std = [0, 9, 14, 23, 27, 28, 41, 42, 46, 55, 60, 69];
std2rl = createArray(70);
}
function $getct_0(this$static) {
let i_0;
let idx;
let idxrl;
let r;
idx = 0;
r = 4;
for (i_0 = 6; i_0 >= 0; --i_0) {
this$static.ud[i_0] !== this$static.ud[7] && (idx += Cnk[i_0][r--]);
}
idx *= 35;
r = 4;
for (i_0 = 6; i_0 >= 0; --i_0) {
this$static.fb[i_0] !== this$static.fb[7] && (idx += Cnk[i_0][r--]);
}
idx *= 12;
const check = this$static.fb[7] ^ this$static.ud[7];
idxrl = 0;
r = 4;
for (i_0 = 7; i_0 >= 0; --i_0) {
this$static.rl[i_0] !== check && (idxrl += Cnk[i_0][r--]);
}
return this$static.parity + 2 * (idx + std2rl[idxrl]);
}
function $move_1(this$static, i_0) {
this$static.parity ^= pmove[i_0];
switch (i_0) {
case 0:
case 1:
case 2: {
swap(this$static.ud, 0, 1, 2, 3, i_0 % 3);
break;
}
case 3: {
swap(this$static.rl, 0, 1, 2, 3, 1);
break;
}
case 4:
case 5:
case 6: {
swap(this$static.fb, 0, 1, 2, 3, (i_0 - 1) % 3);
break;
}
case 7:
case 8:
case 9: {
swap(this$static.ud, 4, 5, 6, 7, (i_0 - 1) % 3);
break;
}
case 10: {
swap(this$static.rl, 4, 5, 6, 7, 1);
break;
}
case 11:
case 12:
case 13: {
swap(this$static.fb, 4, 5, 6, 7, (i_0 + 1) % 3);
break;
}
case 14: {
swap(this$static.ud, 0, 1, 2, 3, 1);
swap(this$static.rl, 0, 5, 4, 1, 1);
swap(this$static.fb, 0, 5, 4, 1, 1);
break;
}
case 15: {
swap(this$static.rl, 0, 1, 2, 3, 1);
swap(this$static.fb, 1, 4, 7, 2, 1);
swap(this$static.ud, 1, 6, 5, 2, 1);
break;
}
case 16: {
swap(this$static.fb, 0, 1, 2, 3, 1);
swap(this$static.ud, 3, 2, 5, 4, 1);
swap(this$static.rl, 0, 3, 6, 5, 1);
break;
}
case 17: {
swap(this$static.ud, 4, 5, 6, 7, 1);
swap(this$static.rl, 3, 2, 7, 6, 1);
swap(this$static.fb, 3, 2, 7, 6, 1);
break;
}
case 18: {
swap(this$static.rl, 4, 5, 6, 7, 1);
swap(this$static.fb, 0, 3, 6, 5, 1);
swap(this$static.ud, 0, 3, 4, 7, 1);
break;
}
case 19: {
swap(this$static.fb, 4, 5, 6, 7, 1);
swap(this$static.ud, 0, 7, 6, 1, 1);
swap(this$static.rl, 1, 4, 7, 2, 1);
}
}
}
function $set_3(this$static, c, eXc_parity) {
let i_0;
const parity = (c.ct[0] > c.ct[8] ? 1 : 0) ^ (c.ct[8] > c.ct[16] ? 1 : 0) ^ (c.ct[0] > c.ct[16] ? 1 : 0) ? 1 : 0;
for (i_0 = 0; i_0 < 8; ++i_0) {
this$static.ud[i_0] = c.ct[i_0] & 1 ^ 1;
this$static.fb[i_0] = c.ct[i_0 + 8] & 1 ^ 1;
this$static.rl[i_0] = c.ct[i_0 + 16] & 1 ^ 1 ^ parity;
}
this$static.parity = parity ^ eXc_parity;
}
function $setct_0(this$static, idx) {
let i_0;
let idxfb;
let idxrl;
let r;
this$static.parity = idx & 1;
idx >>>= 1;
idxrl = rl2std[idx % 12];
idx = ~~(idx / 12);
r = 4;
for (i_0 = 7; i_0 >= 0; --i_0) {
this$static.rl[i_0] = 0;
if (idxrl >= Cnk[i_0][r]) {
idxrl -= Cnk[i_0][r--];
this$static.rl[i_0] = 1;
}
}
idxfb = idx % 35;
idx = ~~(idx / 35);
r = 4;
this$static.fb[7] = 0;
for (i_0 = 6; i_0 >= 0; --i_0) {
if (idxfb >= Cnk[i_0][r]) {
idxfb -= Cnk[i_0][r--];
this$static.fb[i_0] = 1;
} else {
this$static.fb[i_0] = 0;
}
}
r = 4;
this$static.ud[7] = 0;
for (i_0 = 6; i_0 >= 0; --i_0) {
if (idx >= Cnk[i_0][r]) {
idx -= Cnk[i_0][r--];
this$static.ud[i_0] = 1;
} else {
this$static.ud[i_0] = 0;
}
}
}
function Center3_0() {
this.ud = createArray(8);
this.rl = createArray(8);
this.fb = createArray(8);
}
function init_4() {
let depth;
let done;
let i_0;
let m_0;
for (i_0 = 0; i_0 < 12; ++i_0) {
std2rl[rl2std[i_0]] = i_0;
}
const c = new Center3_0();
for (i_0 = 0; i_0 < 29400; ++i_0) {
for (m_0 = 0; m_0 < 20; ++m_0) {
$setct_0(c, i_0);
$move_1(c, m_0);
ctmove[i_0][m_0] = $getct_0(c) & 65535;
}
}
fill_0(prun_0);
prun_0[0] = 0;
depth = 0;
done = 1;
while (done !== 29400) {
for (i_0 = 0; i_0 < 29400; ++i_0) {
if (prun_0[i_0] !== depth) {
continue;
}
for (m_0 = 0; m_0 < 17; ++m_0) {
if (prun_0[ctmove[i_0][m_0]] === -1) {
prun_0[ctmove[i_0][m_0]] = depth + 1;
++done;
}
}
}
++depth;
}
}
defineSeed(155, 1, {}, Center3_0);
_.parity = 0;
var ctmove;
var pmove;
var prun_0;
var rl2std;
var std2rl;
function $copy_1(this$static, c) {
let i_0;
for (i_0 = 0; i_0 < 24; ++i_0) {
this$static.ct[i_0] = c.ct[i_0];
}
}
function $move_2(this$static, m_0) {
const key = m_0 % 3;
m_0 = ~~(m_0 / 3);
switch (m_0) {
case 0: {
swap(this$static.ct, 0, 1, 2, 3, key);
break;
}
case 1: {
swap(this$static.ct, 16, 17, 18, 19, key);
break;
}
case 2: {
swap(this$static.ct, 8, 9, 10, 11, key);
break;
}
case 3: {
swap(this$static.ct, 4, 5, 6, 7, key);
break;
}
case 4: {
swap(this$static.ct, 20, 21, 22, 23, key);
break;
}
case 5: {
swap(this$static.ct, 12, 13, 14, 15, key);
break;
}
case 6: {
swap(this$static.ct, 0, 1, 2, 3, key);
swap(this$static.ct, 8, 20, 12, 16, key);
swap(this$static.ct, 9, 21, 13, 17, key);
break;
}
case 7: {
swap(this$static.ct, 16, 17, 18, 19, key);
swap(this$static.ct, 1, 15, 5, 9, key);
swap(this$static.ct, 2, 12, 6, 10, key);
break;
}
case 8: {
swap(this$static.ct, 8, 9, 10, 11, key);
swap(this$static.ct, 2, 19, 4, 21, key);
swap(this$static.ct, 3, 16, 5, 22, key);
break;
}
case 9: {
swap(this$static.ct, 4, 5, 6, 7, key);
swap(this$static.ct, 10, 18, 14, 22, key);
swap(this$static.ct, 11, 19, 15, 23, key);
break;
}
case 10: {
swap(this$static.ct, 20, 21, 22, 23, key);
swap(this$static.ct, 0, 8, 4, 14, key);
swap(this$static.ct, 3, 11, 7, 13, key);
break;
}
case 11: {
swap(this$static.ct, 12, 13, 14, 15, key);
swap(this$static.ct, 1, 20, 7, 18, key);
swap(this$static.ct, 0, 23, 6, 17, key);
}
}
}
function CenterCube_0() {
let i_0;
this.ct = createArray(24);
for (i_0 = 0; i_0 < 24; ++i_0) {
this.ct[i_0] = ~~(i_0 / 4);
}
}
function CenterCube_1() {
let i_0;
let m_0;
let t;
CenterCube_0.call(this);
for (i_0 = 0; i_0 < 23; ++i_0) {
t = i_0 + randomUIntBelow(24 - i_0);
if (this.ct[t] !== this.ct[i_0]) {
m_0 = this.ct[i_0];
this.ct[i_0] = this.ct[t];
this.ct[t] = m_0;
}
}
}
defineSeed(156, 1, {}, CenterCube_0, CenterCube_1);
var ran$clinit_CornerCube = false;
function $clinit_CornerCube() {
if (ran$clinit_CornerCube) {
return;
}
ran$clinit_CornerCube = true;
moveCube_0 = createArray(18);
initMove_0();
}
function $$init_2(this$static) {
this$static.cp = [0, 1, 2, 3, 4, 5, 6, 7];
this$static.co = [0, 0, 0, 0, 0, 0, 0, 0];
}
function $copy_2(this$static, c) {
let i_0;
for (i_0 = 0; i_0 < 8; ++i_0) {
this$static.cp[i_0] = c.cp[i_0];
this$static.co[i_0] = c.co[i_0];
}
}
function $move_3(this$static, idx) {
!this$static.temps && (this$static.temps = new CornerCube_0());
CornMult_0(this$static, moveCube_0[idx], this$static.temps);
$copy_2(this$static, this$static.temps);
}
function $setTwist_0(this$static, idx) {
let i_0;
let twst;
twst = 0;
for (i_0 = 6; i_0 >= 0; --i_0) {
twst += this$static.co[i_0] = idx % 3;
idx = ~~(idx / 3);
}
this$static.co[7] = (15 - twst) % 3;
}
function CornMult_0(a, b, prod) {
let corn;
let ori;
let oriA;
let oriB;
for (corn = 0; corn < 8; ++corn) {
prod.cp[corn] = a.cp[b.cp[corn]];
oriA = a.co[b.cp[corn]];
oriB = b.co[corn];
ori = oriA;
ori = ori + (oriA < 3 ? oriB : 6 - oriB);
ori = ori % 3;
(oriA >= 3 ? 1 : 0) ^ (oriB >= 3 ? 1 : 0) && (ori = ori + 3);
prod.co[corn] = ori;
}
}
function CornerCube_0() {
$$init_2(this);
}
function CornerCube_1(cperm, twist) {
$$init_2(this);
set8Perm(this.cp, cperm);
$setTwist_0(this, twist);
}
function CornerCube_2() {
CornerCube_1.call(this, randomUIntBelow(40320), randomUIntBelow(2187));
}
function initMove_0() {
let a;
let p_0;
moveCube_0[0] = new CornerCube_1(15120, 0);
moveCube_0[3] = new CornerCube_1(21021, 1494);
moveCube_0[6] = new CornerCube_1(8064, 1236);
moveCube_0[9] = new CornerCube_1(9, 0);
moveCube_0[12] = new CornerCube_1(1230, 412);
moveCube_0[15] = new CornerCube_1(224, 137);
for (a = 0; a < 18; a += 3) {
for (p_0 = 0; p_0 < 2; ++p_0) {
moveCube_0[a + p_0 + 1] = new CornerCube_0();
CornMult_0(moveCube_0[a + p_0], moveCube_0[a], moveCube_0[a + p_0 + 1]);
}
}
}
defineSeed(
157,
1,
makeCastMap([Q$CornerCube]),
CornerCube_0,
CornerCube_1,
CornerCube_2
);
_.temps = null;
var moveCube_0;
var ran$clinit_Edge3 = false;
function $clinit_Edge3() {
if (ran$clinit_Edge3) {
return;
}
ran$clinit_Edge3 = true;
eprun = createArray(1937880);
sym2raw_0 = createArray(1538);
symstate = createArray(1538);
raw2sym_1 = createArray(11880);
syminv_0 = [0, 1, 6, 3, 4, 5, 2, 7];
mvrot = createArray(160, 12);
mvroto = createArray(160, 12);
factX = [
1,
1,
1,
3,
12,
60,
360,
2520,
20160,
181440,
1814400,
19958400,
239500800
];
FullEdgeMap = [0, 2, 4, 6, 1, 3, 7, 5, 8, 9, 10, 11];
}
function $circlex(this$static, a, b, c, d) {
const temp = this$static.edgeo[d];
this$static.edgeo[d] = this$static.edge[c];
this$static.edge[c] = this$static.edgeo[b];
this$static.edgeo[b] = this$static.edge[a];
this$static.edge[a] = temp;
}
function $get_2(this$static, end) {
let i_0;
let idx;
let v;
let valh;
let vall;
this$static.isStd || $std(this$static);
idx = 0;
vall = 1985229328;
valh = 47768;
for (i_0 = 0; i_0 < end; ++i_0) {
v = this$static.edge[i_0] << 2;
idx *= 12 - i_0;
if (v >= 32) {
idx += valh >> v - 32 & 15;
valh -= 4368 << v - 32;
} else {
idx += vall >> v & 15;
valh -= 4369;
vall -= 286331152 << v;
}
}
return idx;
}
function $getsym_0(this$static) {
let symcord1x;
const cord1x = $get_2(this$static, 4);
symcord1x = raw2sym_1[cord1x];
const symx = symcord1x & 7;
symcord1x >>= 3;
$rotate_0(this$static, symx);
const cord2x = $get_2(this$static, 10) % 20160;
return symcord1x * 20160 + cord2x;
}
function $move_4(this$static, i_0) {
this$static.isStd = false;
switch (i_0) {
case 0: {
circle(this$static.edge, 0, 4, 1, 5);
circle(this$static.edgeo, 0, 4, 1, 5);
break;
}
case 1: {
$swap_0(this$static.edge, 0, 4, 1, 5);
$swap_0(this$static.edgeo, 0, 4, 1, 5);
break;
}
case 2: {
circle(this$static.edge, 0, 5, 1, 4);
circle(this$static.edgeo, 0, 5, 1, 4);
break;
}
case 3: {
$swap_0(this$static.edge, 5, 10, 6, 11);
$swap_0(this$static.edgeo, 5, 10, 6, 11);
break;
}
case 4: {
circle(this$static.edge, 0, 11, 3, 8);
circle(this$static.edgeo, 0, 11, 3, 8);
break;
}
case 5: {
$swap_0(this$static.edge, 0, 11, 3, 8);
$swap_0(this$static.edgeo, 0, 11, 3, 8);
break;
}
case 6: {
circle(this$static.edge, 0, 8, 3, 11);
circle(this$static.edgeo, 0, 8, 3, 11);
break;
}
case 7: {
circle(this$static.edge, 2, 7, 3, 6);
circle(this$static.edgeo, 2, 7, 3, 6);
break;
}
case 8: {
$swap_0(this$static.edge, 2, 7, 3, 6);
$swap_0(this$static.edgeo, 2, 7, 3, 6);
break;
}
case 9: {
circle(this$static.edge, 2, 6, 3, 7);
circle(this$static.edgeo, 2, 6, 3, 7);
break;
}
case 10: {
$swap_0(this$static.edge, 4, 8, 7, 9);
$swap_0(this$static.edgeo, 4, 8, 7, 9);
break;
}
case 11: {
circle(this$static.edge, 1, 9, 2, 10);
circle(this$static.edgeo, 1, 9, 2, 10);
break;
}
case 12: {
$swap_0(this$static.edge, 1, 9, 2, 10);
$swap_0(this$static.edgeo, 1, 9, 2, 10);
break;
}
case 13: {
circle(this$static.edge, 1, 10, 2, 9);
circle(this$static.edgeo, 1, 10, 2, 9);
break;
}
case 14: {
$swap_0(this$static.edge, 0, 4, 1, 5);
$swap_0(this$static.edgeo, 0, 4, 1, 5);
circle(this$static.edge, 9, 11);
circle(this$static.edgeo, 8, 10);
break;
}
case 15: {
$swap_0(this$static.edge, 5, 10, 6, 11);
$swap_0(this$static.edgeo, 5, 10, 6, 11);
circle(this$static.edge, 1, 3);
circle(this$static.edgeo, 0, 2);
break;
}
case 16: {
$swap_0(this$static.edge, 0, 11, 3, 8);
$swap_0(this$static.edgeo, 0, 11, 3, 8);
circle(this$static.edge, 5, 7);
circle(this$static.edgeo, 4, 6);
break;
}
case 17: {
$swap_0(this$static.edge, 2, 7, 3, 6);
$swap_0(this$static.edgeo, 2, 7, 3, 6);
circle(this$static.edge, 8, 10);
circle(this$static.edgeo, 9, 11);
break;
}
case 18: {
$swap_0(this$static.edge, 4, 8, 7, 9);
$swap_0(this$static.edgeo, 4, 8, 7, 9);
circle(this$static.edge, 0, 2);
circle(this$static.edgeo, 1, 3);
break;
}
case 19: {
$swap_0(this$static.edge, 1, 9, 2, 10);
$swap_0(this$static.edgeo, 1, 9, 2, 10);
circle(this$static.edge, 4, 6);
circle(this$static.edgeo, 5, 7);
}
}
}
function $rot_1(this$static, r) {
this$static.isStd = false;
switch (r) {
case 0: {
$move_4(this$static, 14);
$move_4(this$static, 17);
break;
}
case 1: {
$circlex(this$static, 11, 5, 10, 6);
$circlex(this$static, 5, 10, 6, 11);
$circlex(this$static, 1, 2, 3, 0);
$circlex(this$static, 4, 9, 7, 8);
$circlex(this$static, 8, 4, 9, 7);
$circlex(this$static, 0, 1, 2, 3);
break;
}
case 2: {
$swapx(this$static, 4, 5);
$swapx(this$static, 5, 4);
$swapx(this$static, 11, 8);
$swapx(this$static, 8, 11);
$swapx(this$static, 7, 6);
$swapx(this$static, 6, 7);
$swapx(this$static, 9, 10);
$swapx(this$static, 10, 9);
$swapx(this$static, 1, 1);
$swapx(this$static, 0, 0);
$swapx(this$static, 3, 3);
$swapx(this$static, 2, 2);
}
}
}
function $rotate_0(this$static, r) {
while (r >= 2) {
r -= 2;
$rot_1(this$static, 1);
$rot_1(this$static, 2);
}
r !== 0 && $rot_1(this$static, 0);
}
function $set_4(this$static, idx) {
let i_0;
let p_0;
let parity;
let v;
let vall;
let valh;
vall = 1985229328;
valh = 47768;
parity = 0;
for (i_0 = 0; i_0 < 11; ++i_0) {
p_0 = factX[11 - i_0];
v = ~~(idx / p_0);
idx = idx % p_0;
parity ^= v;
v <<= 2;
if (v >= 32) {
v = v - 32;
this$static.edge[i_0] = valh >> v & 15;
const m = (1 << v) - 1;
valh = (valh & m) + (valh >> 4 & ~m);
} else {
this$static.edge[i_0] = vall >> v & 15;
const m = (1 << v) - 1;
vall = (vall & m) + (vall >>> 4 & ~m) + (valh << 28);
valh = valh >> 4;
}
}
if ((parity & 1) === 0) {
this$static.edge[11] = vall;
} else {
this$static.edge[11] = this$static.edge[10];
this$static.edge[10] = vall;
}
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.edgeo[i_0] = i_0;
}
this$static.isStd = true;
}
function $set_5(this$static, e) {
let i_0;
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.edge[i_0] = e.edge[i_0];
this$static.edgeo[i_0] = e.edgeo[i_0];
}
this$static.isStd = e.isStd;
}
function $set_6(this$static, c) {
let i_0;
let parity;
let s;
let t;
this$static.temp === null && (this$static.temp = createArray(12));
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.temp[i_0] = i_0;
this$static.edge[i_0] = c.ep[FullEdgeMap[i_0] + 12] % 12;
}
parity = 1;
for (i_0 = 0; i_0 < 12; ++i_0) {
while (this$static.edge[i_0] !== i_0) {
t = this$static.edge[i_0];
this$static.edge[i_0] = this$static.edge[t];
this$static.edge[t] = t;
s = this$static.temp[i_0];
this$static.temp[i_0] = this$static.temp[t];
this$static.temp[t] = s;
parity ^= 1;
}
}
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.edge[i_0] = this$static.temp[c.ep[FullEdgeMap[i_0]] % 12];
}
return parity;
}
function $std(this$static) {
let i_0;
this$static.temp === null && (this$static.temp = createArray(12));
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.temp[this$static.edgeo[i_0]] = i_0;
}
for (i_0 = 0; i_0 < 12; ++i_0) {
this$static.edge[i_0] = this$static.temp[this$static.edge[i_0]];
this$static.edgeo[i_0] = i_0;
}
this$static.isStd = true;
}
function $swap_0(arr, a, b, c, d) {
let temp;
temp = arr[a];
arr[a] = arr[c];
arr[c] = temp;
temp = arr[b];
arr[b] = arr[d];
arr[d] = temp;
}
function $swapx(this$static, x, y) {
const temp = this$static.edge[x];
this$static.edge[x] = this$static.edgeo[y];
this$static.edgeo[y] = temp;
}
function Edge3_0() {
this.edge = createArray(12);
this.edgeo = createArray(12);
}
function createPrun_0() {
let chk;
let cord1;
let cord1x;
let cord2;
let cord2x;
let dep1m3;
let depm3;
let depth;
let end;
let find_0;
let i_0;
let i_;
let idx;
let idxx;
let inv;
let j;
let m_0;
let symState;
let symcord1;
let symcord1x;
let symx;
let val;
const e = new Edge3_0();
const f = new Edge3_0();
const g = new Edge3_0();
fill_0(eprun);
depth = 0;
done_0 = 1;
setPruning_0(eprun, 0, 0);
while (done_0 !== 31006080) {
inv = depth > 9;
depm3 = depth % 3;
dep1m3 = (depth + 1) % 3;
find_0 = inv ? 3 : depm3;
chk = inv ? depm3 : 3;
if (depth >= 9) {
break;
}
for (i_ = 0; i_ < 31006080; i_ += 16) {
val = eprun[~~i_ >> 4];
if (!inv && val === -1) {
continue;
}
for (i_0 = i_, end = i_ + 16; i_0 < end; ++i_0, val >>= 2) {
if ((val & 3) !== find_0) {
continue;
}
symcord1 = ~~(i_0 / 20160);
cord1 = sym2raw_0[symcord1];
cord2 = i_0 % 20160;
$set_4(e, cord1 * 20160 + cord2);
for (m_0 = 0; m_0 < 17; ++m_0) {
cord1x = getmvrot(e.edge, m_0 << 3, 4);
symcord1x = raw2sym_1[cord1x];
symx = symcord1x & 7;
symcord1x >>= 3;
cord2x = getmvrot(e.edge, m_0 << 3 | symx, 10) % 20160;
idx = symcord1x * 20160 + cord2x;
if (getPruning_0(eprun, idx) !== chk) {
continue;
}
setPruning_0(eprun, inv ? i_0 : idx, dep1m3);
++done_0;
if (inv) {
break;
}
symState = symstate[symcord1x];
if (symState === 1) {
continue;
}
$set_5(f, e);
$move_4(f, m_0);
$rotate_0(f, symx);
for (j = 1; (symState = ~~symState >> 1 & 65535) !== 0; ++j) {
if ((symState & 1) !== 1) {
continue;
}
$set_5(g, f);
$rotate_0(g, j);
idxx = symcord1x * 20160 + $get_2(g, 10) % 20160;
if (getPruning_0(eprun, idxx) === chk) {
setPruning_0(eprun, idxx, dep1m3);
++done_0;
}
}
}
}
}
++depth;
}
}
function getPruning_0(table, index) {
return table[index >> 4] >> ((index & 15) << 1) & 3;
}
function getmvrot(ep, mrIdx, end) {
let i_0;
let idx;
let v;
let valh;
let vall;
const movo = mvroto[mrIdx];
const mov = mvrot[mrIdx];
idx = 0;
vall = 1985229328;
valh = 47768;
for (i_0 = 0; i_0 < end; ++i_0) {
v = movo[ep[mov[i_0]]] << 2;
idx *= 12 - i_0;
if (v >= 32) {
idx += valh >> v - 32 & 15;
valh -= 4368 << v - 32;
} else {
idx += vall >> v & 15;
valh -= 4369;
vall -= 286331152 << v;
}
}
return idx;
}
function getprun(edge) {
let cord1;
let cord1x;
let cord2;
let cord2x;
let depm3;
let depth;
let idx;
let m_0;
let symcord1;
let symcord1x;
let symx;
const e = new Edge3_0();
depth = 0;
depm3 = getPruning_0(eprun, edge);
if (depm3 === 3) {
return 10;
}
while (edge !== 0) {
depm3 === 0 ? depm3 = 2 : --depm3;
symcord1 = ~~(edge / 20160);
cord1 = sym2raw_0[symcord1];
cord2 = edge % 20160;
$set_4(e, cord1 * 20160 + cord2);
for (m_0 = 0; m_0 < 17; ++m_0) {
cord1x = getmvrot(e.edge, m_0 << 3, 4);
symcord1x = raw2sym_1[cord1x];
symx = symcord1x & 7;
symcord1x >>= 3;
cord2x = getmvrot(e.edge, m_0 << 3 | symx, 10) % 20160;
idx = symcord1x * 20160 + cord2x;
if (getPruning_0(eprun, idx) === depm3) {
++depth;
edge = idx;
break;
}
}
}
return depth;
}
function getprun_0(edge, prun) {
const depm3 = getPruning_0(eprun, edge);
if (depm3 === 3) {
return 10;
}
return (1227133513 << depm3 >> prun & 3) + prun - 1;
}
function initMvrot() {
let i_0;
let m_0;
let r;
const e = new Edge3_0();
for (m_0 = 0; m_0 < 20; ++m_0) {
for (r = 0; r < 8; ++r) {
$set_4(e, 0);
$move_4(e, m_0);
$rotate_0(e, r);
for (i_0 = 0; i_0 < 12; ++i_0) {
mvrot[m_0 << 3 | r][i_0] = e.edge[i_0];
}
$std(e);
for (i_0 = 0; i_0 < 12; ++i_0) {
mvroto[m_0 << 3 | r][i_0] = e.temp[i_0];
}
}
}
}
function initRaw2Sym() {
let count;
let i_0;
let idx;
let j;
const e = new Edge3_0();
const occ = createArray(1485);
for (i_0 = 0; i_0 < 1485; i_0++) {
occ[i_0] = 0;
}
count = 0;
for (i_0 = 0; i_0 < 11880; ++i_0) {
if ((occ[~~i_0 >>> 3] & 1 << (i_0 & 7)) === 0) {
$set_4(e, i_0 * factX[8]);
for (j = 0; j < 8; ++j) {
idx = $get_2(e, 4);
idx === i_0 && (symstate[count] = (symstate[count] | 1 << j) & 65535);
occ[~~idx >> 3] = occ[~~idx >> 3] | 1 << (idx & 7);
raw2sym_1[idx] = count << 3 | syminv_0[j];
$rot_1(e, 0);
if (j % 2 === 1) {
$rot_1(e, 1);
$rot_1(e, 2);
}
}
sym2raw_0[count++] = i_0;
}
}
}
function setPruning_0(table, index, value) {
table[index >> 4] ^= (3 ^ value) << ((index & 15) << 1);
}
defineSeed(158, 1, makeCastMap([Q$Edge3]), Edge3_0);
_.isStd = true;
_.temp = null;
var FullEdgeMap;
var done_0 = 0;
var eprun;
var factX;
var mvrot;
var mvroto;
var raw2sym_1;
var sym2raw_0;
var syminv_0;
var symstate;
var ran$clinit_EdgeCube = false;
function $clinit_EdgeCube() {
if (ran$clinit_EdgeCube) {
return;
}
ran$clinit_EdgeCube = true;
}
function $checkEdge(this$static) {
let ck;
let i_0;
let parity;
ck = 0;
parity = false;
for (i_0 = 0; i_0 < 12; ++i_0) {
ck |= 1 << this$static.ep[i_0];
parity = parity !== this$static.ep[i_0] >= 12;
}
ck &= ~~ck >> 12;
return ck === 0 && !parity;
}
function $copy_3(this$static, c) {
let i_0;
for (i_0 = 0; i_0 < 24; ++i_0) {
this$static.ep[i_0] = c.ep[i_0];
}
}
function $move_5(this$static, m_0) {
const key = m_0 % 3;
m_0 = ~~(m_0 / 3);
switch (m_0) {
case 0: {
swap(this$static.ep, 0, 1, 2, 3, key);
swap(this$static.ep, 12, 13, 14, 15, key);
break;
}
case 1: {
swap(this$static.ep, 11, 15, 10, 19, key);
swap(this$static.ep, 23, 3, 22, 7, key);
break;
}
case 2: {
swap(this$static.ep, 0, 11, 6, 8, key);
swap(this$static.ep, 12, 23, 18, 20, key);
break;
}
case 3: {
swap(this$static.ep, 4, 5, 6, 7, key);
swap(this$static.ep, 16, 17, 18, 19, key);
break;
}
case 4: {
swap(this$static.ep, 1, 20, 5, 21, key);
swap(this$static.ep, 13, 8, 17, 9, key);
break;
}
case 5: {
swap(this$static.ep, 2, 9, 4, 10, key);
swap(this$static.ep, 14, 21, 16, 22, key);
break;
}
case 6: {
swap(this$static.ep, 0, 1, 2, 3, key);
swap(this$static.ep, 12, 13, 14, 15, key);
swap(this$static.ep, 9, 22, 11, 20, key);
break;
}
case 7: {
swap(this$static.ep, 11, 15, 10, 19, key);
swap(this$static.ep, 23, 3, 22, 7, key);
swap(this$static.ep, 2, 16, 6, 12, key);
break;
}
case 8: {
swap(this$static.ep, 0, 11, 6, 8, key);
swap(this$static.ep, 12, 23, 18, 20, key);
swap(this$static.ep, 3, 19, 5, 13, key);
break;
}
case 9: {
swap(this$static.ep, 4, 5, 6, 7, key);
swap(this$static.ep, 16, 17, 18, 19, key);
swap(this$static.ep, 8, 23, 10, 21, key);
break;
}
case 10: {
swap(this$static.ep, 1, 20, 5, 21, key);
swap(this$static.ep, 13, 8, 17, 9, key);
swap(this$static.ep, 14, 0, 18, 4, key);
break;
}
case 11: {
swap(this$static.ep, 2, 9, 4, 10, key);
swap(this$static.ep, 14, 21, 16, 22, key);
swap(this$static.ep, 7, 15, 1, 17, key);
}
}
}
function EdgeCube_0() {
let i_0;
this.ep = createArray(24);
for (i_0 = 0; i_0 < 24; ++i_0) {
this.ep[i_0] = i_0;
}
}
function EdgeCube_1() {
let i_0;
let m_0;
let t;
EdgeCube_0.call(this);
for (i_0 = 0; i_0 < 23; ++i_0) {
t = i_0 + randomUIntBelow(24 - i_0);
if (t !== i_0) {
m_0 = this.ep[i_0];
this.ep[i_0] = this.ep[t];
this.ep[t] = m_0;
}
}
}
defineSeed(159, 1, {}, EdgeCube_0, EdgeCube_1);
var ran$clinit_FullCube_0 = false;
function $clinit_FullCube_0() {
if (ran$clinit_FullCube_0) {
return;
}
ran$clinit_FullCube_0 = true;
move2rot = [35, 1, 34, 2, 4, 6, 22, 5, 19];
}
function $$init_3(this$static) {
this$static.moveBuffer = createArray(60);
}
function $compareTo_1(this$static, c) {
return this$static.value - c.value;
}
function $copy_4(this$static, c) {
let i_0;
$copy_3(this$static.edge, c.edge);
$copy_1(this$static.center, c.center);
$copy_2(this$static.corner, c.corner);
this$static.value = c.value;
this$static.add1 = c.add1;
this$static.length1 = c.length1;
this$static.length2 = c.length2;
this$static.length3 = c.length3;
this$static.sym = c.sym;
for (i_0 = 0; i_0 < 60; ++i_0) {
this$static.moveBuffer[i_0] = c.moveBuffer[i_0];
}
this$static.moveLength = c.moveLength;
this$static.edgeAvail = c.edgeAvail;
this$static.centerAvail = c.centerAvail;
this$static.cornerAvail = c.cornerAvail;
}
function $getCenter(this$static) {
while (this$static.centerAvail < this$static.moveLength) {
$move_2(
this$static.center,
this$static.moveBuffer[this$static.centerAvail++]
);
}
return this$static.center;
}
function $getCorner(this$static) {
while (this$static.cornerAvail < this$static.moveLength) {
$move_3(
this$static.corner,
this$static.moveBuffer[this$static.cornerAvail++] % 18
);
}
return this$static.corner;
}
function $getEdge(this$static) {
while (this$static.edgeAvail < this$static.moveLength) {
$move_5(this$static.edge, this$static.moveBuffer[this$static.edgeAvail++]);
}
return this$static.edge;
}
function $getMoveString(this$static) {
let i_0;
let idx;
let move;
let rot;
let sb;
let sym;
const fixedMoves = new Array(
this$static.moveLength - (this$static.add1 ? 2 : 0)
);
idx = 0;
for (i_0 = 0; i_0 < this$static.length1; ++i_0) {
fixedMoves[idx++] = this$static.moveBuffer[i_0];
}
sym = this$static.sym;
for (i_0 = this$static.length1 + (this$static.add1 ? 2 : 0); i_0 < this$static.moveLength; ++i_0) {
if (symmove[sym][this$static.moveBuffer[i_0]] >= 27) {
fixedMoves[idx++] = symmove[sym][this$static.moveBuffer[i_0]] - 9;
rot = move2rot[symmove[sym][this$static.moveBuffer[i_0]] - 27];
sym = symmult[sym][rot];
} else {
fixedMoves[idx++] = symmove[sym][this$static.moveBuffer[i_0]];
}
}
const finishSym = symmult[syminv[sym]][getSolvedSym($getCenter(this$static))];
sb = "";
sym = finishSym;
for (i_0 = idx - 1; i_0 >= 0; --i_0) {
move = fixedMoves[i_0];
move = ~~(move / 3) * 3 + (2 - move % 3);
if (symmove[sym][move] >= 27) {
sb = `${sb}${move2str_1[symmove[sym][move] - 9]} `;
rot = move2rot[symmove[sym][move] - 27];
sym = symmult[sym][rot];
} else {
sb = `${sb}${move2str_1[symmove[sym][move]]} `;
}
}
return sb;
}
function $move_6(this$static, m_0) {
this$static.moveBuffer[this$static.moveLength++] = m_0;
return;
}
function FullCube_3() {
$$init_3(this);
this.edge = new EdgeCube_0();
this.center = new CenterCube_0();
this.corner = new CornerCube_0();
}
function FullCube_4(c) {
FullCube_3.call(this);
$copy_4(this, c);
}
function FullCube_5() {
$$init_3(this);
this.edge = new EdgeCube_1();
this.center = new CenterCube_1();
this.corner = new CornerCube_2();
}
defineSeed(
160,
1,
makeCastMap([Q$FullCube_0, Q$Comparable]),
FullCube_3,
FullCube_4,
FullCube_5
);
_.compareTo$ = function compareTo_1(c) {
return $compareTo_1(this, c);
};
_.add1 = false;
_.center = null;
_.centerAvail = 0;
_.corner = null;
_.cornerAvail = 0;
_.edge = null;
_.edgeAvail = 0;
_.length1 = 0;
_.length2 = 0;
_.length3 = 0;
_.moveLength = 0;
_.sym = 0;
_.value = 0;
var move2rot;
function $compare(c1, c2) {
return c2.value - c1.value;
}
function $compare_0(c1, c2) {
return $compare(c1, c2);
}
function FullCube$ValueComparator_0() {
}
defineSeed(161, 1, {}, FullCube$ValueComparator_0);
_.compare = function compare(c1, c2) {
return $compare_0(c1, c2);
};
var ran$clinit_Moves = false;
function $clinit_Moves() {
if (ran$clinit_Moves) {
return;
}
ran$clinit_Moves = true;
let i_0;
let j;
move2str_1 = [
"U ",
"U2 ",
"U' ",
"R ",
"R2 ",
"R' ",
"F ",
"F2 ",
"F' ",
"D ",
"D2 ",
"D' ",
"L ",
"L2 ",
"L' ",
"B ",
"B2 ",
"B' ",
"Uw ",
"Uw2",
"Uw'",
"Rw ",
"Rw2",
"Rw'",
"Fw ",
"Fw2",
"Fw'",
"Dw ",
"Dw2",
"Dw'",
"Lw ",
"Lw2",
"Lw'",
"Bw ",
"Bw2",
"Bw'"
];
move2std = [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,