cubing 0.57.4 → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/cubing/{PuzzleLoader-B7Ly-OAs.d.ts → PuzzleLoader-BskBhUgu.d.ts} +11 -1
- package/dist/lib/cubing/alg/index.d.ts +2 -2
- package/dist/lib/cubing/alg/index.js +1 -1
- package/dist/lib/cubing/bluetooth/index.d.ts +3 -3
- package/dist/lib/cubing/bluetooth/index.js +701 -58
- package/dist/lib/cubing/bluetooth/index.js.map +4 -4
- package/dist/lib/cubing/{bluetooth-puzzle-nh-dCXPL.d.ts → bluetooth-puzzle-BIDZuWiS.d.ts} +1 -1
- package/dist/lib/cubing/chunks/{big-puzzle-orientation-SKZG73EB.js → big-puzzle-orientation-CQUVRARW.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-SWKNZGJF.js → chunk-3MMNI5O2.js} +7 -1
- package/dist/lib/cubing/chunks/chunk-3MMNI5O2.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-3U3UEVVD.js → chunk-53UENZ7A.js} +3 -3
- package/dist/lib/cubing/chunks/{chunk-GKM2CK6T.js → chunk-7M7ZAS5G.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-7HQOMRBY.js → chunk-BVZN7IXO.js} +3 -3
- package/dist/lib/cubing/chunks/{chunk-3YVVF3KK.js → chunk-CZGLT7LF.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-H75BKRPQ.js → chunk-LII4MJEB.js} +5 -5
- package/dist/lib/cubing/chunks/{chunk-NJFJ3OMF.js → chunk-SR66SYE2.js} +2 -2
- package/dist/lib/cubing/chunks/chunk-SR66SYE2.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-2H2XY6KQ.js → chunk-WI3YFILD.js} +48 -298
- package/dist/lib/cubing/chunks/chunk-WI3YFILD.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-F7UESNJD.js → chunk-YICS6Q2F.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-666TWRT6.js → chunk-Z4CZPP2W.js} +461 -69
- package/dist/lib/cubing/chunks/chunk-Z4CZPP2W.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-7CZZRWBJ.js → chunk-ZVLDZYZD.js} +3 -3
- package/dist/lib/cubing/chunks/{inside-AYMLD6IQ.js → inside-ICFSQUAC.js} +14 -14
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-T4N6YHT7.js → search-dynamic-sgs-side-events-5AC7RH72.js} +6 -6
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-EQIJODP7.js → search-dynamic-sgs-unofficial-INRHQCBE.js} +6 -6
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-NT5XKSLV.js → search-dynamic-solve-4x4x4-VNSEVV7B.js} +7 -7
- package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-NKAFVO65.js → search-dynamic-solve-fto-BHX3R6ZT.js} +2 -2
- package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-EDGE5SP4.js → search-dynamic-solve-kilominx-SAJCQILQ.js} +2 -2
- package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-FRZJG7S6.js → twisty-dynamic-3d-CCZCZBPC.js} +7 -8
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-FRZJG7S6.js.map → twisty-dynamic-3d-CCZCZBPC.js.map} +1 -1
- package/dist/lib/cubing/chunks/{twsearch-WDBATGZX.js → twsearch-T3W5T5WE.js} +4 -4
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-Q5AYUFKA-AHAAY6HU.js +10 -0
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-Q5AYUFKA-AHAAY6HU.js.map +7 -0
- package/dist/lib/cubing/{index-BOJwUPsI.d.ts → index-1uDGfzzz.d.ts} +1 -1
- package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
- package/dist/lib/cubing/kpuzzle/index.js +2 -2
- package/dist/lib/cubing/notation/index.d.ts +1 -1
- package/dist/lib/cubing/notation/index.js +4 -4
- package/dist/lib/cubing/protocol/index.d.ts +1 -1
- package/dist/lib/cubing/protocol/index.js +4 -4
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -2
- package/dist/lib/cubing/puzzle-geometry/index.js +1 -1
- package/dist/lib/cubing/puzzles/index.d.ts +2 -1
- package/dist/lib/cubing/puzzles/index.js +6 -5
- package/dist/lib/cubing/scramble/index.d.ts +2 -2
- package/dist/lib/cubing/scramble/index.js +6 -6
- package/dist/lib/cubing/search/index.d.ts +2 -2
- package/dist/lib/cubing/search/index.js +6 -6
- package/dist/lib/cubing/stream/index.d.ts +2 -2
- package/dist/lib/cubing/stream/index.js +1 -1
- package/dist/lib/cubing/twisty/index.d.ts +2 -2
- package/dist/lib/cubing/twisty/index.js +7 -7
- package/package.json +4 -3
- package/dist/lib/cubing/chunks/chunk-2H2XY6KQ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-666TWRT6.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-NJFJ3OMF.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-SWKNZGJF.js.map +0 -7
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-WOVCK52S-RP4VI7OV.js +0 -10
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-WOVCK52S-RP4VI7OV.js.map +0 -7
- /package/dist/lib/cubing/chunks/{big-puzzle-orientation-SKZG73EB.js.map → big-puzzle-orientation-CQUVRARW.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-3U3UEVVD.js.map → chunk-53UENZ7A.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-GKM2CK6T.js.map → chunk-7M7ZAS5G.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-7HQOMRBY.js.map → chunk-BVZN7IXO.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-3YVVF3KK.js.map → chunk-CZGLT7LF.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-H75BKRPQ.js.map → chunk-LII4MJEB.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-F7UESNJD.js.map → chunk-YICS6Q2F.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{chunk-7CZZRWBJ.js.map → chunk-ZVLDZYZD.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{inside-AYMLD6IQ.js.map → inside-ICFSQUAC.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-T4N6YHT7.js.map → search-dynamic-sgs-side-events-5AC7RH72.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-EQIJODP7.js.map → search-dynamic-sgs-unofficial-INRHQCBE.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-NT5XKSLV.js.map → search-dynamic-solve-4x4x4-VNSEVV7B.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-NKAFVO65.js.map → search-dynamic-solve-fto-BHX3R6ZT.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-EDGE5SP4.js.map → search-dynamic-solve-kilominx-SAJCQILQ.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{twsearch-WDBATGZX.js.map → twsearch-T3W5T5WE.js.map} +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KPattern,
|
|
3
3
|
KPuzzle
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CZGLT7LF.js";
|
|
5
5
|
import {
|
|
6
6
|
Alg,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Commutator,
|
|
8
|
+
Conjugate,
|
|
9
|
+
Move,
|
|
10
|
+
Pause,
|
|
11
|
+
QuantumMove,
|
|
12
|
+
TraversalDownUp,
|
|
13
|
+
functionFromTraversal
|
|
14
|
+
} from "./chunk-3MMNI5O2.js";
|
|
9
15
|
|
|
10
16
|
// src/cubing/vendor/mit/p-lazy/p-lazy.ts
|
|
11
17
|
var PLazy = class _PLazy extends Promise {
|
|
@@ -851,6 +857,7 @@ var CubePGPuzzleLoader = class extends PGPuzzleLoader {
|
|
|
851
857
|
return cubeLikeStickeringMask(this, stickering);
|
|
852
858
|
}
|
|
853
859
|
stickerings = () => cubeLikeStickeringList(this.id, { use3x3x3Fallbacks: true });
|
|
860
|
+
algTransformData = cubeMirrorTransforms;
|
|
854
861
|
};
|
|
855
862
|
function puzzleSpecificSimplifyOptionsPromise(kpuzzlePromiseFn) {
|
|
856
863
|
return new PLazy(
|
|
@@ -1164,6 +1171,67 @@ var cube3x3x3KPuzzleDefinition = {
|
|
|
1164
1171
|
}
|
|
1165
1172
|
};
|
|
1166
1173
|
|
|
1174
|
+
// src/cubing/puzzles/implementations/dynamic/3x3x3/puzzle-orientation.ts
|
|
1175
|
+
function puzzleOrientation3x3x3Idx(pattern) {
|
|
1176
|
+
const idxU = pattern.patternData["CENTERS"].pieces[0];
|
|
1177
|
+
const idxD = pattern.patternData["CENTERS"].pieces[5];
|
|
1178
|
+
const unadjustedIdxL = pattern.patternData["CENTERS"].pieces[1];
|
|
1179
|
+
let idxL = unadjustedIdxL;
|
|
1180
|
+
if (idxU < unadjustedIdxL) {
|
|
1181
|
+
idxL--;
|
|
1182
|
+
}
|
|
1183
|
+
if (idxD < unadjustedIdxL) {
|
|
1184
|
+
idxL--;
|
|
1185
|
+
}
|
|
1186
|
+
return [idxU, idxL];
|
|
1187
|
+
}
|
|
1188
|
+
var puzzleOrientationCacheRaw = new Array(6).fill(0).map(() => {
|
|
1189
|
+
return new Array(6);
|
|
1190
|
+
});
|
|
1191
|
+
var puzzleOrientationCacheInitialized = false;
|
|
1192
|
+
function puzzleOrientation3x3x3Cache() {
|
|
1193
|
+
if (!puzzleOrientationCacheInitialized) {
|
|
1194
|
+
{
|
|
1195
|
+
const uAlgs = ["", "z", "x", "z'", "x'", "x2"].map(
|
|
1196
|
+
(s) => Alg.fromString(s)
|
|
1197
|
+
);
|
|
1198
|
+
const yAlg = new Alg("y");
|
|
1199
|
+
for (const uAlg of uAlgs) {
|
|
1200
|
+
let transformation = experimental3x3x3KPuzzle.algToTransformation(uAlg);
|
|
1201
|
+
for (let i = 0; i < 4; i++) {
|
|
1202
|
+
transformation = transformation.applyAlg(yAlg);
|
|
1203
|
+
const [idxU, idxL] = puzzleOrientation3x3x3Idx(
|
|
1204
|
+
transformation.toKPattern()
|
|
1205
|
+
);
|
|
1206
|
+
puzzleOrientationCacheRaw[idxU][idxL] = transformation.invert();
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
return puzzleOrientationCacheRaw;
|
|
1212
|
+
}
|
|
1213
|
+
function normalize3x3x3Orientation(pattern) {
|
|
1214
|
+
const [idxU, idxL] = puzzleOrientation3x3x3Idx(pattern);
|
|
1215
|
+
const orientationTransformation = puzzleOrientation3x3x3Cache()[idxU][idxL];
|
|
1216
|
+
return pattern.applyTransformation(orientationTransformation);
|
|
1217
|
+
}
|
|
1218
|
+
function experimentalIs3x3x3Solved(pattern, options) {
|
|
1219
|
+
if (options.ignorePuzzleOrientation) {
|
|
1220
|
+
pattern = normalize3x3x3Orientation(pattern);
|
|
1221
|
+
}
|
|
1222
|
+
if (options.ignoreCenterOrientation) {
|
|
1223
|
+
pattern = new KPattern(pattern.kpuzzle, {
|
|
1224
|
+
EDGES: pattern.patternData["EDGES"],
|
|
1225
|
+
CORNERS: pattern.patternData["CORNERS"],
|
|
1226
|
+
CENTERS: {
|
|
1227
|
+
pieces: pattern.patternData["CENTERS"].pieces,
|
|
1228
|
+
orientation: new Array(6).fill(0)
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
return !!pattern.experimentalToTransformation()?.isIdentityTransformation();
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1167
1235
|
// src/cubing/puzzles/PuzzleLoader.ts
|
|
1168
1236
|
async function getPartialAppendOptionsForPuzzleSpecificSimplifyOptions(puzzleLoader) {
|
|
1169
1237
|
const puzzleSpecificSimplifyOptions = await (puzzleLoader.puzzleSpecificSimplifyOptions ?? puzzleLoader.puzzleSpecificSimplifyOptionsPromise);
|
|
@@ -1173,6 +1241,57 @@ async function getPartialAppendOptionsForPuzzleSpecificSimplifyOptions(puzzleLoa
|
|
|
1173
1241
|
return { puzzleLoader: { puzzleSpecificSimplifyOptions } };
|
|
1174
1242
|
}
|
|
1175
1243
|
|
|
1244
|
+
// src/cubing/puzzles/transformAlg.ts
|
|
1245
|
+
var TransformAlg = class extends TraversalDownUp {
|
|
1246
|
+
traverseAlg(alg, dataDown) {
|
|
1247
|
+
const algNodes = [];
|
|
1248
|
+
for (const algNode of alg.childAlgNodes()) {
|
|
1249
|
+
algNodes.push(this.traverseAlgNode(algNode, dataDown));
|
|
1250
|
+
}
|
|
1251
|
+
return new Alg(algNodes);
|
|
1252
|
+
}
|
|
1253
|
+
traverseGrouping(grouping, dataDown) {
|
|
1254
|
+
return grouping.modified({ alg: this.traverseAlg(grouping.alg, dataDown) });
|
|
1255
|
+
}
|
|
1256
|
+
traverseMove(move, dataDown) {
|
|
1257
|
+
const invert = (() => {
|
|
1258
|
+
const { invertExceptByFamily } = dataDown;
|
|
1259
|
+
if (!invertExceptByFamily) {
|
|
1260
|
+
return false;
|
|
1261
|
+
}
|
|
1262
|
+
return !invertExceptByFamily.has(move.family);
|
|
1263
|
+
})();
|
|
1264
|
+
return move.modified({
|
|
1265
|
+
amount: invert ? -move.amount : move.amount,
|
|
1266
|
+
family: dataDown.replaceMovesByFamily[move.family] ?? move.family
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
traverseCommutator(commutator, dataDown) {
|
|
1270
|
+
return new Commutator(
|
|
1271
|
+
this.traverseAlg(commutator.A, dataDown),
|
|
1272
|
+
this.traverseAlg(commutator.B, dataDown)
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
traverseConjugate(conjugate, dataDown) {
|
|
1276
|
+
return new Conjugate(
|
|
1277
|
+
this.traverseAlg(conjugate.A, dataDown),
|
|
1278
|
+
this.traverseAlg(conjugate.B, dataDown)
|
|
1279
|
+
);
|
|
1280
|
+
}
|
|
1281
|
+
// TODO: Remove spaces between repeated pauses (in traverseSequence)
|
|
1282
|
+
traversePause(pause, _dataDown) {
|
|
1283
|
+
return pause;
|
|
1284
|
+
}
|
|
1285
|
+
traverseNewline(newLine, _dataDown) {
|
|
1286
|
+
return newLine;
|
|
1287
|
+
}
|
|
1288
|
+
// TODO: Enforce being followed by a newline (or the end of the alg)?
|
|
1289
|
+
traverseLineComment(comment, _dataDown) {
|
|
1290
|
+
return comment;
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
var transformAlg = functionFromTraversal(TransformAlg);
|
|
1294
|
+
|
|
1176
1295
|
// src/cubing/puzzles/customPGPuzzleLoader.ts
|
|
1177
1296
|
async function descAsyncGetPuzzleGeometry(desc, options) {
|
|
1178
1297
|
const puzzleGeometry = await import("../puzzle-geometry/index.js");
|
|
@@ -1229,10 +1348,10 @@ function puzzleOrientation2x2x2Idx(pattern) {
|
|
|
1229
1348
|
const inverseDFL = inverse.transformationData["CORNERS"];
|
|
1230
1349
|
return inverseDFL.permutation[6] * 3 + inverseDFL.orientationDelta[6];
|
|
1231
1350
|
}
|
|
1232
|
-
var
|
|
1233
|
-
var
|
|
1351
|
+
var puzzleOrientationCacheRaw2 = new Array(24);
|
|
1352
|
+
var puzzleOrientationCacheInitialized2 = false;
|
|
1234
1353
|
function puzzleOrientation2x2x2Cache(kpuzzle) {
|
|
1235
|
-
if (!
|
|
1354
|
+
if (!puzzleOrientationCacheInitialized2) {
|
|
1236
1355
|
{
|
|
1237
1356
|
const uAlgs = ["", "z", "x", "z'", "x'", "x2"].map(
|
|
1238
1357
|
(s) => Alg.fromString(s)
|
|
@@ -1243,7 +1362,7 @@ function puzzleOrientation2x2x2Cache(kpuzzle) {
|
|
|
1243
1362
|
for (let i = 0; i < 4; i++) {
|
|
1244
1363
|
transformation = transformation.applyAlg(yAlg);
|
|
1245
1364
|
const idx = puzzleOrientation2x2x2Idx(transformation.toKPattern());
|
|
1246
|
-
|
|
1365
|
+
puzzleOrientationCacheRaw2[idx] = {
|
|
1247
1366
|
transformation: transformation.invert(),
|
|
1248
1367
|
alg: uAlg.concat(yAlg)
|
|
1249
1368
|
};
|
|
@@ -1251,7 +1370,7 @@ function puzzleOrientation2x2x2Cache(kpuzzle) {
|
|
|
1251
1370
|
}
|
|
1252
1371
|
}
|
|
1253
1372
|
}
|
|
1254
|
-
return
|
|
1373
|
+
return puzzleOrientationCacheRaw2;
|
|
1255
1374
|
}
|
|
1256
1375
|
function normalize2x2x2Orientation(pattern) {
|
|
1257
1376
|
const idx = puzzleOrientation2x2x2Idx(pattern);
|
|
@@ -1274,82 +1393,343 @@ var experimental3x3x3KPuzzle = new KPuzzle(
|
|
|
1274
1393
|
);
|
|
1275
1394
|
cube3x3x3KPuzzleDefinition.experimentalIsPatternSolved = experimentalIs3x3x3Solved;
|
|
1276
1395
|
var bigCubePuzzleOrientation = getCached(
|
|
1277
|
-
() => import("./big-puzzle-orientation-
|
|
1396
|
+
() => import("./big-puzzle-orientation-CQUVRARW.js")
|
|
1278
1397
|
);
|
|
1279
1398
|
|
|
1280
|
-
// src/cubing/puzzles/implementations/
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1399
|
+
// src/cubing/puzzles/implementations/3x3x3/cube3x3x3KeyMapping.ts
|
|
1400
|
+
var cube3x3x3KeyMapping = {
|
|
1401
|
+
KeyI: new Move("R"),
|
|
1402
|
+
KeyK: new Move("R'"),
|
|
1403
|
+
KeyW: new Move("B"),
|
|
1404
|
+
KeyO: new Move("B'"),
|
|
1405
|
+
KeyS: new Move("D"),
|
|
1406
|
+
KeyL: new Move("D'"),
|
|
1407
|
+
KeyD: new Move("L"),
|
|
1408
|
+
KeyE: new Move("L'"),
|
|
1409
|
+
KeyJ: new Move("U"),
|
|
1410
|
+
KeyF: new Move("U'"),
|
|
1411
|
+
KeyH: new Move("F"),
|
|
1412
|
+
KeyG: new Move("F'"),
|
|
1413
|
+
KeyC: new Move("l"),
|
|
1414
|
+
KeyR: new Move("l'"),
|
|
1415
|
+
KeyU: new Move("r"),
|
|
1416
|
+
KeyM: new Move("r'"),
|
|
1417
|
+
KeyX: new Move("d"),
|
|
1418
|
+
Comma: new Move("d'"),
|
|
1419
|
+
KeyT: new Move("x"),
|
|
1420
|
+
KeyY: new Move("x"),
|
|
1421
|
+
KeyV: new Move("x'"),
|
|
1422
|
+
KeyN: new Move("x'"),
|
|
1423
|
+
Semicolon: new Move("y"),
|
|
1424
|
+
KeyA: new Move("y'"),
|
|
1425
|
+
KeyP: new Move("z"),
|
|
1426
|
+
KeyQ: new Move("z'"),
|
|
1427
|
+
KeyZ: new Move("M'"),
|
|
1428
|
+
KeyB: new Move("M"),
|
|
1429
|
+
Period: new Move("M'"),
|
|
1430
|
+
Backquote: new Pause()
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
// src/cubing/puzzles/implementations/3x3x3/puzzle-specific-simplifications.ts
|
|
1434
|
+
function makeSourceInfo(moveStrings, type, from2, to) {
|
|
1435
|
+
const output = [];
|
|
1436
|
+
for (const moveString of moveStrings) {
|
|
1437
|
+
const move = Move.fromString(moveString);
|
|
1438
|
+
const { family, amount: direction } = move;
|
|
1439
|
+
if (![-1, 1].includes(direction)) {
|
|
1440
|
+
throw new Error("Invalid config move");
|
|
1441
|
+
}
|
|
1442
|
+
output.push({ family, direction, type, from: from2, to });
|
|
1288
1443
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1444
|
+
return output;
|
|
1445
|
+
}
|
|
1446
|
+
var axisInfos = {
|
|
1447
|
+
["x axis" /* X */]: {
|
|
1448
|
+
sliceDiameter: 3,
|
|
1449
|
+
extendsThroughEntirePuzzle: true,
|
|
1450
|
+
moveSourceInfos: [
|
|
1451
|
+
...makeSourceInfo(["R"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
|
|
1452
|
+
...makeSourceInfo(["L'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
|
|
1453
|
+
...makeSourceInfo(["r", "Rw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 2),
|
|
1454
|
+
...makeSourceInfo(["l'", "Lw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 2),
|
|
1455
|
+
...makeSourceInfo(["M'"], 4 /* SPECIFIC_SLICE */, 1, 2),
|
|
1456
|
+
// TODO: remove some indices?
|
|
1457
|
+
...makeSourceInfo(["x", "Uv", "Dv'"], 5 /* ROTATION */, 0, 3)
|
|
1458
|
+
// TODO: remove some indices?
|
|
1459
|
+
]
|
|
1460
|
+
},
|
|
1461
|
+
["y axis" /* Y */]: {
|
|
1462
|
+
sliceDiameter: 3,
|
|
1463
|
+
extendsThroughEntirePuzzle: true,
|
|
1464
|
+
moveSourceInfos: [
|
|
1465
|
+
...makeSourceInfo(["U"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
|
|
1466
|
+
...makeSourceInfo(["D'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
|
|
1467
|
+
...makeSourceInfo(["u", "Uw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 2),
|
|
1468
|
+
...makeSourceInfo(["d'", "Dw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 2),
|
|
1469
|
+
...makeSourceInfo(["E'"], 4 /* SPECIFIC_SLICE */, 1, 2),
|
|
1470
|
+
// TODO: remove some indices?
|
|
1471
|
+
...makeSourceInfo(["y", "Uv", "Dv'"], 5 /* ROTATION */, 0, 3)
|
|
1472
|
+
// TODO: remove some indices?
|
|
1473
|
+
]
|
|
1474
|
+
},
|
|
1475
|
+
["z axis" /* Z */]: {
|
|
1476
|
+
sliceDiameter: 3,
|
|
1477
|
+
extendsThroughEntirePuzzle: true,
|
|
1478
|
+
moveSourceInfos: [
|
|
1479
|
+
...makeSourceInfo(["F"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
|
|
1480
|
+
...makeSourceInfo(["B'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
|
|
1481
|
+
...makeSourceInfo(["f", "Fw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 3),
|
|
1482
|
+
...makeSourceInfo(["b'", "Bw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 3),
|
|
1483
|
+
...makeSourceInfo(["S"], 4 /* SPECIFIC_SLICE */, 1, 2),
|
|
1484
|
+
// TODO: remove some indices?
|
|
1485
|
+
...makeSourceInfo(["z", "Fv", "Bv'"], 5 /* ROTATION */, 0, 3)
|
|
1486
|
+
// TODO: remove some indices?
|
|
1487
|
+
]
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
var byFamily = {};
|
|
1491
|
+
for (const [axis, info] of Object.entries(axisInfos)) {
|
|
1492
|
+
for (const moveSourceInfo of info.moveSourceInfos) {
|
|
1493
|
+
byFamily[moveSourceInfo.family] = { axis, moveSourceInfo };
|
|
1291
1494
|
}
|
|
1292
|
-
return [idxU, idxL];
|
|
1293
1495
|
}
|
|
1294
|
-
var
|
|
1295
|
-
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
const [idxU, idxL] = puzzleOrientation3x3x3Idx(
|
|
1310
|
-
transformation.toKPattern()
|
|
1311
|
-
);
|
|
1312
|
-
puzzleOrientationCacheRaw2[idxU][idxL] = transformation.invert();
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1496
|
+
var byAxisThenType = {};
|
|
1497
|
+
for (const axis of Object.keys(axisInfos)) {
|
|
1498
|
+
const entry = {};
|
|
1499
|
+
byAxisThenType[axis] = entry;
|
|
1500
|
+
for (const moveSourceInfo of axisInfos[axis].moveSourceInfos) {
|
|
1501
|
+
(entry[moveSourceInfo.type] ??= []).push(moveSourceInfo);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
var byAxisThenSpecificSlices = {};
|
|
1505
|
+
for (const axis of Object.keys(axisInfos)) {
|
|
1506
|
+
const entry = /* @__PURE__ */ new Map();
|
|
1507
|
+
byAxisThenSpecificSlices[axis] = entry;
|
|
1508
|
+
for (const moveSourceInfo of axisInfos[axis].moveSourceInfos) {
|
|
1509
|
+
if (!entry.get(moveSourceInfo.from)) {
|
|
1510
|
+
entry.set(moveSourceInfo.from, moveSourceInfo);
|
|
1315
1511
|
}
|
|
1316
1512
|
}
|
|
1317
|
-
return puzzleOrientationCacheRaw2;
|
|
1318
1513
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1514
|
+
function firstOfType(axis, moveSourceType) {
|
|
1515
|
+
const entry = byAxisThenType[axis][moveSourceType]?.[0];
|
|
1516
|
+
if (!entry) {
|
|
1517
|
+
throw new Error(
|
|
1518
|
+
`Could not find a reference move (axis: ${axis}, move source type: ${moveSourceType})`
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1521
|
+
return entry;
|
|
1323
1522
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1523
|
+
var areQuantumMovesSameAxis = (quantumMove1, quantumMove2) => {
|
|
1524
|
+
return byFamily[quantumMove1.family].axis === byFamily[quantumMove2.family].axis;
|
|
1525
|
+
};
|
|
1526
|
+
function simplestMove(axis, from2, to, directedAmount) {
|
|
1527
|
+
if (from2 + 1 === to) {
|
|
1528
|
+
const sliceSpecificInfo = byAxisThenSpecificSlices[axis].get(from2);
|
|
1529
|
+
if (sliceSpecificInfo) {
|
|
1530
|
+
return new Move(
|
|
1531
|
+
new QuantumMove(sliceSpecificInfo.family),
|
|
1532
|
+
directedAmount * sliceSpecificInfo.direction
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1327
1535
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1536
|
+
const axisInfo = axisInfos[axis];
|
|
1537
|
+
const { sliceDiameter } = axisInfo;
|
|
1538
|
+
if (from2 === 0 && to === sliceDiameter) {
|
|
1539
|
+
const moveSourceInfo2 = firstOfType(axis, 5 /* ROTATION */);
|
|
1540
|
+
return new Move(
|
|
1541
|
+
new QuantumMove(moveSourceInfo2.family),
|
|
1542
|
+
directedAmount * moveSourceInfo2.direction
|
|
1543
|
+
);
|
|
1544
|
+
}
|
|
1545
|
+
const far = from2 + to > sliceDiameter;
|
|
1546
|
+
if (far) {
|
|
1547
|
+
[from2, to] = [sliceDiameter - to, sliceDiameter - from2];
|
|
1548
|
+
}
|
|
1549
|
+
let outerLayer = from2 + 1;
|
|
1550
|
+
let innerLayer = to;
|
|
1551
|
+
const slice = outerLayer === innerLayer;
|
|
1552
|
+
if (slice) {
|
|
1553
|
+
innerLayer = null;
|
|
1554
|
+
}
|
|
1555
|
+
if (outerLayer === 1) {
|
|
1556
|
+
outerLayer = null;
|
|
1557
|
+
}
|
|
1558
|
+
if (slice && outerLayer === 1) {
|
|
1559
|
+
innerLayer = null;
|
|
1560
|
+
}
|
|
1561
|
+
if (!slice && innerLayer === 2) {
|
|
1562
|
+
innerLayer = null;
|
|
1563
|
+
}
|
|
1564
|
+
const moveSourceType = slice ? far ? 1 /* INDEXABLE_SLICE_FAR */ : 0 /* INDEXABLE_SLICE_NEAR */ : far ? 3 /* INDEXABLE_WIDE_FAR */ : 2 /* INDEXABLE_WIDE_NEAR */;
|
|
1565
|
+
const moveSourceInfo = firstOfType(axis, moveSourceType);
|
|
1566
|
+
return new Move(
|
|
1567
|
+
new QuantumMove(moveSourceInfo.family, innerLayer, outerLayer),
|
|
1568
|
+
directedAmount * moveSourceInfo.direction
|
|
1569
|
+
);
|
|
1570
|
+
}
|
|
1571
|
+
function simplifySameAxisMoves(moves, quantumMod = true) {
|
|
1572
|
+
if (moves.length === 0) {
|
|
1573
|
+
return [];
|
|
1574
|
+
}
|
|
1575
|
+
const axis = byFamily[moves[0].family].axis;
|
|
1576
|
+
const axisInfo = axisInfos[axis];
|
|
1577
|
+
const { sliceDiameter } = axisInfo;
|
|
1578
|
+
const sliceDeltas = /* @__PURE__ */ new Map();
|
|
1579
|
+
let lastCandidateRange = null;
|
|
1580
|
+
function adjustValue(idx, relativeDelta) {
|
|
1581
|
+
let newDelta = (sliceDeltas.get(idx) ?? 0) + relativeDelta;
|
|
1582
|
+
if (quantumMod) {
|
|
1583
|
+
newDelta = newDelta % 4 + 5 % 4 - 1;
|
|
1584
|
+
}
|
|
1585
|
+
if (newDelta === 0) {
|
|
1586
|
+
sliceDeltas.delete(idx);
|
|
1587
|
+
} else {
|
|
1588
|
+
sliceDeltas.set(idx, newDelta);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
let suffixLength = 0;
|
|
1592
|
+
for (const move of Array.from(moves).reverse()) {
|
|
1593
|
+
suffixLength++;
|
|
1594
|
+
const { moveSourceInfo } = byFamily[move.family];
|
|
1595
|
+
const directedAmount2 = move.amount * moveSourceInfo.direction;
|
|
1596
|
+
switch (moveSourceInfo.type) {
|
|
1597
|
+
case 0 /* INDEXABLE_SLICE_NEAR */: {
|
|
1598
|
+
const idx = (move.innerLayer ?? 1) - 1;
|
|
1599
|
+
adjustValue(idx, directedAmount2);
|
|
1600
|
+
adjustValue(idx + 1, -directedAmount2);
|
|
1601
|
+
break;
|
|
1335
1602
|
}
|
|
1336
|
-
|
|
1603
|
+
case 1 /* INDEXABLE_SLICE_FAR */: {
|
|
1604
|
+
const idx = sliceDiameter - (move.innerLayer ?? 1);
|
|
1605
|
+
adjustValue(idx, directedAmount2);
|
|
1606
|
+
adjustValue(idx + 1, -directedAmount2);
|
|
1607
|
+
break;
|
|
1608
|
+
}
|
|
1609
|
+
case 2 /* INDEXABLE_WIDE_NEAR */: {
|
|
1610
|
+
adjustValue((move.outerLayer ?? 1) - 1, directedAmount2);
|
|
1611
|
+
adjustValue(move.innerLayer ?? 2, -directedAmount2);
|
|
1612
|
+
break;
|
|
1613
|
+
}
|
|
1614
|
+
case 3 /* INDEXABLE_WIDE_FAR */: {
|
|
1615
|
+
adjustValue(sliceDiameter - (move.innerLayer ?? 2), directedAmount2);
|
|
1616
|
+
adjustValue(
|
|
1617
|
+
sliceDiameter - ((move.outerLayer ?? 1) - 1),
|
|
1618
|
+
-directedAmount2
|
|
1619
|
+
);
|
|
1620
|
+
break;
|
|
1621
|
+
}
|
|
1622
|
+
case 4 /* SPECIFIC_SLICE */: {
|
|
1623
|
+
adjustValue(moveSourceInfo.from, directedAmount2);
|
|
1624
|
+
adjustValue(moveSourceInfo.to, -directedAmount2);
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
case 5 /* ROTATION */: {
|
|
1628
|
+
adjustValue(0, directedAmount2);
|
|
1629
|
+
adjustValue(sliceDiameter, -directedAmount2);
|
|
1630
|
+
break;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if ([0, 2].includes(sliceDeltas.size)) {
|
|
1634
|
+
lastCandidateRange = { suffixLength, sliceDeltas: new Map(sliceDeltas) };
|
|
1635
|
+
}
|
|
1337
1636
|
}
|
|
1338
|
-
|
|
1637
|
+
if (sliceDeltas.size === 0) {
|
|
1638
|
+
return [];
|
|
1639
|
+
}
|
|
1640
|
+
if (!lastCandidateRange) {
|
|
1641
|
+
return moves;
|
|
1642
|
+
}
|
|
1643
|
+
let [from2, to] = lastCandidateRange.sliceDeltas.keys();
|
|
1644
|
+
if (from2 > to) {
|
|
1645
|
+
[from2, to] = [to, from2];
|
|
1646
|
+
}
|
|
1647
|
+
const directedAmount = lastCandidateRange.sliceDeltas.get(from2);
|
|
1648
|
+
return [
|
|
1649
|
+
...moves.slice(0, -lastCandidateRange.suffixLength),
|
|
1650
|
+
...directedAmount !== 0 ? [simplestMove(axis, from2, to, directedAmount)] : []
|
|
1651
|
+
];
|
|
1339
1652
|
}
|
|
1653
|
+
var puzzleSpecificSimplifyOptions333 = {
|
|
1654
|
+
quantumMoveOrder: () => 4,
|
|
1655
|
+
// doQuantumMovesCommute: areQuantumMovesSameAxis,
|
|
1656
|
+
axis: { areQuantumMovesSameAxis, simplifySameAxisMoves }
|
|
1657
|
+
};
|
|
1658
|
+
|
|
1659
|
+
// src/cubing/puzzles/implementations/3x3x3/index.ts
|
|
1660
|
+
var cubeMirrorTransforms = {
|
|
1661
|
+
"\u2194 Mirror (M)": {
|
|
1662
|
+
replaceMovesByFamily: {
|
|
1663
|
+
L: "R",
|
|
1664
|
+
R: "L",
|
|
1665
|
+
l: "r",
|
|
1666
|
+
r: "l",
|
|
1667
|
+
Lw: "Rw",
|
|
1668
|
+
Rw: "Lw",
|
|
1669
|
+
Lv: "Rv",
|
|
1670
|
+
Rv: "Lv"
|
|
1671
|
+
},
|
|
1672
|
+
invertExceptByFamily: /* @__PURE__ */ new Set(["x", "M", "m"])
|
|
1673
|
+
},
|
|
1674
|
+
"\u2922 Mirror (S)": {
|
|
1675
|
+
replaceMovesByFamily: {
|
|
1676
|
+
F: "B",
|
|
1677
|
+
B: "F",
|
|
1678
|
+
f: "b",
|
|
1679
|
+
b: "f",
|
|
1680
|
+
Fw: "Bw",
|
|
1681
|
+
Bw: "Fw",
|
|
1682
|
+
Fv: "Bv",
|
|
1683
|
+
Bv: "Fv"
|
|
1684
|
+
},
|
|
1685
|
+
invertExceptByFamily: /* @__PURE__ */ new Set(["z", "S", "s"])
|
|
1686
|
+
},
|
|
1687
|
+
"\u2195 Mirror (E)": {
|
|
1688
|
+
replaceMovesByFamily: {
|
|
1689
|
+
U: "D",
|
|
1690
|
+
D: "U",
|
|
1691
|
+
u: "d",
|
|
1692
|
+
d: "u",
|
|
1693
|
+
Uw: "Dw",
|
|
1694
|
+
Dw: "Uw",
|
|
1695
|
+
Uv: "Dv",
|
|
1696
|
+
Dv: "Uv"
|
|
1697
|
+
},
|
|
1698
|
+
invertExceptByFamily: /* @__PURE__ */ new Set(["y", "E", "e"])
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
var cube3x3x3 = {
|
|
1702
|
+
id: "3x3x3",
|
|
1703
|
+
fullName: "3\xD73\xD73 Cube",
|
|
1704
|
+
inventedBy: ["Ern\u0151 Rubik"],
|
|
1705
|
+
inventionYear: 1974,
|
|
1706
|
+
// https://en.wikipedia.org/wiki/Rubik%27s_Cube#Conception_and_development
|
|
1707
|
+
kpuzzle: getCached(async () => {
|
|
1708
|
+
return experimental3x3x3KPuzzle;
|
|
1709
|
+
}),
|
|
1710
|
+
svg: getCached(async () => {
|
|
1711
|
+
return (await import("./puzzles-dynamic-3x3x3-JWIWLLZA.js")).cube3x3x3SVG;
|
|
1712
|
+
}),
|
|
1713
|
+
llSVG: getCached(async () => {
|
|
1714
|
+
return (await import("./puzzles-dynamic-3x3x3-JWIWLLZA.js")).cube3x3x3LLSVG;
|
|
1715
|
+
}),
|
|
1716
|
+
llFaceSVG: getCached(async () => {
|
|
1717
|
+
return (await import("./puzzles-dynamic-3x3x3-JWIWLLZA.js")).cube3x3x3LLFaceSVG;
|
|
1718
|
+
}),
|
|
1719
|
+
pg: getCached(async () => {
|
|
1720
|
+
return asyncGetPuzzleGeometry("3x3x3");
|
|
1721
|
+
}),
|
|
1722
|
+
stickeringMask: (stickering) => cubeLikeStickeringMask(cube3x3x3, stickering),
|
|
1723
|
+
stickerings: () => cubeLikeStickeringList("3x3x3"),
|
|
1724
|
+
puzzleSpecificSimplifyOptions: puzzleSpecificSimplifyOptions333,
|
|
1725
|
+
keyMapping: async () => cube3x3x3KeyMapping,
|
|
1726
|
+
// TODO: async loading
|
|
1727
|
+
algTransformData: cubeMirrorTransforms
|
|
1728
|
+
};
|
|
1340
1729
|
|
|
1341
1730
|
export {
|
|
1342
1731
|
from,
|
|
1343
|
-
getFaceletStickeringMask,
|
|
1344
|
-
getPieceStickeringMask,
|
|
1345
|
-
PuzzleStickering,
|
|
1346
|
-
StickeringManager,
|
|
1347
|
-
cubeLikeStickeringMask,
|
|
1348
|
-
cubeLikeStickeringList,
|
|
1349
1732
|
getCached,
|
|
1350
|
-
asyncGetPuzzleGeometry,
|
|
1351
|
-
PGPuzzleLoader,
|
|
1352
|
-
CubePGPuzzleLoader,
|
|
1353
1733
|
cube3x3x3KPuzzleDefinition,
|
|
1354
1734
|
puzzleOrientation3x3x3Idx,
|
|
1355
1735
|
puzzleOrientation3x3x3Cache,
|
|
@@ -1359,7 +1739,19 @@ export {
|
|
|
1359
1739
|
asyncGetKPuzzleByDesc,
|
|
1360
1740
|
customPGPuzzleLoader,
|
|
1361
1741
|
experimentalIs2x2x2Solved,
|
|
1742
|
+
getFaceletStickeringMask,
|
|
1743
|
+
getPieceStickeringMask,
|
|
1744
|
+
PuzzleStickering,
|
|
1745
|
+
StickeringManager,
|
|
1362
1746
|
experimental3x3x3KPuzzle,
|
|
1363
|
-
bigCubePuzzleOrientation
|
|
1747
|
+
bigCubePuzzleOrientation,
|
|
1748
|
+
cubeLikeStickeringMask,
|
|
1749
|
+
cubeLikeStickeringList,
|
|
1750
|
+
cube3x3x3KeyMapping,
|
|
1751
|
+
cubeMirrorTransforms,
|
|
1752
|
+
cube3x3x3,
|
|
1753
|
+
asyncGetPuzzleGeometry,
|
|
1754
|
+
PGPuzzleLoader,
|
|
1755
|
+
CubePGPuzzleLoader
|
|
1364
1756
|
};
|
|
1365
|
-
//# sourceMappingURL=chunk-
|
|
1757
|
+
//# sourceMappingURL=chunk-Z4CZPP2W.js.map
|