cubing 0.56.0 → 0.57.0
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-DFQMTDRG.js → chunk-J53ID3VX.js} +2 -2
- package/dist/bin/chunks/chunk-J53ID3VX.js.map +7 -0
- package/dist/bin/order.js +1 -1
- package/dist/bin/order.js.map +2 -2
- package/dist/bin/puzzle-geometry-bin.js +1 -1
- package/dist/bin/puzzle-geometry-bin.js.map +2 -2
- package/dist/bin/scramble.js +1 -1
- package/dist/lib/cubing/{PuzzleLoader-DWqO9l1G.d.ts → PuzzleLoader-Dd4G1VlU.d.ts} +355 -312
- package/dist/lib/cubing/alg/index.d.ts +8 -8
- package/dist/lib/cubing/alg/index.js +1 -1
- package/dist/lib/cubing/bluetooth/index.d.ts +7 -8
- package/dist/lib/cubing/bluetooth/index.js +68 -54
- package/dist/lib/cubing/bluetooth/index.js.map +3 -3
- package/dist/lib/cubing/{bluetooth-puzzle-C6TIIh-Z.d.ts → bluetooth-puzzle-FIXncgc8.d.ts} +1 -1
- package/dist/lib/cubing/chunks/big-puzzle-orientation-IZASZS5A.js +70 -0
- package/dist/lib/cubing/chunks/big-puzzle-orientation-IZASZS5A.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-TQF5J7MH.js → chunk-3YVVF3KK.js} +79 -79
- package/dist/lib/cubing/chunks/chunk-3YVVF3KK.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-XPH22PGR.js → chunk-CGV5LY7H.js} +2 -2
- package/dist/lib/cubing/chunks/chunk-CGV5LY7H.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-KO64SKMG.js → chunk-DWN2US56.js} +11 -11
- package/dist/lib/cubing/chunks/chunk-DWN2US56.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-MA47PABE.js → chunk-EVYENG3X.js} +40 -42
- package/dist/lib/cubing/chunks/chunk-EVYENG3X.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-BQNTAVTA.js → chunk-GKM2CK6T.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-WOAANT6Y.js → chunk-J6NSY47E.js} +114 -21
- package/dist/lib/cubing/chunks/chunk-J6NSY47E.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-YFGRXDD4.js → chunk-KAXXPFNE.js} +4 -4
- package/dist/lib/cubing/chunks/{chunk-YFGRXDD4.js.map → chunk-KAXXPFNE.js.map} +2 -2
- package/dist/lib/cubing/chunks/{chunk-YQVHA4F6.js → chunk-MITU5GJ5.js} +55 -51
- package/dist/lib/cubing/chunks/{chunk-YQVHA4F6.js.map → chunk-MITU5GJ5.js.map} +3 -3
- package/dist/lib/cubing/chunks/{chunk-M4T7GO54.js → chunk-SNKS5WOA.js} +92 -70
- package/dist/lib/cubing/chunks/chunk-SNKS5WOA.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-2SBMIHZV.js → chunk-SWKNZGJF.js} +100 -108
- package/dist/lib/cubing/chunks/chunk-SWKNZGJF.js.map +7 -0
- package/dist/lib/cubing/chunks/{inside-KAVAZETT.js → inside-AF5A42Y6.js} +18 -18
- package/dist/lib/cubing/chunks/{inside-KAVAZETT.js.map → inside-AF5A42Y6.js.map} +2 -2
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-AHFPWEBD.js → puzzles-dynamic-side-events-BOGUHF4Q.js} +1660 -1660
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-AHFPWEBD.js.map → puzzles-dynamic-side-events-BOGUHF4Q.js.map} +3 -3
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-FTWMZ5ZJ.js → search-dynamic-sgs-side-events-PVOJWVJF.js} +7 -7
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-FTWMZ5ZJ.js.map → search-dynamic-sgs-side-events-PVOJWVJF.js.map} +2 -2
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-ZYGVRJQK.js → search-dynamic-sgs-unofficial-HRR5D2US.js} +648 -648
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-HRR5D2US.js.map +7 -0
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-6MKLH6KJ.js → search-dynamic-solve-4x4x4-3CROPIQD.js} +7 -7
- package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-5YRST2XM.js → search-dynamic-solve-fto-NKAFVO65.js} +2 -2
- package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-W64XQPBF.js → search-dynamic-solve-kilominx-EDGE5SP4.js} +2 -2
- package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-QGRCHB6L.js → twisty-dynamic-3d-EIIPCTEF.js} +63 -57
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-EIIPCTEF.js.map +7 -0
- package/dist/lib/cubing/chunks/{twsearch-ITWEA5PO.js → twsearch-TGLVN7TI.js} +2 -2
- package/dist/lib/cubing/{index-g0IQg962.d.ts → index-Drw5ySJm.d.ts} +2 -2
- 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 +3 -3
- 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 +456 -438
- package/dist/lib/cubing/puzzle-geometry/index.js.map +3 -3
- package/dist/lib/cubing/puzzles/index.d.ts +1 -1
- package/dist/lib/cubing/puzzles/index.js +4 -4
- 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 +22 -22
- package/dist/lib/cubing/stream/index.js +41 -41
- package/dist/lib/cubing/stream/index.js.map +3 -3
- package/dist/lib/cubing/twisty/index.d.ts +8 -8
- package/dist/lib/cubing/twisty/index.js +3678 -3638
- package/dist/lib/cubing/twisty/index.js.map +4 -4
- package/package.json +13 -7
- package/dist/bin/chunks/chunk-DFQMTDRG.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-2SBMIHZV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-KO64SKMG.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-M4T7GO54.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-MA47PABE.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-TQF5J7MH.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-WOAANT6Y.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-XPH22PGR.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-ZYGVRJQK.js.map +0 -7
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-QGRCHB6L.js.map +0 -7
- /package/dist/lib/cubing/chunks/{chunk-BQNTAVTA.js.map → chunk-GKM2CK6T.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-6MKLH6KJ.js.map → search-dynamic-solve-4x4x4-3CROPIQD.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-5YRST2XM.js.map → search-dynamic-solve-fto-NKAFVO65.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-W64XQPBF.js.map → search-dynamic-solve-kilominx-EDGE5SP4.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{twsearch-ITWEA5PO.js.map → twsearch-TGLVN7TI.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Move,
|
|
3
3
|
QuantumMove
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-SWKNZGJF.js";
|
|
5
5
|
|
|
6
6
|
// src/cubing/puzzle-geometry/colors.ts
|
|
7
7
|
function defaultPlatonicColorSchemes() {
|
|
@@ -183,7 +183,7 @@ var FaceNameSwizzler = class {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
return true;
|
|
186
|
-
} catch
|
|
186
|
+
} catch {
|
|
187
187
|
return false;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -213,49 +213,6 @@ var FaceNameSwizzler = class {
|
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
-
// src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts
|
|
217
|
-
var NullMapper = class {
|
|
218
|
-
notationToInternal(move) {
|
|
219
|
-
return move;
|
|
220
|
-
}
|
|
221
|
-
notationToExternal(move) {
|
|
222
|
-
return move;
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
// src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts
|
|
227
|
-
var FTONotationMapper = class {
|
|
228
|
-
constructor(child, sw) {
|
|
229
|
-
this.child = child;
|
|
230
|
-
this.sw = sw;
|
|
231
|
-
}
|
|
232
|
-
notationToInternal(move) {
|
|
233
|
-
if (move.family === "T" && move.innerLayer === void 0 && move.outerLayer === void 0) {
|
|
234
|
-
return new Move(
|
|
235
|
-
new QuantumMove("FLRv", move.innerLayer, move.outerLayer),
|
|
236
|
-
move.amount
|
|
237
|
-
);
|
|
238
|
-
} else {
|
|
239
|
-
const r = this.child.notationToInternal(move);
|
|
240
|
-
return r;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
// we never rewrite click moves to these moves.
|
|
244
|
-
notationToExternal(move) {
|
|
245
|
-
let fam = move.family;
|
|
246
|
-
if (fam.length > 0 && fam[fam.length - 1] === "v") {
|
|
247
|
-
fam = fam.substring(0, fam.length - 1);
|
|
248
|
-
}
|
|
249
|
-
if (this.sw.spinmatch(fam, "FLUR")) {
|
|
250
|
-
return new Move(
|
|
251
|
-
new QuantumMove("T", move.innerLayer, move.outerLayer),
|
|
252
|
-
move.amount
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
return this.child.notationToExternal(move);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
|
|
259
216
|
// src/cubing/puzzle-geometry/notation-mapping/FaceRenamingMapper.ts
|
|
260
217
|
var FaceRenamingMapper = class {
|
|
261
218
|
constructor(internalNames, externalNames) {
|
|
@@ -302,6 +259,39 @@ var FaceRenamingMapper = class {
|
|
|
302
259
|
}
|
|
303
260
|
};
|
|
304
261
|
|
|
262
|
+
// src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts
|
|
263
|
+
var FTONotationMapper = class {
|
|
264
|
+
constructor(child, sw) {
|
|
265
|
+
this.child = child;
|
|
266
|
+
this.sw = sw;
|
|
267
|
+
}
|
|
268
|
+
notationToInternal(move) {
|
|
269
|
+
if (move.family === "T" && move.innerLayer === void 0 && move.outerLayer === void 0) {
|
|
270
|
+
return new Move(
|
|
271
|
+
new QuantumMove("FLRv", move.innerLayer, move.outerLayer),
|
|
272
|
+
move.amount
|
|
273
|
+
);
|
|
274
|
+
} else {
|
|
275
|
+
const r = this.child.notationToInternal(move);
|
|
276
|
+
return r;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// we never rewrite click moves to these moves.
|
|
280
|
+
notationToExternal(move) {
|
|
281
|
+
let fam = move.family;
|
|
282
|
+
if (fam.length > 0 && fam[fam.length - 1] === "v") {
|
|
283
|
+
fam = fam.substring(0, fam.length - 1);
|
|
284
|
+
}
|
|
285
|
+
if (this.sw.spinmatch(fam, "FLUR")) {
|
|
286
|
+
return new Move(
|
|
287
|
+
new QuantumMove("T", move.innerLayer, move.outerLayer),
|
|
288
|
+
move.amount
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return this.child.notationToExternal(move);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
305
295
|
// src/cubing/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.ts
|
|
306
296
|
var MegaminxScramblingNotationMapper = class {
|
|
307
297
|
constructor(child) {
|
|
@@ -361,6 +351,16 @@ var MegaminxScramblingNotationMapper = class {
|
|
|
361
351
|
}
|
|
362
352
|
};
|
|
363
353
|
|
|
354
|
+
// src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts
|
|
355
|
+
var NullMapper = class {
|
|
356
|
+
notationToInternal(move) {
|
|
357
|
+
return move;
|
|
358
|
+
}
|
|
359
|
+
notationToExternal(move) {
|
|
360
|
+
return move;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
364
|
// src/cubing/puzzle-geometry/notation-mapping/NxNxNCubeMapper.ts
|
|
365
365
|
var NxNxNCubeMapper = class {
|
|
366
366
|
constructor(slices) {
|
|
@@ -667,104 +667,6 @@ function remapKPuzzleDefinition(internalDefinition, notationMapper) {
|
|
|
667
667
|
return externalDefinition;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
// src/cubing/puzzle-geometry/Options.ts
|
|
671
|
-
function parseOptions(argv) {
|
|
672
|
-
let argp = 0;
|
|
673
|
-
const options = {};
|
|
674
|
-
while (argp < argv.length && argv[argp][0] === "-") {
|
|
675
|
-
const option = argv[argp++];
|
|
676
|
-
if (option === "--rotations") {
|
|
677
|
-
options.addRotations = true;
|
|
678
|
-
} else if (option === "--allmoves") {
|
|
679
|
-
options.allMoves = true;
|
|
680
|
-
} else if (option === "--outerblockmoves") {
|
|
681
|
-
options.outerBlockMoves = true;
|
|
682
|
-
} else if (option === "--vertexmoves") {
|
|
683
|
-
options.vertexMoves = true;
|
|
684
|
-
} else if (option === "--nocorners") {
|
|
685
|
-
options.includeCornerOrbits = false;
|
|
686
|
-
} else if (option === "--noedges") {
|
|
687
|
-
options.includeEdgeOrbits = false;
|
|
688
|
-
} else if (option === "--noorientation") {
|
|
689
|
-
options.fixedOrientation = true;
|
|
690
|
-
} else if (option === "--nocenters") {
|
|
691
|
-
options.includeCenterOrbits = false;
|
|
692
|
-
} else if (option === "--omit") {
|
|
693
|
-
options.excludeOrbits = argv[argp].split(",");
|
|
694
|
-
argp++;
|
|
695
|
-
} else if (option === "--moves") {
|
|
696
|
-
options.moveList = argv[argp].split(",");
|
|
697
|
-
argp++;
|
|
698
|
-
} else if (option === "--optimize") {
|
|
699
|
-
options.optimizeOrbits = true;
|
|
700
|
-
} else if (option === "--scramble") {
|
|
701
|
-
options.scrambleAmount = 100;
|
|
702
|
-
} else if (option === "--fixcorner") {
|
|
703
|
-
options.fixedPieceType = "v";
|
|
704
|
-
} else if (option === "--fixedge") {
|
|
705
|
-
options.fixedPieceType = "e";
|
|
706
|
-
} else if (option === "--fixcenter") {
|
|
707
|
-
options.fixedPieceType = "f";
|
|
708
|
-
} else if (option === "--orientcenters") {
|
|
709
|
-
options.orientCenters = true;
|
|
710
|
-
} else if (option === "--puzzleorientation") {
|
|
711
|
-
options.puzzleOrientation = JSON.parse(argv[argp]);
|
|
712
|
-
argp++;
|
|
713
|
-
} else {
|
|
714
|
-
throw new Error(`Bad option: ${option}`);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
const puzzleDescription = parsePuzzleDescription(argv.slice(argp).join(" "));
|
|
718
|
-
return { puzzleDescription, options };
|
|
719
|
-
}
|
|
720
|
-
var PuzzleGeometryFullOptions = class {
|
|
721
|
-
verbosity = 0;
|
|
722
|
-
// verbosity (console.log)
|
|
723
|
-
allMoves = false;
|
|
724
|
-
// generate all slice moves in ksolve
|
|
725
|
-
outerBlockMoves;
|
|
726
|
-
// generate outer block moves
|
|
727
|
-
vertexMoves = false;
|
|
728
|
-
// generate vertex moves
|
|
729
|
-
addRotations = false;
|
|
730
|
-
// add symmetry information to ksolve output
|
|
731
|
-
moveList = null;
|
|
732
|
-
// move list to generate
|
|
733
|
-
fixedOrientation = false;
|
|
734
|
-
// eliminate any orientations
|
|
735
|
-
fixedPieceType = null;
|
|
736
|
-
// fix a piece?
|
|
737
|
-
orientCenters = false;
|
|
738
|
-
// orient centers?
|
|
739
|
-
// TODO: Group these into a single object?
|
|
740
|
-
includeCornerOrbits = true;
|
|
741
|
-
// include corner orbits
|
|
742
|
-
includeCenterOrbits = true;
|
|
743
|
-
// include center orbits
|
|
744
|
-
includeEdgeOrbits = true;
|
|
745
|
-
// include edge orbits
|
|
746
|
-
// Overrides the previous options.
|
|
747
|
-
excludeOrbits = [];
|
|
748
|
-
// exclude these orbits
|
|
749
|
-
optimizeOrbits = false;
|
|
750
|
-
// optimize PermOri
|
|
751
|
-
grayCorners = false;
|
|
752
|
-
// make corner sets gray
|
|
753
|
-
grayCenters = false;
|
|
754
|
-
// make center sets gray
|
|
755
|
-
grayEdges = false;
|
|
756
|
-
// make edge sets gray
|
|
757
|
-
puzzleOrientation = null;
|
|
758
|
-
// single puzzle orientation from options
|
|
759
|
-
puzzleOrientations = null;
|
|
760
|
-
// puzzle orientation override object from options // TODO: is this needed?
|
|
761
|
-
scrambleAmount = 0;
|
|
762
|
-
// scramble?
|
|
763
|
-
constructor(options = {}) {
|
|
764
|
-
Object.assign(this, options);
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
|
|
768
670
|
// src/cubing/puzzle-geometry/Perm.ts
|
|
769
671
|
var zeroCache = [];
|
|
770
672
|
var iotaCache = [];
|
|
@@ -857,13 +759,13 @@ var Perm = class _Perm {
|
|
|
857
759
|
return 0;
|
|
858
760
|
}
|
|
859
761
|
toGap() {
|
|
860
|
-
const cyc =
|
|
762
|
+
const cyc = [];
|
|
861
763
|
const seen = new Array(this.n);
|
|
862
764
|
for (let i = 0; i < this.p.length; i++) {
|
|
863
765
|
if (seen[i] || this.p[i] === i) {
|
|
864
766
|
continue;
|
|
865
767
|
}
|
|
866
|
-
const incyc =
|
|
768
|
+
const incyc = [];
|
|
867
769
|
for (let j = this.p[i]; !seen[j]; j = this.p[j]) {
|
|
868
770
|
incyc.push(1 + j);
|
|
869
771
|
seen[j] = true;
|
|
@@ -873,13 +775,13 @@ var Perm = class _Perm {
|
|
|
873
775
|
return cyc.join("");
|
|
874
776
|
}
|
|
875
777
|
toMathematica() {
|
|
876
|
-
const cyc =
|
|
778
|
+
const cyc = [];
|
|
877
779
|
const seen = new Array(this.n);
|
|
878
780
|
for (let i = 0; i < this.p.length; i++) {
|
|
879
781
|
if (seen[i] || this.p[i] === i) {
|
|
880
782
|
continue;
|
|
881
783
|
}
|
|
882
|
-
const incyc =
|
|
784
|
+
const incyc = [];
|
|
883
785
|
for (let j = this.p[i]; !seen[j]; j = this.p[j]) {
|
|
884
786
|
incyc.push(1 + j);
|
|
885
787
|
seen[j] = true;
|
|
@@ -1442,7 +1344,7 @@ var PGTransformBase = class {
|
|
|
1442
1344
|
return this;
|
|
1443
1345
|
}
|
|
1444
1346
|
toPerm() {
|
|
1445
|
-
const perms =
|
|
1347
|
+
const perms = [];
|
|
1446
1348
|
let n = 0;
|
|
1447
1349
|
for (const orbit of this.orbits) {
|
|
1448
1350
|
const p = orbit.toPerm();
|
|
@@ -2630,98 +2532,9 @@ var PuzzleGeometry = class {
|
|
|
2630
2532
|
if (this.options.verbosity > 0) {
|
|
2631
2533
|
console.log(this.header("# "));
|
|
2632
2534
|
}
|
|
2633
|
-
this.create(puzzleDescription);
|
|
2634
|
-
tend(t1);
|
|
2635
|
-
}
|
|
2636
|
-
rotations;
|
|
2637
|
-
// all members of the rotation group
|
|
2638
|
-
baseplanerot;
|
|
2639
|
-
// unique rotations of the baseplane
|
|
2640
|
-
baseplanes;
|
|
2641
|
-
// planes, corresponding to faces
|
|
2642
|
-
facenames;
|
|
2643
|
-
// face names
|
|
2644
|
-
faceplanes;
|
|
2645
|
-
// face planes
|
|
2646
|
-
edgenames;
|
|
2647
|
-
// edge names
|
|
2648
|
-
vertexnames;
|
|
2649
|
-
// vertexnames
|
|
2650
|
-
geonormals;
|
|
2651
|
-
// all geometric directions, with names and types
|
|
2652
|
-
moveplanes;
|
|
2653
|
-
// the planes that split moves
|
|
2654
|
-
moveplanes2;
|
|
2655
|
-
// the planes that split moves, filtered
|
|
2656
|
-
moveplanesets;
|
|
2657
|
-
// the move planes, in parallel sets
|
|
2658
|
-
moveplanenormals;
|
|
2659
|
-
// one move plane
|
|
2660
|
-
movesetorders;
|
|
2661
|
-
// the order of rotations for each move set
|
|
2662
|
-
movesetgeos;
|
|
2663
|
-
// geometric feature information for move sets
|
|
2664
|
-
basefaces;
|
|
2665
|
-
// polytope faces before cuts
|
|
2666
|
-
faces;
|
|
2667
|
-
// all the stickers
|
|
2668
|
-
facecentermass;
|
|
2669
|
-
// center of mass of all faces
|
|
2670
|
-
baseFaceCount;
|
|
2671
|
-
// number of base faces
|
|
2672
|
-
stickersperface;
|
|
2673
|
-
// number of stickers per face
|
|
2674
|
-
shortedge;
|
|
2675
|
-
// number of stickers per face
|
|
2676
|
-
markedface;
|
|
2677
|
-
// given a bitmap of faces, identify the marked one
|
|
2678
|
-
cubies;
|
|
2679
|
-
// the cubies
|
|
2680
|
-
vertexdistance;
|
|
2681
|
-
// vertex distance
|
|
2682
|
-
edgedistance;
|
|
2683
|
-
// edge distance
|
|
2684
|
-
facetocubie;
|
|
2685
|
-
// map a face to a cubie index
|
|
2686
|
-
facetoord;
|
|
2687
|
-
// map a face to a cubie ord
|
|
2688
|
-
moverotations;
|
|
2689
|
-
// move rotations
|
|
2690
|
-
facelisthash;
|
|
2691
|
-
// face list by key
|
|
2692
|
-
cubiesetnames;
|
|
2693
|
-
// cubie set names
|
|
2694
|
-
cubieords;
|
|
2695
|
-
// the size of each orbit
|
|
2696
|
-
cubiesetnums;
|
|
2697
|
-
cubieordnums;
|
|
2698
|
-
orbitoris;
|
|
2699
|
-
// the orientation size of each orbit
|
|
2700
|
-
cubievaluemap;
|
|
2701
|
-
// the map for identical cubies
|
|
2702
|
-
cubiesetcubies;
|
|
2703
|
-
// cubies in each cubie set
|
|
2704
|
-
cmovesbyslice = [];
|
|
2705
|
-
// cmoves as perms by slice
|
|
2706
|
-
parsedmovelist;
|
|
2707
|
-
// parsed move list
|
|
2708
|
-
duplicatedFaces = [];
|
|
2709
|
-
// which faces are duplicated
|
|
2710
|
-
duplicatedCubies = [];
|
|
2711
|
-
// which cubies are duplicated
|
|
2712
|
-
fixedCubie = -1;
|
|
2713
|
-
// fixed cubie, if any
|
|
2714
|
-
net = [];
|
|
2715
|
-
colors = [];
|
|
2716
|
-
swizzler;
|
|
2717
|
-
notationMapper = new NullMapper();
|
|
2718
|
-
addNotationMapper = "";
|
|
2719
|
-
setReidOrSpeffzOrder = false;
|
|
2720
|
-
options;
|
|
2721
|
-
create(puzzleDescription) {
|
|
2722
2535
|
const { shape, cuts } = puzzleDescription;
|
|
2723
|
-
this.
|
|
2724
|
-
this.
|
|
2536
|
+
this.movePlanes = [];
|
|
2537
|
+
this.movePlanesFiltered = [];
|
|
2725
2538
|
this.faces = [];
|
|
2726
2539
|
this.cubies = [];
|
|
2727
2540
|
let g = null;
|
|
@@ -2754,9 +2567,11 @@ var PuzzleGeometry = class {
|
|
|
2754
2567
|
console.log(`# Rotations: ${this.rotations.length}`);
|
|
2755
2568
|
}
|
|
2756
2569
|
const baseplane = g[0];
|
|
2757
|
-
this.
|
|
2758
|
-
const baseplanes = this.
|
|
2759
|
-
|
|
2570
|
+
this.basePlaneRotations = uniqueplanes(baseplane, this.rotations);
|
|
2571
|
+
const baseplanes = this.basePlaneRotations.map(
|
|
2572
|
+
(_) => baseplane.rotateplane(_)
|
|
2573
|
+
);
|
|
2574
|
+
this.basePlanes = baseplanes;
|
|
2760
2575
|
this.baseFaceCount = baseplanes.length;
|
|
2761
2576
|
const net = defaultnets()[baseplanes.length];
|
|
2762
2577
|
this.net = net;
|
|
@@ -2779,8 +2594,8 @@ var PuzzleGeometry = class {
|
|
|
2779
2594
|
const planerot = uniqueplanes(boundary, this.rotations);
|
|
2780
2595
|
const planes = planerot.map((_) => boundary.rotateplane(_));
|
|
2781
2596
|
const firstface = getface(planes);
|
|
2782
|
-
this.
|
|
2783
|
-
this.
|
|
2597
|
+
this.edgeDistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);
|
|
2598
|
+
this.vertexDistance = firstface[0].dist(zero);
|
|
2784
2599
|
const cutplanes = [];
|
|
2785
2600
|
const intersects = [];
|
|
2786
2601
|
let sawface = false;
|
|
@@ -2798,13 +2613,13 @@ var PuzzleGeometry = class {
|
|
|
2798
2613
|
}
|
|
2799
2614
|
case "v": {
|
|
2800
2615
|
normal = vertexnormal;
|
|
2801
|
-
distance = this.
|
|
2616
|
+
distance = this.vertexDistance;
|
|
2802
2617
|
sawvertex = true;
|
|
2803
2618
|
break;
|
|
2804
2619
|
}
|
|
2805
2620
|
case "e": {
|
|
2806
2621
|
normal = edgenormal;
|
|
2807
|
-
distance = this.
|
|
2622
|
+
distance = this.edgeDistance;
|
|
2808
2623
|
sawedge = true;
|
|
2809
2624
|
break;
|
|
2810
2625
|
}
|
|
@@ -2825,10 +2640,10 @@ var PuzzleGeometry = class {
|
|
|
2825
2640
|
cutplanes.push(edgenormal.makecut(10));
|
|
2826
2641
|
}
|
|
2827
2642
|
}
|
|
2828
|
-
this.
|
|
2829
|
-
for (const baseplanerot of this.
|
|
2643
|
+
this.baseFaces = [];
|
|
2644
|
+
for (const baseplanerot of this.basePlaneRotations) {
|
|
2830
2645
|
const face = baseplanerot.rotateface(firstface);
|
|
2831
|
-
this.
|
|
2646
|
+
this.baseFaces.push(new Face(face));
|
|
2832
2647
|
}
|
|
2833
2648
|
const facenames = [];
|
|
2834
2649
|
const faceplanes = [];
|
|
@@ -2844,8 +2659,8 @@ var PuzzleGeometry = class {
|
|
|
2844
2659
|
}
|
|
2845
2660
|
a.push([p, name]);
|
|
2846
2661
|
}
|
|
2847
|
-
for (let i = 0; i < this.
|
|
2848
|
-
const face = this.
|
|
2662
|
+
for (let i = 0; i < this.basePlaneRotations.length; i++) {
|
|
2663
|
+
const face = this.basePlaneRotations[i].rotateface(firstface);
|
|
2849
2664
|
for (let j = 0; j < face.length; j++) {
|
|
2850
2665
|
const jj = (j + 1) % face.length;
|
|
2851
2666
|
const midpoint = face[j].sum(face[jj]).smul(0.5);
|
|
@@ -2853,8 +2668,8 @@ var PuzzleGeometry = class {
|
|
|
2853
2668
|
}
|
|
2854
2669
|
}
|
|
2855
2670
|
const otherfaces = [];
|
|
2856
|
-
for (let i = 0; i < this.
|
|
2857
|
-
const face = this.
|
|
2671
|
+
for (let i = 0; i < this.basePlaneRotations.length; i++) {
|
|
2672
|
+
const face = this.basePlaneRotations[i].rotateface(firstface);
|
|
2858
2673
|
const facelist = [];
|
|
2859
2674
|
for (let j = 0; j < face.length; j++) {
|
|
2860
2675
|
const jj = (j + 1) % face.length;
|
|
@@ -2906,15 +2721,15 @@ var PuzzleGeometry = class {
|
|
|
2906
2721
|
facenametoindex[neti[j]] = of;
|
|
2907
2722
|
}
|
|
2908
2723
|
}
|
|
2909
|
-
for (let i = 0; i < this.
|
|
2910
|
-
const face = this.
|
|
2911
|
-
const faceplane = boundary.rotateplane(this.
|
|
2724
|
+
for (let i = 0; i < this.basePlaneRotations.length; i++) {
|
|
2725
|
+
const face = this.basePlaneRotations[i].rotateface(firstface);
|
|
2726
|
+
const faceplane = boundary.rotateplane(this.basePlaneRotations[i]);
|
|
2912
2727
|
const facename = faceindextoname[i];
|
|
2913
2728
|
facenames.push([face, facename]);
|
|
2914
2729
|
faceplanes.push([faceplane, facename]);
|
|
2915
2730
|
}
|
|
2916
|
-
for (let i = 0; i < this.
|
|
2917
|
-
const face = this.
|
|
2731
|
+
for (let i = 0; i < this.basePlaneRotations.length; i++) {
|
|
2732
|
+
const face = this.basePlaneRotations[i].rotateface(firstface);
|
|
2918
2733
|
const facename = faceindextoname[i];
|
|
2919
2734
|
for (let j = 0; j < face.length; j++) {
|
|
2920
2735
|
const jj = (j + 1) % face.length;
|
|
@@ -3015,7 +2830,7 @@ var PuzzleGeometry = class {
|
|
|
3015
2830
|
}
|
|
3016
2831
|
vertexnames[i] = [vertexnames[i][0], r];
|
|
3017
2832
|
}
|
|
3018
|
-
this.
|
|
2833
|
+
this.markedFaceLookup = markedface;
|
|
3019
2834
|
if (this.options.verbosity > 1) {
|
|
3020
2835
|
console.log(`# Face names: ${facenames.map((_) => _[1]).join(" ")}`);
|
|
3021
2836
|
console.log(`# Edge names: ${edgenames.map((_) => _[1]).join(" ")}`);
|
|
@@ -3031,38 +2846,38 @@ var PuzzleGeometry = class {
|
|
|
3031
2846
|
for (const vertexname of vertexnames) {
|
|
3032
2847
|
geonormals.push([vertexname[0].makenormal(), vertexname[1], "v"]);
|
|
3033
2848
|
}
|
|
3034
|
-
this.
|
|
3035
|
-
this.
|
|
3036
|
-
this.
|
|
3037
|
-
this.
|
|
3038
|
-
this.
|
|
2849
|
+
this.faceNames = facenames;
|
|
2850
|
+
this.facePlanes = faceplanes;
|
|
2851
|
+
this.edgeNames = edgenames;
|
|
2852
|
+
this.vertexNames = vertexnames;
|
|
2853
|
+
this.geometryNormals = geonormals;
|
|
3039
2854
|
const geonormalnames = geonormals.map((_) => _[1]);
|
|
3040
2855
|
this.swizzler.setGripNames(geonormalnames);
|
|
3041
2856
|
if (this.options.verbosity > 0) {
|
|
3042
2857
|
console.log(
|
|
3043
|
-
`# Distances: face ${1} edge ${this.
|
|
2858
|
+
`# Distances: face ${1} edge ${this.edgeDistance} vertex ${this.vertexDistance}`
|
|
3044
2859
|
);
|
|
3045
2860
|
}
|
|
3046
2861
|
for (let c = 0; c < cutplanes.length; c++) {
|
|
3047
2862
|
for (const rotation of this.rotations) {
|
|
3048
2863
|
const q = cutplanes[c].rotateplane(rotation);
|
|
3049
2864
|
let wasseen = false;
|
|
3050
|
-
for (const moveplane of this.
|
|
2865
|
+
for (const moveplane of this.movePlanes) {
|
|
3051
2866
|
if (q.sameplane(moveplane)) {
|
|
3052
2867
|
wasseen = true;
|
|
3053
2868
|
break;
|
|
3054
2869
|
}
|
|
3055
2870
|
}
|
|
3056
2871
|
if (!wasseen) {
|
|
3057
|
-
this.
|
|
2872
|
+
this.movePlanes.push(q);
|
|
3058
2873
|
if (intersects[c]) {
|
|
3059
|
-
this.
|
|
2874
|
+
this.movePlanesFiltered.push(q);
|
|
3060
2875
|
}
|
|
3061
2876
|
}
|
|
3062
2877
|
}
|
|
3063
2878
|
}
|
|
3064
2879
|
let ft = new FaceTree(firstface);
|
|
3065
|
-
const tar = this.
|
|
2880
|
+
const tar = this.movePlanesFiltered.slice();
|
|
3066
2881
|
let rval = 31;
|
|
3067
2882
|
for (let i = 0; i < tar.length; i++) {
|
|
3068
2883
|
const j = i + Math.floor((tar.length - i) * (rval / 65536));
|
|
@@ -3075,7 +2890,7 @@ var PuzzleGeometry = class {
|
|
|
3075
2890
|
if (this.options.verbosity > 0) {
|
|
3076
2891
|
console.log(`# Faces is now ${faces.length}`);
|
|
3077
2892
|
}
|
|
3078
|
-
this.
|
|
2893
|
+
this.stickersPerFace = faces.length;
|
|
3079
2894
|
const simplerot = [];
|
|
3080
2895
|
const cm = centermassface(firstface);
|
|
3081
2896
|
for (const rotation of this.rotations) {
|
|
@@ -3112,18 +2927,18 @@ var PuzzleGeometry = class {
|
|
|
3112
2927
|
}
|
|
3113
2928
|
}
|
|
3114
2929
|
}
|
|
3115
|
-
this.
|
|
2930
|
+
this.shortestEdge = 1e99;
|
|
3116
2931
|
for (const face of faces) {
|
|
3117
2932
|
for (let j = 0; j < face.length; j++) {
|
|
3118
2933
|
const k = (j + 1) % face.length;
|
|
3119
2934
|
const t = face.get(j).dist(face.get(k));
|
|
3120
|
-
if (t < this.
|
|
3121
|
-
this.
|
|
2935
|
+
if (t < this.shortestEdge) {
|
|
2936
|
+
this.shortestEdge = t;
|
|
3122
2937
|
}
|
|
3123
2938
|
}
|
|
3124
2939
|
}
|
|
3125
2940
|
if (this.options.verbosity > 0) {
|
|
3126
|
-
console.log(`# Short edge is ${this.
|
|
2941
|
+
console.log(`# Short edge is ${this.shortestEdge}`);
|
|
3127
2942
|
}
|
|
3128
2943
|
if (shape === "c" && sawface && !sawedge && !sawvertex) {
|
|
3129
2944
|
this.addNotationMapper = "NxNxNCubeMapper";
|
|
@@ -3164,14 +2979,99 @@ var PuzzleGeometry = class {
|
|
|
3164
2979
|
])
|
|
3165
2980
|
);
|
|
3166
2981
|
}
|
|
2982
|
+
tend(t1);
|
|
3167
2983
|
}
|
|
2984
|
+
rotations;
|
|
2985
|
+
// all members of the rotation group
|
|
2986
|
+
basePlaneRotations;
|
|
2987
|
+
// unique rotations of the baseplane
|
|
2988
|
+
basePlanes;
|
|
2989
|
+
// planes, corresponding to faces
|
|
2990
|
+
faceNames;
|
|
2991
|
+
// face names
|
|
2992
|
+
facePlanes;
|
|
2993
|
+
// face planes
|
|
2994
|
+
edgeNames;
|
|
2995
|
+
// edge names
|
|
2996
|
+
vertexNames;
|
|
2997
|
+
// vertexnames
|
|
2998
|
+
geometryNormals;
|
|
2999
|
+
// all geometric directions, with names and types
|
|
3000
|
+
movePlanes;
|
|
3001
|
+
// the planes that split moves
|
|
3002
|
+
movePlanesFiltered;
|
|
3003
|
+
// the planes that split moves, filtered
|
|
3004
|
+
movePlaneSets;
|
|
3005
|
+
// the move planes, in parallel sets
|
|
3006
|
+
movePlaneNormals;
|
|
3007
|
+
// one move plane
|
|
3008
|
+
movesetorders;
|
|
3009
|
+
// the order of rotations for each move set
|
|
3010
|
+
movesetgeos;
|
|
3011
|
+
// geometric feature information for move sets
|
|
3012
|
+
baseFaces;
|
|
3013
|
+
// polytope faces before cuts
|
|
3014
|
+
faces;
|
|
3015
|
+
// all the stickers
|
|
3016
|
+
faceCenterMass;
|
|
3017
|
+
// center of mass of all faces
|
|
3018
|
+
baseFaceCount;
|
|
3019
|
+
// number of base faces
|
|
3020
|
+
stickersPerFace;
|
|
3021
|
+
// number of stickers per face
|
|
3022
|
+
shortestEdge;
|
|
3023
|
+
markedFaceLookup;
|
|
3024
|
+
// given a bitmap of faces, identify the marked one
|
|
3025
|
+
cubies;
|
|
3026
|
+
// the cubies
|
|
3027
|
+
vertexDistance;
|
|
3028
|
+
// vertex distance
|
|
3029
|
+
edgeDistance;
|
|
3030
|
+
// edge distance
|
|
3031
|
+
faceToCubie;
|
|
3032
|
+
// map a face to a cubie index
|
|
3033
|
+
faceToCubieOrd;
|
|
3034
|
+
// map a face to a cubie ord
|
|
3035
|
+
moveRotations;
|
|
3036
|
+
// move rotations
|
|
3037
|
+
faceListHash;
|
|
3038
|
+
// face list by key
|
|
3039
|
+
cubieSetNames;
|
|
3040
|
+
// cubie set names
|
|
3041
|
+
cubieOrbitSizes;
|
|
3042
|
+
// the size of each orbit
|
|
3043
|
+
cubieSetNums;
|
|
3044
|
+
cubieOrdNums;
|
|
3045
|
+
orbitOrientations;
|
|
3046
|
+
// the orientation size of each orbit
|
|
3047
|
+
cubieValueMap;
|
|
3048
|
+
// the map for identical cubies
|
|
3049
|
+
cubieSetCubies;
|
|
3050
|
+
// cubies in each cubie set
|
|
3051
|
+
cmovesBySlice = [];
|
|
3052
|
+
// cmoves as perms by slice
|
|
3053
|
+
parsedMoveList;
|
|
3054
|
+
// parsed move list
|
|
3055
|
+
duplicatedFaces = [];
|
|
3056
|
+
// which faces are duplicated
|
|
3057
|
+
duplicatedCubies = [];
|
|
3058
|
+
// which cubies are duplicated
|
|
3059
|
+
fixedCubie = -1;
|
|
3060
|
+
// fixed cubie, if any
|
|
3061
|
+
net = [];
|
|
3062
|
+
colors = [];
|
|
3063
|
+
swizzler;
|
|
3064
|
+
notationMapper = new NullMapper();
|
|
3065
|
+
addNotationMapper = "";
|
|
3066
|
+
setReidOrSpeffzOrder = false;
|
|
3067
|
+
options;
|
|
3168
3068
|
keyface(face) {
|
|
3169
3069
|
return this.keyface2(face.centermass());
|
|
3170
3070
|
}
|
|
3171
3071
|
keyface2(cm) {
|
|
3172
3072
|
let s = "";
|
|
3173
3073
|
const sfcc = String.fromCharCode;
|
|
3174
|
-
for (const moveplaneset of this.
|
|
3074
|
+
for (const moveplaneset of this.movePlaneSets) {
|
|
3175
3075
|
if (moveplaneset.length > 0) {
|
|
3176
3076
|
const dv = cm.dot(moveplaneset[0]);
|
|
3177
3077
|
let t = 0;
|
|
@@ -3202,7 +3102,7 @@ var PuzzleGeometry = class {
|
|
|
3202
3102
|
keyface3(face) {
|
|
3203
3103
|
const cm = face.centermass();
|
|
3204
3104
|
const r = [];
|
|
3205
|
-
for (const moveplaneset of this.
|
|
3105
|
+
for (const moveplaneset of this.movePlaneSets) {
|
|
3206
3106
|
if (moveplaneset.length > 0) {
|
|
3207
3107
|
const dv = cm.dot(moveplaneset[0]);
|
|
3208
3108
|
let t = 0;
|
|
@@ -3222,22 +3122,22 @@ var PuzzleGeometry = class {
|
|
|
3222
3122
|
}
|
|
3223
3123
|
findface(cm) {
|
|
3224
3124
|
const key = this.keyface2(cm);
|
|
3225
|
-
const arr = this.
|
|
3125
|
+
const arr = this.faceListHash.get(key);
|
|
3226
3126
|
if (arr.length === 1) {
|
|
3227
3127
|
return arr[0];
|
|
3228
3128
|
}
|
|
3229
3129
|
for (let i = 0; i + 1 < arr.length; i++) {
|
|
3230
|
-
const face2 = this.
|
|
3231
|
-
if (Math.abs(cm.dist(this.
|
|
3130
|
+
const face2 = this.faceListHash.get(key)[i];
|
|
3131
|
+
if (Math.abs(cm.dist(this.faceCenterMass[face2])) < eps3) {
|
|
3232
3132
|
return face2;
|
|
3233
3133
|
}
|
|
3234
3134
|
}
|
|
3235
3135
|
return arr[arr.length - 1];
|
|
3236
3136
|
}
|
|
3237
3137
|
project2d(facen, edgen, targvec) {
|
|
3238
|
-
const face = this.
|
|
3138
|
+
const face = this.faceNames[facen][0];
|
|
3239
3139
|
const edgen2 = (edgen + 1) % face.length;
|
|
3240
|
-
const plane = this.
|
|
3140
|
+
const plane = this.basePlanes[facen];
|
|
3241
3141
|
let x0 = face[edgen2].sub(face[edgen]);
|
|
3242
3142
|
const olen = x0.len();
|
|
3243
3143
|
x0 = x0.normalize();
|
|
@@ -3269,17 +3169,17 @@ var PuzzleGeometry = class {
|
|
|
3269
3169
|
}
|
|
3270
3170
|
allstickers() {
|
|
3271
3171
|
const t1 = tstart("allstickers");
|
|
3272
|
-
this.faces = expandfaces(this.
|
|
3172
|
+
this.faces = expandfaces(this.basePlaneRotations, this.faces);
|
|
3273
3173
|
if (this.options.verbosity > 0) {
|
|
3274
3174
|
console.log(`# Total stickers is now ${this.faces.length}`);
|
|
3275
3175
|
}
|
|
3276
|
-
this.
|
|
3176
|
+
this.faceCenterMass = new Array(this.faces.length);
|
|
3277
3177
|
for (let i = 0; i < this.faces.length; i++) {
|
|
3278
|
-
this.
|
|
3178
|
+
this.faceCenterMass[i] = this.faces[i].centermass();
|
|
3279
3179
|
}
|
|
3280
3180
|
const moveplanesets = [];
|
|
3281
3181
|
const moveplanenormals = [];
|
|
3282
|
-
for (const q of this.
|
|
3182
|
+
for (const q of this.movePlanes) {
|
|
3283
3183
|
const qnormal = q.makenormal();
|
|
3284
3184
|
let wasseen = false;
|
|
3285
3185
|
for (const moveplanenormal of moveplanenormals) {
|
|
@@ -3292,7 +3192,7 @@ var PuzzleGeometry = class {
|
|
|
3292
3192
|
moveplanesets.push([]);
|
|
3293
3193
|
}
|
|
3294
3194
|
}
|
|
3295
|
-
for (const q of this.
|
|
3195
|
+
for (const q of this.movePlanesFiltered) {
|
|
3296
3196
|
const qnormal = q.makenormal();
|
|
3297
3197
|
for (let j = 0; j < moveplanenormals.length; j++) {
|
|
3298
3198
|
if (qnormal.sameplane(moveplanenormals[j])) {
|
|
@@ -3312,8 +3212,8 @@ var PuzzleGeometry = class {
|
|
|
3312
3212
|
q.sort((a, b) => a.a - b.a);
|
|
3313
3213
|
moveplanesets[i] = q;
|
|
3314
3214
|
}
|
|
3315
|
-
this.
|
|
3316
|
-
this.
|
|
3215
|
+
this.movePlaneSets = moveplanesets;
|
|
3216
|
+
this.movePlaneNormals = moveplanenormals;
|
|
3317
3217
|
const sizes = moveplanesets.map((_) => _.length);
|
|
3318
3218
|
if (this.options.verbosity > 0) {
|
|
3319
3219
|
console.log(`# Move plane sets: ${sizes}`);
|
|
@@ -3334,7 +3234,7 @@ var PuzzleGeometry = class {
|
|
|
3334
3234
|
}
|
|
3335
3235
|
}
|
|
3336
3236
|
}
|
|
3337
|
-
this.
|
|
3237
|
+
this.moveRotations = moverotations;
|
|
3338
3238
|
for (let i = 0; i < moverotations.length; i++) {
|
|
3339
3239
|
const r = moverotations[i];
|
|
3340
3240
|
const goodnormal = r[0].makenormal();
|
|
@@ -3356,7 +3256,7 @@ var PuzzleGeometry = class {
|
|
|
3356
3256
|
const p0 = moveplanenormals[i];
|
|
3357
3257
|
let neg = null;
|
|
3358
3258
|
let pos = null;
|
|
3359
|
-
for (const geonormal of this.
|
|
3259
|
+
for (const geonormal of this.geometryNormals) {
|
|
3360
3260
|
const d = p0.dot(geonormal[0]);
|
|
3361
3261
|
if (Math.abs(d - 1) < eps3) {
|
|
3362
3262
|
pos = [geonormal[1], geonormal[2]];
|
|
@@ -3433,7 +3333,7 @@ var PuzzleGeometry = class {
|
|
|
3433
3333
|
}
|
|
3434
3334
|
}
|
|
3435
3335
|
}
|
|
3436
|
-
this.
|
|
3336
|
+
this.faceListHash = facelisthash;
|
|
3437
3337
|
if (this.options.verbosity > 0) {
|
|
3438
3338
|
console.log(`# Cubies: ${facelisthash.size}`);
|
|
3439
3339
|
}
|
|
@@ -3470,12 +3370,12 @@ var PuzzleGeometry = class {
|
|
|
3470
3370
|
}
|
|
3471
3371
|
let bits = 0;
|
|
3472
3372
|
for (const f of facelist) {
|
|
3473
|
-
bits |= 1 << Math.floor(f / this.
|
|
3373
|
+
bits |= 1 << Math.floor(f / this.stickersPerFace);
|
|
3474
3374
|
}
|
|
3475
|
-
const markedface = this.
|
|
3375
|
+
const markedface = this.markedFaceLookup[bits];
|
|
3476
3376
|
let mini = -1;
|
|
3477
3377
|
for (let i = 0; i < facelist.length; i++) {
|
|
3478
|
-
if (Math.floor(facelist[i] / this.
|
|
3378
|
+
if (Math.floor(facelist[i] / this.stickersPerFace) === markedface) {
|
|
3479
3379
|
mini = i;
|
|
3480
3380
|
}
|
|
3481
3381
|
}
|
|
@@ -3497,8 +3397,8 @@ var PuzzleGeometry = class {
|
|
|
3497
3397
|
cubies.push(facelist);
|
|
3498
3398
|
}
|
|
3499
3399
|
this.cubies = cubies;
|
|
3500
|
-
this.
|
|
3501
|
-
this.
|
|
3400
|
+
this.faceToCubie = facetocubie;
|
|
3401
|
+
this.faceToCubieOrd = facetoord;
|
|
3502
3402
|
const typenames = ["?", "CENTERS", "EDGES", "CORNERS", "C4RNER", "C5RNER"];
|
|
3503
3403
|
const cubiesetnames = [];
|
|
3504
3404
|
const cubietypecounts = [0, 0, 0, 0, 0, 0];
|
|
@@ -3548,9 +3448,9 @@ var PuzzleGeometry = class {
|
|
|
3548
3448
|
cubiesetcubies[cubiesetnum].push(cind);
|
|
3549
3449
|
cubieordnums[cind] = cubieords[cubiesetnum]++;
|
|
3550
3450
|
if (queue.length < this.rotations.length) {
|
|
3551
|
-
const cm = this.
|
|
3451
|
+
const cm = this.faceCenterMass[cubies[cind][0]];
|
|
3552
3452
|
for (const moverotation of moverotations) {
|
|
3553
|
-
const tq = this.
|
|
3453
|
+
const tq = this.faceToCubie[this.findface(cm.rotatepoint(moverotation[0]))];
|
|
3554
3454
|
if (!seen[tq]) {
|
|
3555
3455
|
queue.push(tq);
|
|
3556
3456
|
seen[tq] = true;
|
|
@@ -3560,7 +3460,7 @@ var PuzzleGeometry = class {
|
|
|
3560
3460
|
}
|
|
3561
3461
|
cubiesetnum++;
|
|
3562
3462
|
}
|
|
3563
|
-
if (this.setReidOrSpeffzOrder && 4 <= this.
|
|
3463
|
+
if (this.setReidOrSpeffzOrder && 4 <= this.stickersPerFace) {
|
|
3564
3464
|
const reidorder = [
|
|
3565
3465
|
[
|
|
3566
3466
|
"UF",
|
|
@@ -3633,8 +3533,8 @@ var PuzzleGeometry = class {
|
|
|
3633
3533
|
-1,
|
|
3634
3534
|
-1
|
|
3635
3535
|
];
|
|
3636
|
-
if (this.
|
|
3637
|
-
for (const vertex of this.
|
|
3536
|
+
if (this.stickersPerFace > 9) {
|
|
3537
|
+
for (const vertex of this.vertexNames) {
|
|
3638
3538
|
cornerloc[this.upperStringToBitSet(vertex[1])] = vertex[0];
|
|
3639
3539
|
}
|
|
3640
3540
|
for (let i = 0; i < 6; i++) {
|
|
@@ -3646,10 +3546,10 @@ var PuzzleGeometry = class {
|
|
|
3646
3546
|
}
|
|
3647
3547
|
for (const cubieset of cubiesetcubies) {
|
|
3648
3548
|
for (const cubienum of cubieset) {
|
|
3649
|
-
if (cubies[cubienum].length === 3 || this.
|
|
3549
|
+
if (cubies[cubienum].length === 3 || this.stickersPerFace <= 9) {
|
|
3650
3550
|
let mask = 0;
|
|
3651
3551
|
for (const cubie of cubies[cubienum]) {
|
|
3652
|
-
mask |= 1 << this.
|
|
3552
|
+
mask |= 1 << this.faceNames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
|
|
3653
3553
|
}
|
|
3654
3554
|
cubieordnums[cubienum] = reidmap[mask];
|
|
3655
3555
|
} else {
|
|
@@ -3657,7 +3557,7 @@ var PuzzleGeometry = class {
|
|
|
3657
3557
|
const ordset = [];
|
|
3658
3558
|
for (let k = 0; k < cubies[cubienum].length; k++) {
|
|
3659
3559
|
const sticker = cubies[cubienum][k];
|
|
3660
|
-
const facekey = spefffacelookup[this.
|
|
3560
|
+
const facekey = spefffacelookup[this.faceNames[this.getfaceindex(sticker)][1]];
|
|
3661
3561
|
let bestdist = 1e20;
|
|
3662
3562
|
const cubieloc = this.faces[sticker].centermass();
|
|
3663
3563
|
let bestmask = 0;
|
|
@@ -3706,13 +3606,13 @@ var PuzzleGeometry = class {
|
|
|
3706
3606
|
}
|
|
3707
3607
|
}
|
|
3708
3608
|
}
|
|
3709
|
-
this.
|
|
3710
|
-
this.
|
|
3711
|
-
this.
|
|
3712
|
-
this.
|
|
3713
|
-
this.
|
|
3714
|
-
this.
|
|
3715
|
-
this.
|
|
3609
|
+
this.cubieSetNums = cubiesetnums;
|
|
3610
|
+
this.cubieOrdNums = cubieordnums;
|
|
3611
|
+
this.cubieSetNames = cubiesetnames;
|
|
3612
|
+
this.cubieOrbitSizes = cubieords;
|
|
3613
|
+
this.orbitOrientations = orbitoris;
|
|
3614
|
+
this.cubieValueMap = cubievaluemap;
|
|
3615
|
+
this.cubieSetCubies = cubiesetcubies;
|
|
3716
3616
|
if (this.options.fixedPieceType !== null) {
|
|
3717
3617
|
for (let i = 0; i < cubies.length; i++) {
|
|
3718
3618
|
if (this.options.fixedPieceType === "v" && cubies[i].length > 2 || this.options.fixedPieceType === "e" && cubies[i].length === 2 || this.options.fixedPieceType === "f" && cubies[i].length === 1) {
|
|
@@ -3747,8 +3647,8 @@ var PuzzleGeometry = class {
|
|
|
3747
3647
|
throw Error(`Bad move passed ${mv}`);
|
|
3748
3648
|
}
|
|
3749
3649
|
const grip = p[4];
|
|
3750
|
-
let loslice
|
|
3751
|
-
let hislice
|
|
3650
|
+
let loslice;
|
|
3651
|
+
let hislice;
|
|
3752
3652
|
if (p[2] !== void 0) {
|
|
3753
3653
|
if (p[3] === void 0) {
|
|
3754
3654
|
throw Error("Missing second number in range");
|
|
@@ -3829,16 +3729,17 @@ var PuzzleGeometry = class {
|
|
|
3829
3729
|
}
|
|
3830
3730
|
loslice--;
|
|
3831
3731
|
hislice--;
|
|
3732
|
+
const movePlaneSets = this.movePlaneSets;
|
|
3832
3733
|
if (fullrotation) {
|
|
3833
3734
|
loslice = 0;
|
|
3834
|
-
hislice =
|
|
3735
|
+
hislice = movePlaneSets[msi].length;
|
|
3835
3736
|
}
|
|
3836
|
-
if (loslice < 0 || loslice >
|
|
3737
|
+
if (loslice < 0 || loslice > movePlaneSets[msi].length || hislice < 0 || hislice > movePlaneSets[msi].length) {
|
|
3837
3738
|
throw Error(
|
|
3838
|
-
`Bad slice spec ${loslice} ${hislice} vs ${
|
|
3739
|
+
`Bad slice spec ${loslice} ${hislice} vs ${movePlaneSets[msi].length}`
|
|
3839
3740
|
);
|
|
3840
3741
|
}
|
|
3841
|
-
if (!permissivieMoveParsing && loslice === 0 && hislice ===
|
|
3742
|
+
if (!permissivieMoveParsing && loslice === 0 && hislice === movePlaneSets[msi].length && !fullrotation) {
|
|
3842
3743
|
throw Error("! full puzzle rotations must be specified with v suffix.");
|
|
3843
3744
|
}
|
|
3844
3745
|
return [void 0, msi, loslice, hislice, firstgrip, move.amount];
|
|
@@ -3850,7 +3751,7 @@ var PuzzleGeometry = class {
|
|
|
3850
3751
|
}
|
|
3851
3752
|
genperms() {
|
|
3852
3753
|
const t1 = tstart("genperms");
|
|
3853
|
-
if (this.
|
|
3754
|
+
if (this.cmovesBySlice.length > 0) {
|
|
3854
3755
|
return;
|
|
3855
3756
|
}
|
|
3856
3757
|
const cmovesbyslice = [];
|
|
@@ -3859,11 +3760,11 @@ var PuzzleGeometry = class {
|
|
|
3859
3760
|
if (this.cubies[k].length === 1) {
|
|
3860
3761
|
const kk = this.cubies[k][0];
|
|
3861
3762
|
const i = this.getfaceindex(kk);
|
|
3862
|
-
const center = this.
|
|
3863
|
-
if (center.dist(this.
|
|
3763
|
+
const center = this.baseFaces[i].centermass();
|
|
3764
|
+
if (center.dist(this.faceCenterMass[kk]) < eps3) {
|
|
3864
3765
|
const bits = 1 << i | 1 << this.baseFaceCount;
|
|
3865
|
-
const towards = this.
|
|
3866
|
-
const normal = this.
|
|
3766
|
+
const towards = this.markedFaceLookup[bits];
|
|
3767
|
+
const normal = this.basePlanes[towards].makenormal();
|
|
3867
3768
|
let hiv = -1;
|
|
3868
3769
|
let hii = -1;
|
|
3869
3770
|
for (let ii = 0; ii < this.faces[kk].length; ii++) {
|
|
@@ -3885,19 +3786,19 @@ var PuzzleGeometry = class {
|
|
|
3885
3786
|
}
|
|
3886
3787
|
this.faces[kk] = new Face(qs);
|
|
3887
3788
|
}
|
|
3888
|
-
const o = this.
|
|
3789
|
+
const o = this.baseFaces[i].length;
|
|
3889
3790
|
for (let m = 1; m < o; m++) {
|
|
3890
3791
|
this.cubies[k].push(this.cubies[k][m - 1]);
|
|
3891
3792
|
}
|
|
3892
3793
|
this.duplicatedFaces[kk] = o;
|
|
3893
3794
|
this.duplicatedCubies[k] = o;
|
|
3894
|
-
this.
|
|
3795
|
+
this.orbitOrientations[this.cubieSetNums[k]] = o;
|
|
3895
3796
|
}
|
|
3896
3797
|
}
|
|
3897
3798
|
}
|
|
3898
3799
|
}
|
|
3899
|
-
for (let k = 0; k < this.
|
|
3900
|
-
const moveplaneset = this.
|
|
3800
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
3801
|
+
const moveplaneset = this.movePlaneSets[k];
|
|
3901
3802
|
const slicenum = [];
|
|
3902
3803
|
const slicecnts = [moveplaneset.length + 1, 0];
|
|
3903
3804
|
let bhi = 1;
|
|
@@ -3907,7 +3808,7 @@ var PuzzleGeometry = class {
|
|
|
3907
3808
|
for (let i = 0; i < this.faces.length; i++) {
|
|
3908
3809
|
let t = 0;
|
|
3909
3810
|
if (moveplaneset.length > 0) {
|
|
3910
|
-
const dv = this.
|
|
3811
|
+
const dv = this.faceCenterMass[i].dot(moveplaneset[0]);
|
|
3911
3812
|
for (let b = bhi; b > 0; b >>= 1) {
|
|
3912
3813
|
if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
|
|
3913
3814
|
t += b;
|
|
@@ -3930,25 +3831,28 @@ var PuzzleGeometry = class {
|
|
|
3930
3831
|
if (slicenum[i] < 0) {
|
|
3931
3832
|
continue;
|
|
3932
3833
|
}
|
|
3933
|
-
const b = [this.
|
|
3934
|
-
let cm = this.
|
|
3834
|
+
const b = [this.faceToCubie[i], this.faceToCubieOrd[i]];
|
|
3835
|
+
let cm = this.faceCenterMass[i];
|
|
3935
3836
|
const ocm = cm;
|
|
3936
3837
|
let fi2 = i;
|
|
3937
3838
|
const sc = slicenum[fi2];
|
|
3938
3839
|
for (; ; ) {
|
|
3939
3840
|
slicenum[fi2] = -1;
|
|
3940
|
-
const cm2 = cm.rotatepoint(this.
|
|
3841
|
+
const cm2 = cm.rotatepoint(this.moveRotations[k][0]);
|
|
3941
3842
|
if (cm2.dist(ocm) < eps3) {
|
|
3942
3843
|
break;
|
|
3943
3844
|
}
|
|
3944
3845
|
fi2 = this.findface(cm2);
|
|
3945
|
-
b.push(this.
|
|
3846
|
+
b.push(this.faceToCubie[fi2], this.faceToCubieOrd[fi2]);
|
|
3946
3847
|
cm = cm2;
|
|
3947
3848
|
}
|
|
3948
3849
|
if (b.length > 2 && this.options.orientCenters && (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)) {
|
|
3949
|
-
if (
|
|
3950
|
-
|
|
3951
|
-
|
|
3850
|
+
if (
|
|
3851
|
+
// TODO: refactor to avoid non-null-assertion
|
|
3852
|
+
this.faceCenterMass[i].dist(
|
|
3853
|
+
this.baseFaces[this.getfaceindex(i)].centermass()
|
|
3854
|
+
) < eps3
|
|
3855
|
+
) {
|
|
3952
3856
|
let face1 = this.faces[this.cubies[b[0]][0]];
|
|
3953
3857
|
for (let ii = 0; ii < b.length; ii += 2) {
|
|
3954
3858
|
const face0 = this.faces[this.cubies[b[ii]][0]];
|
|
@@ -3965,13 +3869,13 @@ var PuzzleGeometry = class {
|
|
|
3965
3869
|
);
|
|
3966
3870
|
} else {
|
|
3967
3871
|
b[ii + 1] = o;
|
|
3968
|
-
face1 = face1.rotate(this.
|
|
3872
|
+
face1 = face1.rotate(this.moveRotations[k][0]);
|
|
3969
3873
|
}
|
|
3970
3874
|
}
|
|
3971
3875
|
}
|
|
3972
3876
|
}
|
|
3973
3877
|
if (b.length === 2 && this.options.orientCenters) {
|
|
3974
|
-
const dir = this.
|
|
3878
|
+
const dir = this.faceCenterMass[i].dot(this.movePlaneNormals[k]);
|
|
3975
3879
|
for (let ii = 1; ii < this.movesetorders[k]; ii++) {
|
|
3976
3880
|
if (dir > 0) {
|
|
3977
3881
|
b.push(b[0], ii);
|
|
@@ -3979,6 +3883,7 @@ var PuzzleGeometry = class {
|
|
|
3979
3883
|
b.push(
|
|
3980
3884
|
b[0],
|
|
3981
3885
|
(this.movesetorders[k] - ii) % this.movesetorders[k]
|
|
3886
|
+
// TODO: refactor to avoid non-null-assertion
|
|
3982
3887
|
);
|
|
3983
3888
|
}
|
|
3984
3889
|
}
|
|
@@ -4000,33 +3905,33 @@ var PuzzleGeometry = class {
|
|
|
4000
3905
|
}
|
|
4001
3906
|
cmovesbyslice.push(axiscmoves);
|
|
4002
3907
|
}
|
|
4003
|
-
this.
|
|
3908
|
+
this.cmovesBySlice = cmovesbyslice;
|
|
4004
3909
|
if (this.options.moveList) {
|
|
4005
3910
|
const parsedmovelist = [];
|
|
4006
3911
|
for (const moveString of this.options.moveList) {
|
|
4007
3912
|
parsedmovelist.push(this.parsemove(moveString));
|
|
4008
3913
|
}
|
|
4009
|
-
this.
|
|
3914
|
+
this.parsedMoveList = parsedmovelist;
|
|
4010
3915
|
}
|
|
4011
|
-
this.
|
|
4012
|
-
this.
|
|
3916
|
+
this.faceListHash.clear();
|
|
3917
|
+
this.faceCenterMass = [];
|
|
4013
3918
|
tend(t1);
|
|
4014
3919
|
}
|
|
4015
3920
|
getboundarygeometry() {
|
|
4016
3921
|
return {
|
|
4017
|
-
baseplanes: this.
|
|
4018
|
-
facenames: this.
|
|
4019
|
-
faceplanes: this.
|
|
4020
|
-
vertexnames: this.
|
|
4021
|
-
edgenames: this.
|
|
4022
|
-
geonormals: this.
|
|
3922
|
+
baseplanes: this.basePlanes,
|
|
3923
|
+
facenames: this.faceNames,
|
|
3924
|
+
faceplanes: this.facePlanes,
|
|
3925
|
+
vertexnames: this.vertexNames,
|
|
3926
|
+
edgenames: this.edgeNames,
|
|
3927
|
+
geonormals: this.geometryNormals
|
|
4023
3928
|
};
|
|
4024
3929
|
}
|
|
4025
3930
|
getmovesets(k) {
|
|
4026
|
-
const slices = this.
|
|
3931
|
+
const slices = this.movePlaneSets[k].length;
|
|
4027
3932
|
let r = [];
|
|
4028
|
-
if (this.
|
|
4029
|
-
for (const parsedmove of this.
|
|
3933
|
+
if (this.parsedMoveList !== void 0) {
|
|
3934
|
+
for (const parsedmove of this.parsedMoveList) {
|
|
4030
3935
|
if (parsedmove[1] !== k) {
|
|
4031
3936
|
continue;
|
|
4032
3937
|
}
|
|
@@ -4199,7 +4104,7 @@ ${comment}
|
|
|
4199
4104
|
const moveorbits = [];
|
|
4200
4105
|
const perms = [];
|
|
4201
4106
|
const oris = [];
|
|
4202
|
-
for (const len of this.
|
|
4107
|
+
for (const len of this.cubieOrbitSizes) {
|
|
4203
4108
|
perms.push(iota(len));
|
|
4204
4109
|
oris.push(zeros(len));
|
|
4205
4110
|
}
|
|
@@ -4207,9 +4112,9 @@ ${comment}
|
|
|
4207
4112
|
const slicecmoves = axiscmoves[m];
|
|
4208
4113
|
for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {
|
|
4209
4114
|
const mperm = slicecmoves.slice(j, j + 2 * movesetorder);
|
|
4210
|
-
const setnum = this.
|
|
4115
|
+
const setnum = this.cubieSetNums[mperm[0]];
|
|
4211
4116
|
for (let ii = 0; ii < mperm.length; ii += 2) {
|
|
4212
|
-
mperm[ii] = this.
|
|
4117
|
+
mperm[ii] = this.cubieOrdNums[mperm[ii]];
|
|
4213
4118
|
}
|
|
4214
4119
|
let inc = 2;
|
|
4215
4120
|
let oinc = 3;
|
|
@@ -4217,26 +4122,29 @@ ${comment}
|
|
|
4217
4122
|
inc = mperm.length - 2;
|
|
4218
4123
|
oinc = mperm.length - 1;
|
|
4219
4124
|
}
|
|
4220
|
-
if (perms[setnum] === iota(this.
|
|
4125
|
+
if (perms[setnum] === iota(this.cubieOrbitSizes[setnum])) {
|
|
4221
4126
|
perms[setnum] = perms[setnum].slice();
|
|
4222
|
-
if (this.
|
|
4127
|
+
if (this.orbitOrientations[setnum] > 1 && // TODO: refactor to avoid non-null-assertion
|
|
4128
|
+
!this.options.fixedOrientation) {
|
|
4223
4129
|
oris[setnum] = oris[setnum].slice();
|
|
4224
4130
|
}
|
|
4225
4131
|
}
|
|
4226
4132
|
for (let ii = 0; ii < mperm.length; ii += 2) {
|
|
4227
4133
|
perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];
|
|
4228
|
-
if (this.
|
|
4229
|
-
|
|
4134
|
+
if (this.orbitOrientations[setnum] > 1 && // TODO: refactor to avoid non-null-assertion
|
|
4135
|
+
!this.options.fixedOrientation) {
|
|
4136
|
+
oris[setnum][mperm[ii]] = (mperm[(ii + oinc) % mperm.length] - mperm[(ii + 1) % mperm.length] + 2 * this.orbitOrientations[setnum]) % // TODO: refactor to avoid non-null-assertion
|
|
4137
|
+
this.orbitOrientations[setnum];
|
|
4230
4138
|
}
|
|
4231
4139
|
}
|
|
4232
4140
|
}
|
|
4233
4141
|
}
|
|
4234
4142
|
let lastId = new PGOrbit(iota(24), zeros(24), 1);
|
|
4235
|
-
for (let ii = 0; ii < this.
|
|
4143
|
+
for (let ii = 0; ii < this.cubieSetNames.length; ii++) {
|
|
4236
4144
|
if (setmoves && !setmoves[ii]) {
|
|
4237
4145
|
continue;
|
|
4238
4146
|
}
|
|
4239
|
-
if (this.
|
|
4147
|
+
if (this.orbitOrientations[ii] === 1 || this.options.fixedOrientation) {
|
|
4240
4148
|
if (perms[ii] === iota(lastId.perm.length)) {
|
|
4241
4149
|
if (perms[ii] !== lastId.perm) {
|
|
4242
4150
|
lastId = new PGOrbit(perms[ii], oris[ii], 1);
|
|
@@ -4250,7 +4158,9 @@ ${comment}
|
|
|
4250
4158
|
for (let jj = 0; jj < perms[ii].length; jj++) {
|
|
4251
4159
|
no[jj] = oris[ii][perms[ii][jj]];
|
|
4252
4160
|
}
|
|
4253
|
-
moveorbits.push(
|
|
4161
|
+
moveorbits.push(
|
|
4162
|
+
new PGOrbit(perms[ii], no, this.orbitOrientations[ii])
|
|
4163
|
+
);
|
|
4254
4164
|
}
|
|
4255
4165
|
}
|
|
4256
4166
|
let mv = new PGTransform(moveorbits);
|
|
@@ -4291,7 +4201,7 @@ ${comment}
|
|
|
4291
4201
|
getOrbitsDef(fortwisty, includemoves = true) {
|
|
4292
4202
|
const setmoves = [];
|
|
4293
4203
|
if (fortwisty) {
|
|
4294
|
-
for (let i = 0; i < this.
|
|
4204
|
+
for (let i = 0; i < this.cubieSetNames.length; i++) {
|
|
4295
4205
|
setmoves.push(1);
|
|
4296
4206
|
}
|
|
4297
4207
|
}
|
|
@@ -4299,7 +4209,7 @@ ${comment}
|
|
|
4299
4209
|
const setdefs = [];
|
|
4300
4210
|
const mps = [];
|
|
4301
4211
|
const addrot = [];
|
|
4302
|
-
for (let k = 0; k < this.
|
|
4212
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4303
4213
|
const moveset = this.getmovesets(k);
|
|
4304
4214
|
mps.push(moveset);
|
|
4305
4215
|
if (this.options.addRotations) {
|
|
@@ -4309,8 +4219,8 @@ ${comment}
|
|
|
4309
4219
|
}
|
|
4310
4220
|
}
|
|
4311
4221
|
const hasrotation = [];
|
|
4312
|
-
for (let k = 0; k < this.
|
|
4313
|
-
const slices = this.
|
|
4222
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4223
|
+
const slices = this.movePlaneSets[k].length;
|
|
4314
4224
|
let sawone = false;
|
|
4315
4225
|
const moveset = mps[k];
|
|
4316
4226
|
for (let i = 0; i < moveset.length; i += 2) {
|
|
@@ -4321,28 +4231,28 @@ ${comment}
|
|
|
4321
4231
|
hasrotation[k] = sawone;
|
|
4322
4232
|
}
|
|
4323
4233
|
if (this.options.addRotations && (this.options.moveList || this.options.fixedPieceType !== null)) {
|
|
4324
|
-
for (let i = 0; i < this.
|
|
4234
|
+
for (let i = 0; i < this.moveRotations.length; i++) {
|
|
4325
4235
|
addrot[i] = 0;
|
|
4326
4236
|
}
|
|
4327
|
-
for (let k = 0; k < this.
|
|
4237
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4328
4238
|
if (hasrotation[k]) {
|
|
4329
4239
|
addrot[k] = 3;
|
|
4330
4240
|
continue;
|
|
4331
4241
|
}
|
|
4332
|
-
for (let i = 0; i < this.
|
|
4333
|
-
let nn = this.
|
|
4242
|
+
for (let i = 0; i < this.moveRotations.length; i++) {
|
|
4243
|
+
let nn = this.movePlaneNormals[k];
|
|
4334
4244
|
for (let ii = 1; ii * 2 <= this.movesetorders[i]; ii++) {
|
|
4335
|
-
nn = nn.rotatepoint(this.
|
|
4245
|
+
nn = nn.rotatepoint(this.moveRotations[i][0]);
|
|
4336
4246
|
if (addrot[i] & ii) {
|
|
4337
4247
|
continue;
|
|
4338
4248
|
}
|
|
4339
4249
|
let found = -1;
|
|
4340
4250
|
let neg = false;
|
|
4341
|
-
for (let j = 0; j < this.
|
|
4342
|
-
if (nn.dist(this.
|
|
4251
|
+
for (let j = 0; j < this.movePlaneNormals.length; j++) {
|
|
4252
|
+
if (nn.dist(this.movePlaneNormals[j]) < eps3) {
|
|
4343
4253
|
found = j;
|
|
4344
4254
|
break;
|
|
4345
|
-
} else if (nn.dist(this.
|
|
4255
|
+
} else if (nn.dist(this.movePlaneNormals[j].smul(-1)) < eps3) {
|
|
4346
4256
|
found = j;
|
|
4347
4257
|
neg = true;
|
|
4348
4258
|
break;
|
|
@@ -4352,10 +4262,13 @@ ${comment}
|
|
|
4352
4262
|
throw Error("Could not find rotation");
|
|
4353
4263
|
}
|
|
4354
4264
|
const cmp = mps[found];
|
|
4355
|
-
if (cmp.length !== mps[k].length || this.
|
|
4265
|
+
if (cmp.length !== mps[k].length || this.movePlaneSets[k].length !== // TODO
|
|
4266
|
+
this.movePlaneSets[found].length || // TODO
|
|
4267
|
+
this.diffmvsets(
|
|
4356
4268
|
cmp,
|
|
4357
4269
|
mps[k],
|
|
4358
|
-
this.
|
|
4270
|
+
this.movePlaneSets[found].length,
|
|
4271
|
+
// TODO
|
|
4359
4272
|
neg
|
|
4360
4273
|
)) {
|
|
4361
4274
|
addrot[i] |= ii;
|
|
@@ -4363,7 +4276,7 @@ ${comment}
|
|
|
4363
4276
|
}
|
|
4364
4277
|
}
|
|
4365
4278
|
}
|
|
4366
|
-
for (let i = 0; i < this.
|
|
4279
|
+
for (let i = 0; i < this.moveRotations.length; i++) {
|
|
4367
4280
|
if (addrot[i] === 0) {
|
|
4368
4281
|
addrot[i] = 1;
|
|
4369
4282
|
} else if (addrot[i] === 1) {
|
|
@@ -4379,13 +4292,13 @@ ${comment}
|
|
|
4379
4292
|
}
|
|
4380
4293
|
}
|
|
4381
4294
|
}
|
|
4382
|
-
for (let k = 0; k < this.
|
|
4295
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4383
4296
|
if (addrot[k] !== 0 && !hasrotation[k]) {
|
|
4384
|
-
mps[k].push([0, this.
|
|
4297
|
+
mps[k].push([0, this.movePlaneSets[k].length]);
|
|
4385
4298
|
mps[k].push(addrot[k]);
|
|
4386
4299
|
}
|
|
4387
4300
|
}
|
|
4388
|
-
for (let k = 0; k < this.
|
|
4301
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4389
4302
|
const moveset = mps[k];
|
|
4390
4303
|
const movesetorder = this.movesetorders[k];
|
|
4391
4304
|
for (let i = 0; i < moveset.length; i += 2) {
|
|
@@ -4401,7 +4314,7 @@ ${comment}
|
|
|
4401
4314
|
allbits[j] = 1;
|
|
4402
4315
|
}
|
|
4403
4316
|
}
|
|
4404
|
-
const axiscmoves = this.
|
|
4317
|
+
const axiscmoves = this.cmovesBySlice[k];
|
|
4405
4318
|
for (let i = 0; i < axiscmoves.length; i++) {
|
|
4406
4319
|
if (allbits[i] !== 1) {
|
|
4407
4320
|
continue;
|
|
@@ -4411,43 +4324,45 @@ ${comment}
|
|
|
4411
4324
|
if (this.skipcubie(slicecmoves[j])) {
|
|
4412
4325
|
continue;
|
|
4413
4326
|
}
|
|
4414
|
-
const ind = this.
|
|
4327
|
+
const ind = this.cubieSetNums[slicecmoves[j]];
|
|
4415
4328
|
setmoves[ind] = 1;
|
|
4416
4329
|
}
|
|
4417
4330
|
}
|
|
4418
4331
|
}
|
|
4419
|
-
for (let i = 0; i < this.
|
|
4332
|
+
for (let i = 0; i < this.cubieSetNames.length; i++) {
|
|
4420
4333
|
if (!setmoves[i]) {
|
|
4421
4334
|
continue;
|
|
4422
4335
|
}
|
|
4423
|
-
if (this.omitSet(this.
|
|
4336
|
+
if (this.omitSet(this.cubieSetNames[i])) {
|
|
4424
4337
|
setmoves[i] = 0;
|
|
4425
4338
|
continue;
|
|
4426
4339
|
}
|
|
4427
|
-
setnames.push(this.
|
|
4340
|
+
setnames.push(this.cubieSetNames[i]);
|
|
4428
4341
|
setdefs.push(
|
|
4429
4342
|
new PGOrbitDef(
|
|
4430
|
-
this.
|
|
4431
|
-
|
|
4343
|
+
this.cubieOrbitSizes[i],
|
|
4344
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4345
|
+
this.options.fixedOrientation ? 1 : this.orbitOrientations[i]
|
|
4346
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4432
4347
|
)
|
|
4433
4348
|
);
|
|
4434
4349
|
}
|
|
4435
4350
|
const solved = [];
|
|
4436
|
-
for (let i = 0; i < this.
|
|
4351
|
+
for (let i = 0; i < this.cubieSetNames.length; i++) {
|
|
4437
4352
|
if (!setmoves[i]) {
|
|
4438
4353
|
continue;
|
|
4439
4354
|
}
|
|
4440
|
-
if (this.omitSet(this.
|
|
4355
|
+
if (this.omitSet(this.cubieSetNames[i])) {
|
|
4441
4356
|
continue;
|
|
4442
4357
|
}
|
|
4443
|
-
const p = [];
|
|
4358
|
+
const p = Array(this.cubieOrbitSizes[i]).fill(-1);
|
|
4444
4359
|
const o = [];
|
|
4445
|
-
for (let j = 0; j < this.
|
|
4360
|
+
for (let j = 0; j < this.cubieOrbitSizes[i]; j++) {
|
|
4446
4361
|
if (fortwisty) {
|
|
4447
|
-
p
|
|
4362
|
+
p[j] = j;
|
|
4448
4363
|
} else {
|
|
4449
|
-
const cubie = this.
|
|
4450
|
-
p.
|
|
4364
|
+
const cubie = this.cubieSetCubies[i][j];
|
|
4365
|
+
p[this.cubieOrdNums[cubie]] = this.cubieValueMap[cubie];
|
|
4451
4366
|
}
|
|
4452
4367
|
o.push(0);
|
|
4453
4368
|
}
|
|
@@ -4455,7 +4370,8 @@ ${comment}
|
|
|
4455
4370
|
new PGOrbit(
|
|
4456
4371
|
p,
|
|
4457
4372
|
o,
|
|
4458
|
-
this.options.fixedOrientation ? 1 : this.
|
|
4373
|
+
this.options.fixedOrientation ? 1 : this.orbitOrientations[i]
|
|
4374
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4459
4375
|
)
|
|
4460
4376
|
);
|
|
4461
4377
|
}
|
|
@@ -4464,8 +4380,8 @@ ${comment}
|
|
|
4464
4380
|
const moves = [];
|
|
4465
4381
|
const isrots = [];
|
|
4466
4382
|
if (includemoves) {
|
|
4467
|
-
for (let k = 0; k < this.
|
|
4468
|
-
const moveplaneset = this.
|
|
4383
|
+
for (let k = 0; k < this.movePlaneSets.length; k++) {
|
|
4384
|
+
const moveplaneset = this.movePlaneSets[k];
|
|
4469
4385
|
const slices = moveplaneset.length;
|
|
4470
4386
|
const moveset = mps[k];
|
|
4471
4387
|
const movesetgeo = this.movesetgeos[k];
|
|
@@ -4473,8 +4389,8 @@ ${comment}
|
|
|
4473
4389
|
const movebits = moveset[i];
|
|
4474
4390
|
let nameoverride;
|
|
4475
4391
|
let inverted = false;
|
|
4476
|
-
if (this.
|
|
4477
|
-
for (const parsedmove of this.
|
|
4392
|
+
if (this.parsedMoveList !== void 0) {
|
|
4393
|
+
for (const parsedmove of this.parsedMoveList) {
|
|
4478
4394
|
if (parsedmove[1] !== k) {
|
|
4479
4395
|
continue;
|
|
4480
4396
|
}
|
|
@@ -4509,9 +4425,10 @@ ${comment}
|
|
|
4509
4425
|
movebits,
|
|
4510
4426
|
moveset[i + 1],
|
|
4511
4427
|
inverted,
|
|
4512
|
-
this.
|
|
4428
|
+
this.cmovesBySlice[k],
|
|
4513
4429
|
setmoves,
|
|
4514
4430
|
this.movesetorders[k]
|
|
4431
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4515
4432
|
);
|
|
4516
4433
|
moves.push(mv);
|
|
4517
4434
|
}
|
|
@@ -4547,7 +4464,7 @@ ${comment}
|
|
|
4547
4464
|
getsolved() {
|
|
4548
4465
|
const r = [];
|
|
4549
4466
|
for (let i = 0; i < this.baseFaceCount; i++) {
|
|
4550
|
-
for (let j = 0; j < this.
|
|
4467
|
+
for (let j = 0; j < this.stickersPerFace; j++) {
|
|
4551
4468
|
r.push(i);
|
|
4552
4469
|
}
|
|
4553
4470
|
}
|
|
@@ -4566,7 +4483,7 @@ ${comment}
|
|
|
4566
4483
|
let feature2 = null;
|
|
4567
4484
|
const feature1geoname = this.swizzler.unswizzle(feature1name);
|
|
4568
4485
|
const feature2geoname = this.swizzler.unswizzle(feature2name);
|
|
4569
|
-
for (const gn of this.
|
|
4486
|
+
for (const gn of this.geometryNormals) {
|
|
4570
4487
|
if (feature1geoname === gn[1]) {
|
|
4571
4488
|
feature1 = gn[0];
|
|
4572
4489
|
}
|
|
@@ -4670,7 +4587,7 @@ ${comment}
|
|
|
4670
4587
|
];
|
|
4671
4588
|
edges2[net[0][0]] = initv;
|
|
4672
4589
|
extendedges(edges2[net[0][0]], polyn);
|
|
4673
|
-
geos[this.
|
|
4590
|
+
geos[this.faceNames[0][1]] = this.project2d(0, 0, [
|
|
4674
4591
|
new Quat(0, initv[0][0], initv[0][1], 0),
|
|
4675
4592
|
new Quat(0, initv[1][0], initv[1][1], 0)
|
|
4676
4593
|
]);
|
|
@@ -4706,7 +4623,7 @@ ${comment}
|
|
|
4706
4623
|
const mp = thisface[(caf0 + j) % polyn].sum(thisface[(caf0 + j + polyn - 1) % polyn]).smul(0.5);
|
|
4707
4624
|
const epi = findelement(bg.edgenames, mp);
|
|
4708
4625
|
const edgename = bg.edgenames[epi][1];
|
|
4709
|
-
const el = splitByFaceNames(edgename, this.
|
|
4626
|
+
const el = splitByFaceNames(edgename, this.faceNames);
|
|
4710
4627
|
const gf1 = el[f0 === el[0] ? 1 : 0];
|
|
4711
4628
|
let gf1i = -1;
|
|
4712
4629
|
for (let k = 0; k < bg.facenames.length; k++) {
|
|
@@ -4751,13 +4668,13 @@ ${comment}
|
|
|
4751
4668
|
if (threed) {
|
|
4752
4669
|
q = q.rotatepoint(rot);
|
|
4753
4670
|
const xoff2 = 0.5 * trim + 0.25 * w;
|
|
4754
|
-
const xmul = this.
|
|
4671
|
+
const xmul = this.basePlanes[fn].rotateplane(rot).d < 0 ? 1 : -1;
|
|
4755
4672
|
return [
|
|
4756
4673
|
trim + w * 0.5 + xmul * (xoff2 - q.b * sc2),
|
|
4757
4674
|
trim + h * 0.5 + q.c * sc2
|
|
4758
4675
|
];
|
|
4759
4676
|
} else {
|
|
4760
|
-
const g = geos[this.
|
|
4677
|
+
const g = geos[this.faceNames[fn][1]];
|
|
4761
4678
|
return [
|
|
4762
4679
|
trim + twodshrink * q.dot(g[0]) + g[2].b,
|
|
4763
4680
|
trim + h - twodshrink * q.dot(g[1]) - g[2].c
|
|
@@ -4776,11 +4693,11 @@ ${comment}
|
|
|
4776
4693
|
const colormap = [];
|
|
4777
4694
|
const facegeo = [];
|
|
4778
4695
|
for (let i = 0; i < this.baseFaceCount; i++) {
|
|
4779
|
-
colormap[i] = this.colors[this.
|
|
4696
|
+
colormap[i] = this.colors[this.faceNames[i][1]];
|
|
4780
4697
|
}
|
|
4781
4698
|
for (let i = 0; i < this.faces.length; i++) {
|
|
4782
4699
|
const face = this.faces[i];
|
|
4783
|
-
const facenum = Math.floor(i / this.
|
|
4700
|
+
const facenum = Math.floor(i / this.stickersPerFace);
|
|
4784
4701
|
const fg = [];
|
|
4785
4702
|
for (let j = 0; j < face.length; j++) {
|
|
4786
4703
|
fg.push(mappt2d(facenum, face.get(j)));
|
|
@@ -4790,20 +4707,20 @@ ${comment}
|
|
|
4790
4707
|
const svg = [];
|
|
4791
4708
|
for (let j = 0; j < this.baseFaceCount; j++) {
|
|
4792
4709
|
svg.push("<g>");
|
|
4793
|
-
svg.push(`<title>${this.
|
|
4710
|
+
svg.push(`<title>${this.faceNames[j][1]}</title>
|
|
4794
4711
|
`);
|
|
4795
|
-
for (let ii = 0; ii < this.
|
|
4796
|
-
const i = j * this.
|
|
4797
|
-
const cubie = this.
|
|
4798
|
-
const cubieori = this.
|
|
4799
|
-
const cubiesetnum = this.
|
|
4800
|
-
const cubieord = this.
|
|
4712
|
+
for (let ii = 0; ii < this.stickersPerFace; ii++) {
|
|
4713
|
+
const i = j * this.stickersPerFace + ii;
|
|
4714
|
+
const cubie = this.faceToCubie[i];
|
|
4715
|
+
const cubieori = this.faceToCubieOrd[i];
|
|
4716
|
+
const cubiesetnum = this.cubieSetNums[cubie];
|
|
4717
|
+
const cubieord = this.cubieOrdNums[cubie];
|
|
4801
4718
|
const color = this.graybyori(cubie) ? "#808080" : colormap[pos.p[i]];
|
|
4802
|
-
let id = `${this.
|
|
4719
|
+
let id = `${this.cubieSetNames[cubiesetnum]}-l${cubieord}-o${cubieori}`;
|
|
4803
4720
|
svg.push(drawedges(id, facegeo[i], color));
|
|
4804
4721
|
if (this.duplicatedFaces[i]) {
|
|
4805
4722
|
for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
|
|
4806
|
-
id = `${this.
|
|
4723
|
+
id = `${this.cubieSetNames[cubiesetnum]}-l${cubieord}-o${jj}`;
|
|
4807
4724
|
svg.push(drawedges(id, facegeo[i], color));
|
|
4808
4725
|
}
|
|
4809
4726
|
}
|
|
@@ -4825,19 +4742,19 @@ ${svg.join(
|
|
|
4825
4742
|
const stickers = [];
|
|
4826
4743
|
const rot = this.getInitial3DRotation();
|
|
4827
4744
|
const faces = [];
|
|
4828
|
-
const maxdist = 0.52 * this.
|
|
4829
|
-
for (let i = 0; i < this.
|
|
4830
|
-
const coords = this.
|
|
4831
|
-
const name = this.
|
|
4745
|
+
const maxdist = 0.52 * this.baseFaces[0].get(0).len();
|
|
4746
|
+
for (let i = 0; i < this.baseFaces.length; i++) {
|
|
4747
|
+
const coords = this.baseFaces[i].rotate(rot);
|
|
4748
|
+
const name = this.faceNames[i][1];
|
|
4832
4749
|
faces.push({ coords: toFaceCoords(coords, maxdist), name });
|
|
4833
4750
|
}
|
|
4834
4751
|
for (let i = 0; i < this.faces.length; i++) {
|
|
4835
|
-
const facenum = Math.floor(i / this.
|
|
4836
|
-
const cubie = this.
|
|
4837
|
-
const cubieori = this.
|
|
4838
|
-
const cubiesetnum = this.
|
|
4839
|
-
const cubieord = this.
|
|
4840
|
-
let color = this.graybyori(cubie) ? options?.darkIgnoredOrbits ? "#222222" : "#808080" : this.colors[this.
|
|
4752
|
+
const facenum = Math.floor(i / this.stickersPerFace);
|
|
4753
|
+
const cubie = this.faceToCubie[i];
|
|
4754
|
+
const cubieori = this.faceToCubieOrd[i];
|
|
4755
|
+
const cubiesetnum = this.cubieSetNums[cubie];
|
|
4756
|
+
const cubieord = this.cubieOrdNums[cubie];
|
|
4757
|
+
let color = this.graybyori(cubie) ? options?.darkIgnoredOrbits ? "#222222" : "#808080" : this.colors[this.faceNames[facenum][1]];
|
|
4841
4758
|
if (options?.stickerColors) {
|
|
4842
4759
|
color = options.stickerColors[i];
|
|
4843
4760
|
}
|
|
@@ -4845,7 +4762,8 @@ ${svg.join(
|
|
|
4845
4762
|
stickers.push({
|
|
4846
4763
|
coords: toFaceCoords(coords, maxdist),
|
|
4847
4764
|
color,
|
|
4848
|
-
orbit: this.
|
|
4765
|
+
orbit: this.cubieSetNames[cubiesetnum],
|
|
4766
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4849
4767
|
ord: cubieord,
|
|
4850
4768
|
ori: cubieori,
|
|
4851
4769
|
face: facenum
|
|
@@ -4860,7 +4778,8 @@ ${svg.join(
|
|
|
4860
4778
|
stickers.push({
|
|
4861
4779
|
coords: toFaceCoords(fcoords, maxdist),
|
|
4862
4780
|
color,
|
|
4863
|
-
orbit: this.
|
|
4781
|
+
orbit: this.cubieSetNames[cubiesetnum],
|
|
4782
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4864
4783
|
ord: cubieord,
|
|
4865
4784
|
ori: jj,
|
|
4866
4785
|
face: facenum,
|
|
@@ -4873,7 +4792,7 @@ ${svg.join(
|
|
|
4873
4792
|
for (let i = 0; i < this.movesetgeos.length; i++) {
|
|
4874
4793
|
const msg = this.movesetgeos[i];
|
|
4875
4794
|
const order = this.movesetorders[i];
|
|
4876
|
-
for (const gn of this.
|
|
4795
|
+
for (const gn of this.geometryNormals) {
|
|
4877
4796
|
if (msg[0] === gn[1] && msg[1] === gn[2]) {
|
|
4878
4797
|
grips.push({
|
|
4879
4798
|
coordinates: toCoords(gn[0].rotatepoint(rot), 1),
|
|
@@ -4922,7 +4841,7 @@ ${svg.join(
|
|
|
4922
4841
|
getGeoNormal(geoname) {
|
|
4923
4842
|
const rot = this.getInitial3DRotation();
|
|
4924
4843
|
const grip = this.swizzler.unswizzle(geoname);
|
|
4925
|
-
for (const gn of this.
|
|
4844
|
+
for (const gn of this.geometryNormals) {
|
|
4926
4845
|
if (grip === gn[1]) {
|
|
4927
4846
|
const r = toCoords(gn[0].rotatepoint(rot), 1);
|
|
4928
4847
|
if (Math.abs(r[0]) < eps3 && Math.abs(r[2]) < eps3) {
|
|
@@ -4935,16 +4854,16 @@ ${svg.join(
|
|
|
4935
4854
|
return void 0;
|
|
4936
4855
|
}
|
|
4937
4856
|
getfaceindex(facenum) {
|
|
4938
|
-
const divid = this.
|
|
4857
|
+
const divid = this.stickersPerFace;
|
|
4939
4858
|
return Math.floor(facenum / divid);
|
|
4940
4859
|
}
|
|
4941
4860
|
textForTwizzleExplorer() {
|
|
4942
|
-
return `Faces ${this.
|
|
4943
|
-
Stickers per face ${this.
|
|
4944
|
-
Short edge ${this.
|
|
4861
|
+
return `Faces ${this.basePlaneRotations.length}
|
|
4862
|
+
Stickers per face ${this.stickersPerFace}
|
|
4863
|
+
Short edge ${this.shortestEdge}
|
|
4945
4864
|
Cubies ${this.cubies.length}
|
|
4946
|
-
Edge distance ${this.
|
|
4947
|
-
Vertex distance ${this.
|
|
4865
|
+
Edge distance ${this.edgeDistance}
|
|
4866
|
+
Vertex distance ${this.vertexDistance}`;
|
|
4948
4867
|
}
|
|
4949
4868
|
writeSchreierSims(tw) {
|
|
4950
4869
|
const os = this.getOrbitsDef(false);
|
|
@@ -4963,9 +4882,9 @@ var PGNotation = class {
|
|
|
4963
4882
|
orbitNames;
|
|
4964
4883
|
lookupMove(move) {
|
|
4965
4884
|
const mv = this.pg.parseMove(move);
|
|
4966
|
-
if (this.pg.
|
|
4885
|
+
if (this.pg.parsedMoveList) {
|
|
4967
4886
|
let found = false;
|
|
4968
|
-
for (const parsedmove of this.pg.
|
|
4887
|
+
for (const parsedmove of this.pg.parsedMoveList) {
|
|
4969
4888
|
if (parsedmove[1] === mv[1] && parsedmove[2] === mv[2] && parsedmove[3] === mv[3] && parsedmove[4] === mv[4]) {
|
|
4970
4889
|
found = true;
|
|
4971
4890
|
}
|
|
@@ -4976,16 +4895,17 @@ var PGNotation = class {
|
|
|
4976
4895
|
}
|
|
4977
4896
|
let bits = [mv[2], mv[3]];
|
|
4978
4897
|
if (!mv[4]) {
|
|
4979
|
-
const slices = this.pg.
|
|
4898
|
+
const slices = this.pg.movePlaneSets[mv[1]].length;
|
|
4980
4899
|
bits = [slices - mv[3], slices - mv[2]];
|
|
4981
4900
|
}
|
|
4982
4901
|
const pgmv = this.pg.getMoveFromBits(
|
|
4983
4902
|
bits,
|
|
4984
4903
|
mv[5],
|
|
4985
4904
|
!mv[4],
|
|
4986
|
-
this.pg.
|
|
4905
|
+
this.pg.cmovesBySlice[mv[1]],
|
|
4987
4906
|
void 0,
|
|
4988
4907
|
this.pg.movesetorders[mv[1]]
|
|
4908
|
+
// TODO: refactor to avoid non-null-assertion
|
|
4989
4909
|
);
|
|
4990
4910
|
const r = PGOrbitsDef.transformToKTransformationData(this.orbitNames, pgmv);
|
|
4991
4911
|
return r;
|
|
@@ -4994,6 +4914,104 @@ var PGNotation = class {
|
|
|
4994
4914
|
return remapKPuzzleDefinition(kpuzzleDefinition, this.pg.notationMapper);
|
|
4995
4915
|
}
|
|
4996
4916
|
};
|
|
4917
|
+
|
|
4918
|
+
// src/cubing/puzzle-geometry/Options.ts
|
|
4919
|
+
function parseOptions(argv) {
|
|
4920
|
+
let argp = 0;
|
|
4921
|
+
const options = {};
|
|
4922
|
+
while (argp < argv.length && argv[argp][0] === "-") {
|
|
4923
|
+
const option = argv[argp++];
|
|
4924
|
+
if (option === "--rotations") {
|
|
4925
|
+
options.addRotations = true;
|
|
4926
|
+
} else if (option === "--allmoves") {
|
|
4927
|
+
options.allMoves = true;
|
|
4928
|
+
} else if (option === "--outerblockmoves") {
|
|
4929
|
+
options.outerBlockMoves = true;
|
|
4930
|
+
} else if (option === "--vertexmoves") {
|
|
4931
|
+
options.vertexMoves = true;
|
|
4932
|
+
} else if (option === "--nocorners") {
|
|
4933
|
+
options.includeCornerOrbits = false;
|
|
4934
|
+
} else if (option === "--noedges") {
|
|
4935
|
+
options.includeEdgeOrbits = false;
|
|
4936
|
+
} else if (option === "--noorientation") {
|
|
4937
|
+
options.fixedOrientation = true;
|
|
4938
|
+
} else if (option === "--nocenters") {
|
|
4939
|
+
options.includeCenterOrbits = false;
|
|
4940
|
+
} else if (option === "--omit") {
|
|
4941
|
+
options.excludeOrbits = argv[argp].split(",");
|
|
4942
|
+
argp++;
|
|
4943
|
+
} else if (option === "--moves") {
|
|
4944
|
+
options.moveList = argv[argp].split(",");
|
|
4945
|
+
argp++;
|
|
4946
|
+
} else if (option === "--optimize") {
|
|
4947
|
+
options.optimizeOrbits = true;
|
|
4948
|
+
} else if (option === "--scramble") {
|
|
4949
|
+
options.scrambleAmount = 100;
|
|
4950
|
+
} else if (option === "--fixcorner") {
|
|
4951
|
+
options.fixedPieceType = "v";
|
|
4952
|
+
} else if (option === "--fixedge") {
|
|
4953
|
+
options.fixedPieceType = "e";
|
|
4954
|
+
} else if (option === "--fixcenter") {
|
|
4955
|
+
options.fixedPieceType = "f";
|
|
4956
|
+
} else if (option === "--orientcenters") {
|
|
4957
|
+
options.orientCenters = true;
|
|
4958
|
+
} else if (option === "--puzzleorientation") {
|
|
4959
|
+
options.puzzleOrientation = JSON.parse(argv[argp]);
|
|
4960
|
+
argp++;
|
|
4961
|
+
} else {
|
|
4962
|
+
throw new Error(`Bad option: ${option}`);
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
const puzzleDescription = parsePuzzleDescription(argv.slice(argp).join(" "));
|
|
4966
|
+
return { puzzleDescription, options };
|
|
4967
|
+
}
|
|
4968
|
+
var PuzzleGeometryFullOptions = class {
|
|
4969
|
+
verbosity = 0;
|
|
4970
|
+
// verbosity (console.log)
|
|
4971
|
+
allMoves = false;
|
|
4972
|
+
// generate all slice moves in ksolve
|
|
4973
|
+
outerBlockMoves = false;
|
|
4974
|
+
// generate outer block moves
|
|
4975
|
+
vertexMoves = false;
|
|
4976
|
+
// generate vertex moves
|
|
4977
|
+
addRotations = false;
|
|
4978
|
+
// add symmetry information to ksolve output
|
|
4979
|
+
moveList = null;
|
|
4980
|
+
// move list to generate
|
|
4981
|
+
fixedOrientation = false;
|
|
4982
|
+
// eliminate any orientations
|
|
4983
|
+
fixedPieceType = null;
|
|
4984
|
+
// fix a piece?
|
|
4985
|
+
orientCenters = false;
|
|
4986
|
+
// orient centers?
|
|
4987
|
+
// TODO: Group these into a single object?
|
|
4988
|
+
includeCornerOrbits = true;
|
|
4989
|
+
// include corner orbits
|
|
4990
|
+
includeCenterOrbits = true;
|
|
4991
|
+
// include center orbits
|
|
4992
|
+
includeEdgeOrbits = true;
|
|
4993
|
+
// include edge orbits
|
|
4994
|
+
// Overrides the previous options.
|
|
4995
|
+
excludeOrbits = [];
|
|
4996
|
+
// exclude these orbits
|
|
4997
|
+
optimizeOrbits = false;
|
|
4998
|
+
// optimize PermOri
|
|
4999
|
+
grayCorners = false;
|
|
5000
|
+
// make corner sets gray
|
|
5001
|
+
grayCenters = false;
|
|
5002
|
+
// make center sets gray
|
|
5003
|
+
grayEdges = false;
|
|
5004
|
+
// make edge sets gray
|
|
5005
|
+
puzzleOrientation = null;
|
|
5006
|
+
// single puzzle orientation from options
|
|
5007
|
+
puzzleOrientations = null;
|
|
5008
|
+
// puzzle orientation override object from options // TODO: is this needed?
|
|
5009
|
+
scrambleAmount = 0;
|
|
5010
|
+
// scramble?
|
|
5011
|
+
constructor(options = {}) {
|
|
5012
|
+
Object.assign(this, options);
|
|
5013
|
+
}
|
|
5014
|
+
};
|
|
4997
5015
|
export {
|
|
4998
5016
|
PUZZLE_BASE_SHAPES as EXPERIMENTAL_PUZZLE_BASE_SHAPES,
|
|
4999
5017
|
PUZZLE_CUT_TYPES as EXPERIMENTAL_PUZZLE_CUT_TYPES,
|