cubing 0.65.2 → 0.66.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/bin/chunks/{chunk-Z5QOJAME.js → chunk-HS7R54XN.js} +2 -2
- package/dist/bin/order.js +1 -1
- package/dist/bin/puzzle-geometry-bin.js +1 -1
- package/dist/bin/scramble.js +1 -1
- package/dist/bin/svg.js +1 -1
- package/dist/lib/cubing/alg/index.d.ts +1 -1
- package/dist/lib/cubing/alg/index.js +1 -2
- package/dist/lib/cubing/bluetooth/index.d.ts +2 -2
- package/dist/lib/cubing/bluetooth/index.js +5 -6
- package/dist/lib/cubing/chunks/{big-puzzle-orientation-7WHPJCCO.js → big-puzzle-orientation-KJL4OFV2.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-2IA2R7XV.js → chunk-6R47S6MP.js} +24 -25
- package/dist/lib/cubing/chunks/{chunk-YSAQ6DRT.js → chunk-7LEVC3YR.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-7GUL3OBQ.js → chunk-BHVTDDUY.js} +0 -1
- package/dist/lib/cubing/chunks/{chunk-5FXQPBXH.js → chunk-IIJFVP3K.js} +6 -7
- package/dist/lib/cubing/chunks/{chunk-IRY6MBI2.js → chunk-KH2MQ7KY.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-BQPY6252.js → chunk-LBER75W4.js} +1 -2
- package/dist/lib/cubing/chunks/{chunk-MFKLAFPQ.js → chunk-NJ66FRKF.js} +3 -4
- package/dist/lib/cubing/chunks/{chunk-2BVL5OQE.js → chunk-QOLD6GH2.js} +5 -6
- package/dist/lib/cubing/chunks/{chunk-UP5VP7GL.js → chunk-QZK3M7IM.js} +0 -20
- package/dist/lib/cubing/chunks/chunk-RDKH6CDA.js +0 -0
- package/dist/lib/cubing/chunks/{chunk-6K433TB5.js → chunk-T5M3DY5P.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-MIHF623Z.js → chunk-UKAXYOG2.js} +2 -3
- package/dist/lib/cubing/chunks/{chunk-GHFBZYSV.js → chunk-YJH5LHFN.js} +0 -1
- package/dist/lib/cubing/chunks/{inside-N5WSMI7I.js → inside-UWSZBO4Y.js} +14 -15
- package/dist/lib/cubing/chunks/{puzzles-dynamic-3x3x3-FYXD7SIU.js → puzzles-dynamic-3x3x3-CMH2HHH5.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-4x4x4-AIGABOAR.js → puzzles-dynamic-4x4x4-UFAQS3QG.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-megaminx-2LVHIDL4.js → puzzles-dynamic-megaminx-EFR4GQFA.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-653A7JCM.js → puzzles-dynamic-side-events-KF3PEOJN.js} +0 -1
- package/dist/lib/cubing/chunks/{puzzles-dynamic-unofficial-2CY6GVZ4.js → puzzles-dynamic-unofficial-6BF3EWTI.js} +0 -1
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-5EIXNDVI.js → search-dynamic-sgs-side-events-5GQDHSJR.js} +5 -6
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-Y7SIOVIX.js → search-dynamic-sgs-unofficial-YM23KVCN.js} +90 -78
- package/dist/lib/cubing/chunks/{search-dynamic-solve-3x3x3-B2L4IN34.js → search-dynamic-solve-3x3x3-6UMZH4WB.js} +3 -6
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-FRAX3IPQ.js → search-dynamic-solve-4x4x4-KNSBAM7Q.js} +14 -17
- package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-TI4TFL6X.js → search-dynamic-solve-fto-CSXJYISF.js} +200 -90
- package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-UKFT6I42.js → search-dynamic-solve-kilominx-EHAUQJXS.js} +105 -113
- package/dist/lib/cubing/chunks/{search-dynamic-solve-master_tetraminx-GIS7T5B7.js → search-dynamic-solve-master_tetraminx-ZQ25QK7E.js} +99 -100
- package/dist/lib/cubing/chunks/search-worker-entry.js +2 -3
- package/dist/lib/cubing/chunks/{twips-UCWWA2WI.js → twips-IMF5RNH5.js} +3 -4
- package/dist/lib/cubing/chunks/{twips_wasm_bg-TJNYGA2C-AP2O4LGG.js → twips_wasm_bg-TJNYGA2C-4JIZWC6Q.js} +1 -2
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-O5TGOSAO.js → twisty-dynamic-3d-HSYJR5CM.js} +5 -6
- package/dist/lib/cubing/{index-COSxNAgV.d.ts → index-lAUL_nRN.d.ts} +1 -1
- package/dist/lib/cubing/{index-BQdS3h4z.d.ts → index-nWspzjVK.d.ts} +43 -43
- package/dist/lib/cubing/kpuzzle/index.d.ts +1 -1
- package/dist/lib/cubing/kpuzzle/index.js +2 -3
- package/dist/lib/cubing/notation/index.d.ts +1 -1
- package/dist/lib/cubing/notation/index.js +4 -5
- package/dist/lib/cubing/{outside-BRtF0DA2.d.ts → outside-CD19aDjE.d.ts} +1 -1
- package/dist/lib/cubing/protocol/index.d.ts +1 -1
- package/dist/lib/cubing/protocol/index.js +4 -5
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +1 -1
- package/dist/lib/cubing/puzzle-geometry/index.js +375 -375
- package/dist/lib/cubing/puzzles/index.d.ts +1 -1
- package/dist/lib/cubing/puzzles/index.js +4 -5
- package/dist/lib/cubing/scramble/index.d.ts +1 -1
- package/dist/lib/cubing/scramble/index.js +8 -9
- package/dist/lib/cubing/search/index.d.ts +1 -1
- package/dist/lib/cubing/search/index.js +7 -8
- package/dist/lib/cubing/stream/index.d.ts +1 -1
- package/dist/lib/cubing/stream/index.js +1 -2
- package/dist/lib/cubing/twisty/index.d.ts +1 -1
- package/dist/lib/cubing/twisty/index.js +6 -7
- package/package.json +1 -1
- package/dist/lib/cubing/alg/index.js.map +0 -7
- package/dist/lib/cubing/bluetooth/index.js.map +0 -7
- package/dist/lib/cubing/chunks/big-puzzle-orientation-7WHPJCCO.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-2BVL5OQE.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-2IA2R7XV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-5FXQPBXH.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-6K433TB5.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-7GUL3OBQ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-BQPY6252.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-GHFBZYSV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-IRY6MBI2.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-MFKLAFPQ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-MIHF623Z.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-NAPITA3L.js +0 -1
- package/dist/lib/cubing/chunks/chunk-NAPITA3L.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-UP5VP7GL.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-YSAQ6DRT.js.map +0 -7
- package/dist/lib/cubing/chunks/inside-N5WSMI7I.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-3x3x3-FYXD7SIU.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-4x4x4-AIGABOAR.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-653A7JCM.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-unofficial-2CY6GVZ4.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-side-events-5EIXNDVI.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-Y7SIOVIX.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-B2L4IN34.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-FRAX3IPQ.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-fto-TI4TFL6X.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-kilominx-UKFT6I42.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-solve-master_tetraminx-GIS7T5B7.js.map +0 -7
- package/dist/lib/cubing/chunks/search-worker-entry.js.map +0 -7
- package/dist/lib/cubing/chunks/twips-UCWWA2WI.js.map +0 -7
- package/dist/lib/cubing/chunks/twips_wasm_bg-TJNYGA2C-AP2O4LGG.js.map +0 -7
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-O5TGOSAO.js.map +0 -7
- package/dist/lib/cubing/kpuzzle/index.js.map +0 -7
- package/dist/lib/cubing/notation/index.js.map +0 -7
- package/dist/lib/cubing/protocol/index.js.map +0 -7
- package/dist/lib/cubing/puzzle-geometry/index.js.map +0 -7
- package/dist/lib/cubing/puzzles/index.js.map +0 -7
- package/dist/lib/cubing/scramble/index.js.map +0 -7
- package/dist/lib/cubing/search/index.js.map +0 -7
- package/dist/lib/cubing/stream/index.js.map +0 -7
- package/dist/lib/cubing/twisty/index.js.map +0 -7
- /package/dist/bin/chunks/{chunk-Z5QOJAME.js.map → chunk-HS7R54XN.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-QZK3M7IM.js";
|
|
5
5
|
|
|
6
6
|
// src/cubing/puzzle-geometry/colors.ts
|
|
7
7
|
var PGColors = {
|
|
@@ -690,13 +690,13 @@ function remapKPuzzleDefinition(internalDefinition, notationMapper) {
|
|
|
690
690
|
if (!externalPrefix) {
|
|
691
691
|
continue;
|
|
692
692
|
}
|
|
693
|
-
const
|
|
694
|
-
if (!
|
|
693
|
+
const externalMoveName2 = externalPrefix + suffix;
|
|
694
|
+
if (!externalMoveName2) {
|
|
695
695
|
throw new Error(
|
|
696
696
|
`Missing external move name for: ${internalMoveName.toString()}`
|
|
697
697
|
);
|
|
698
698
|
}
|
|
699
|
-
externalDefinition.moves[
|
|
699
|
+
externalDefinition.moves[externalMoveName2.toString()] = transformationData;
|
|
700
700
|
}
|
|
701
701
|
return externalDefinition;
|
|
702
702
|
}
|
|
@@ -755,39 +755,25 @@ var PuzzleGeometryFullOptions = class {
|
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
757
|
|
|
758
|
-
// src/cubing/puzzle-geometry/
|
|
758
|
+
// src/cubing/puzzle-geometry/Permutation.ts
|
|
759
759
|
var zeroCache = [];
|
|
760
|
-
var
|
|
760
|
+
var rangeCache = [];
|
|
761
761
|
function zeros(n) {
|
|
762
|
-
|
|
763
|
-
const c = Array(n);
|
|
764
|
-
for (let i = 0; i < n; i++) {
|
|
765
|
-
c[i] = 0;
|
|
766
|
-
}
|
|
767
|
-
zeroCache[n] = c;
|
|
768
|
-
}
|
|
769
|
-
return zeroCache[n];
|
|
762
|
+
return zeroCache[n] ??= new Array(n).fill(0);
|
|
770
763
|
}
|
|
771
|
-
function
|
|
772
|
-
|
|
773
|
-
const c = Array(n);
|
|
774
|
-
for (let i = 0; i < n; i++) {
|
|
775
|
-
c[i] = i;
|
|
776
|
-
}
|
|
777
|
-
iotaCache[n] = c;
|
|
778
|
-
}
|
|
779
|
-
return iotaCache[n];
|
|
764
|
+
function range(n) {
|
|
765
|
+
return rangeCache[n] ??= zeros(n).map((_, i) => i);
|
|
780
766
|
}
|
|
781
767
|
function identity(n) {
|
|
782
|
-
return new
|
|
768
|
+
return new Permutation(range(n));
|
|
783
769
|
}
|
|
784
|
-
function factorial(
|
|
785
|
-
let
|
|
786
|
-
while (
|
|
787
|
-
|
|
788
|
-
|
|
770
|
+
function factorial(n) {
|
|
771
|
+
let output = BigInt(1);
|
|
772
|
+
while (n > 1) {
|
|
773
|
+
output *= BigInt(n);
|
|
774
|
+
n--;
|
|
789
775
|
}
|
|
790
|
-
return
|
|
776
|
+
return output;
|
|
791
777
|
}
|
|
792
778
|
function gcd(a, b) {
|
|
793
779
|
if (a > b) {
|
|
@@ -805,56 +791,56 @@ function gcd(a, b) {
|
|
|
805
791
|
function lcm(a, b) {
|
|
806
792
|
return a / gcd(a, b) * b;
|
|
807
793
|
}
|
|
808
|
-
var
|
|
809
|
-
|
|
810
|
-
// length
|
|
811
|
-
p;
|
|
794
|
+
var Permutation = class _Permutation {
|
|
795
|
+
permutation;
|
|
812
796
|
// The permutation itself
|
|
813
797
|
constructor(a) {
|
|
814
|
-
this.
|
|
815
|
-
|
|
798
|
+
this.permutation = a;
|
|
799
|
+
}
|
|
800
|
+
get length() {
|
|
801
|
+
return this.permutation.length;
|
|
816
802
|
}
|
|
817
803
|
toString() {
|
|
818
|
-
return `Perm[${this.
|
|
804
|
+
return `Perm[${this.permutation.join(" ")}]`;
|
|
819
805
|
}
|
|
820
|
-
|
|
821
|
-
const c = Array(this.
|
|
822
|
-
for (let i = 0; i < this.
|
|
823
|
-
c[i] = p2.
|
|
806
|
+
multiply(p2) {
|
|
807
|
+
const c = Array(this.length);
|
|
808
|
+
for (let i = 0; i < this.length; i++) {
|
|
809
|
+
c[i] = p2.permutation[this.permutation[i]];
|
|
824
810
|
}
|
|
825
|
-
return new
|
|
811
|
+
return new _Permutation(c);
|
|
826
812
|
}
|
|
827
|
-
|
|
828
|
-
const c = Array(this.
|
|
829
|
-
for (let i = 0; i < this.
|
|
830
|
-
c[i] = this.
|
|
813
|
+
rightMultiply(p2) {
|
|
814
|
+
const c = Array(this.length);
|
|
815
|
+
for (let i = 0; i < this.length; i++) {
|
|
816
|
+
c[i] = this.permutation[p2.permutation[i]];
|
|
831
817
|
}
|
|
832
|
-
return new
|
|
818
|
+
return new _Permutation(c);
|
|
833
819
|
}
|
|
834
|
-
|
|
835
|
-
const c = Array(this.
|
|
836
|
-
for (let i = 0; i < this.
|
|
837
|
-
c[this.
|
|
820
|
+
invert() {
|
|
821
|
+
const c = Array(this.length);
|
|
822
|
+
for (let i = 0; i < this.length; i++) {
|
|
823
|
+
c[this.permutation[i]] = i;
|
|
838
824
|
}
|
|
839
|
-
return new
|
|
825
|
+
return new _Permutation(c);
|
|
840
826
|
}
|
|
841
|
-
|
|
842
|
-
for (let i = 0; i < this.
|
|
843
|
-
if (this.
|
|
844
|
-
return this.
|
|
827
|
+
compare(p2) {
|
|
828
|
+
for (let i = 0; i < this.length; i++) {
|
|
829
|
+
if (this.permutation[i] !== p2.permutation[i]) {
|
|
830
|
+
return this.permutation[i] - p2.permutation[i];
|
|
845
831
|
}
|
|
846
832
|
}
|
|
847
833
|
return 0;
|
|
848
834
|
}
|
|
849
835
|
toGap() {
|
|
850
836
|
const cyc = [];
|
|
851
|
-
const seen = new Array(this.
|
|
852
|
-
for (let i = 0; i < this.
|
|
853
|
-
if (seen[i] || this.
|
|
837
|
+
const seen = new Array(this.length);
|
|
838
|
+
for (let i = 0; i < this.permutation.length; i++) {
|
|
839
|
+
if (seen[i] || this.permutation[i] === i) {
|
|
854
840
|
continue;
|
|
855
841
|
}
|
|
856
842
|
const incyc = [];
|
|
857
|
-
for (let j = this.
|
|
843
|
+
for (let j = this.permutation[i]; !seen[j]; j = this.permutation[j]) {
|
|
858
844
|
incyc.push(1 + j);
|
|
859
845
|
seen[j] = true;
|
|
860
846
|
}
|
|
@@ -864,13 +850,13 @@ var Perm = class _Perm {
|
|
|
864
850
|
}
|
|
865
851
|
toMathematica() {
|
|
866
852
|
const cyc = [];
|
|
867
|
-
const seen = new Array(this.
|
|
868
|
-
for (let i = 0; i < this.
|
|
869
|
-
if (seen[i] || this.
|
|
853
|
+
const seen = new Array(this.length);
|
|
854
|
+
for (let i = 0; i < this.permutation.length; i++) {
|
|
855
|
+
if (seen[i] || this.permutation[i] === i) {
|
|
870
856
|
continue;
|
|
871
857
|
}
|
|
872
858
|
const incyc = [];
|
|
873
|
-
for (let j = this.
|
|
859
|
+
for (let j = this.permutation[i]; !seen[j]; j = this.permutation[j]) {
|
|
874
860
|
incyc.push(1 + j);
|
|
875
861
|
seen[j] = true;
|
|
876
862
|
}
|
|
@@ -879,72 +865,72 @@ var Perm = class _Perm {
|
|
|
879
865
|
return `Cycles[{${cyc.join(",")}}]`;
|
|
880
866
|
}
|
|
881
867
|
order() {
|
|
882
|
-
let
|
|
883
|
-
const seen = new Array(this.
|
|
884
|
-
for (let i = 0; i < this.
|
|
885
|
-
if (seen[i] || this.
|
|
868
|
+
let output = 1;
|
|
869
|
+
const seen = new Array(this.length);
|
|
870
|
+
for (let i = 0; i < this.permutation.length; i++) {
|
|
871
|
+
if (seen[i] || this.permutation[i] === i) {
|
|
886
872
|
continue;
|
|
887
873
|
}
|
|
888
|
-
let
|
|
889
|
-
for (let j = i; !seen[j]; j = this.
|
|
890
|
-
|
|
874
|
+
let cycleLength = 0;
|
|
875
|
+
for (let j = i; !seen[j]; j = this.permutation[j]) {
|
|
876
|
+
cycleLength++;
|
|
891
877
|
seen[j] = true;
|
|
892
878
|
}
|
|
893
|
-
|
|
879
|
+
output = lcm(output, cycleLength);
|
|
894
880
|
}
|
|
895
|
-
return
|
|
881
|
+
return output;
|
|
896
882
|
}
|
|
897
883
|
};
|
|
898
884
|
|
|
899
|
-
// src/cubing/puzzle-geometry/
|
|
885
|
+
// src/cubing/puzzle-geometry/PGOrbit.ts
|
|
900
886
|
var PGOrbitDef = class {
|
|
901
|
-
|
|
902
|
-
|
|
887
|
+
numPieces;
|
|
888
|
+
numOrientations;
|
|
903
889
|
constructor(size, mod) {
|
|
904
|
-
this.
|
|
905
|
-
this.
|
|
890
|
+
this.numPieces = size;
|
|
891
|
+
this.numOrientations = mod;
|
|
906
892
|
}
|
|
907
893
|
reassemblySize() {
|
|
908
|
-
return factorial(this.
|
|
894
|
+
return factorial(this.numPieces) * BigInt(this.numOrientations) ** BigInt(this.numPieces);
|
|
909
895
|
}
|
|
910
896
|
};
|
|
911
897
|
var lastGlobalDefinitionCounter = 0;
|
|
912
|
-
function
|
|
913
|
-
const
|
|
914
|
-
const
|
|
915
|
-
if (
|
|
898
|
+
function externalMoveName(mapper, moveString) {
|
|
899
|
+
const internalMove = Move.fromString(moveString);
|
|
900
|
+
const externalMove = mapper.notationToExternal(internalMove);
|
|
901
|
+
if (externalMove === null || internalMove === externalMove) {
|
|
916
902
|
return moveString;
|
|
917
903
|
}
|
|
918
|
-
return
|
|
904
|
+
return externalMove.toString();
|
|
919
905
|
}
|
|
920
906
|
var PGOrbitsDef = class _PGOrbitsDef {
|
|
921
|
-
|
|
922
|
-
|
|
907
|
+
orbitNames;
|
|
908
|
+
orbitDefs;
|
|
923
909
|
solved;
|
|
924
|
-
|
|
925
|
-
|
|
910
|
+
moveNames;
|
|
911
|
+
moveOps;
|
|
926
912
|
isRotation;
|
|
927
|
-
|
|
928
|
-
constructor(
|
|
929
|
-
this.
|
|
930
|
-
this.
|
|
913
|
+
forceNames;
|
|
914
|
+
constructor(orbitNames, orbitDefs, solved, moveNames, moveOps, isRotation, forceNames) {
|
|
915
|
+
this.orbitNames = orbitNames;
|
|
916
|
+
this.orbitDefs = orbitDefs;
|
|
931
917
|
this.solved = solved;
|
|
932
|
-
this.
|
|
933
|
-
this.
|
|
918
|
+
this.moveNames = moveNames;
|
|
919
|
+
this.moveOps = moveOps;
|
|
934
920
|
this.isRotation = isRotation;
|
|
935
|
-
this.
|
|
921
|
+
this.forceNames = forceNames;
|
|
936
922
|
}
|
|
937
923
|
toKTransformationData(t) {
|
|
938
924
|
const ktransformationData = {};
|
|
939
|
-
for (let i = 0; i < this.
|
|
940
|
-
ktransformationData[this.
|
|
925
|
+
for (let i = 0; i < this.orbitNames.length; i++) {
|
|
926
|
+
ktransformationData[this.orbitNames[i]] = t.orbits[i].toKTransformationOrbitData();
|
|
941
927
|
}
|
|
942
928
|
return ktransformationData;
|
|
943
929
|
}
|
|
944
930
|
toKPatternData(t) {
|
|
945
931
|
const kpatternData = {};
|
|
946
|
-
for (let i = 0; i < this.
|
|
947
|
-
kpatternData[this.
|
|
932
|
+
for (let i = 0; i < this.orbitNames.length; i++) {
|
|
933
|
+
kpatternData[this.orbitNames[i]] = t.orbits[i].toKPatternOrbitData();
|
|
948
934
|
}
|
|
949
935
|
return kpatternData;
|
|
950
936
|
}
|
|
@@ -957,54 +943,54 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
957
943
|
return mp;
|
|
958
944
|
}
|
|
959
945
|
describeSet(s, r, mapper) {
|
|
960
|
-
const
|
|
961
|
-
const
|
|
962
|
-
for (let i = 0; i <
|
|
963
|
-
|
|
946
|
+
const { numPieces } = this.orbitDefs[s];
|
|
947
|
+
const moveNames = new Array(numPieces);
|
|
948
|
+
for (let i = 0; i < numPieces; i++) {
|
|
949
|
+
moveNames[i] = [];
|
|
964
950
|
}
|
|
965
|
-
for (let i = 0; i < this.
|
|
951
|
+
for (let i = 0; i < this.moveNames.length; i++) {
|
|
966
952
|
if (this.isRotation[i]) {
|
|
967
953
|
continue;
|
|
968
954
|
}
|
|
969
|
-
let
|
|
970
|
-
if (!this.
|
|
971
|
-
|
|
972
|
-
if (
|
|
973
|
-
|
|
955
|
+
let moveName = this.moveNames[i];
|
|
956
|
+
if (!this.forceNames[i]) {
|
|
957
|
+
moveName = externalMoveName(mapper, moveName);
|
|
958
|
+
if (moveName[moveName.length - 1] === "'") {
|
|
959
|
+
moveName = moveName.substring(0, moveName.length - 1);
|
|
974
960
|
}
|
|
975
961
|
}
|
|
976
|
-
const pd = this.
|
|
977
|
-
for (let j = 0; j <
|
|
978
|
-
if (pd.
|
|
979
|
-
|
|
962
|
+
const pd = this.moveOps[i].orbits[s];
|
|
963
|
+
for (let j = 0; j < numPieces; j++) {
|
|
964
|
+
if (pd.permutation[j] !== j || pd.orientationDelta[j] !== 0) {
|
|
965
|
+
moveNames[j].push(moveName);
|
|
980
966
|
}
|
|
981
967
|
}
|
|
982
968
|
}
|
|
983
|
-
for (let j = 0; j <
|
|
984
|
-
r.push(`# ${j + 1} ${
|
|
969
|
+
for (let j = 0; j < numPieces; j++) {
|
|
970
|
+
r.push(`# ${j + 1} ${moveNames[j].join(" ")}`);
|
|
985
971
|
}
|
|
986
972
|
}
|
|
987
973
|
toKsolve(name, mapper = new NullMapper()) {
|
|
988
974
|
const result = [];
|
|
989
975
|
result.push(`Name ${name}`);
|
|
990
976
|
result.push("");
|
|
991
|
-
for (let i = 0; i < this.
|
|
977
|
+
for (let i = 0; i < this.orbitNames.length; i++) {
|
|
992
978
|
result.push(
|
|
993
|
-
`Set ${this.
|
|
979
|
+
`Set ${this.orbitNames[i]} ${this.orbitDefs[i].numPieces} ${this.orbitDefs[i].numOrientations}`
|
|
994
980
|
);
|
|
995
981
|
this.describeSet(i, result, mapper);
|
|
996
982
|
}
|
|
997
983
|
result.push("");
|
|
998
984
|
result.push("Solved");
|
|
999
|
-
for (let i = 0; i < this.
|
|
1000
|
-
this.solved.orbits[i].renumberPieces().appendDefinition(result, this.
|
|
985
|
+
for (let i = 0; i < this.orbitNames.length; i++) {
|
|
986
|
+
this.solved.orbits[i].renumberPieces().appendDefinition(result, this.orbitNames[i], false, false);
|
|
1001
987
|
}
|
|
1002
988
|
result.push("End");
|
|
1003
|
-
for (let i = 0; i < this.
|
|
989
|
+
for (let i = 0; i < this.moveNames.length; i++) {
|
|
1004
990
|
result.push("");
|
|
1005
|
-
let name2 = this.
|
|
1006
|
-
if (!this.
|
|
1007
|
-
name2 =
|
|
991
|
+
let name2 = this.moveNames[i];
|
|
992
|
+
if (!this.forceNames[i]) {
|
|
993
|
+
name2 = externalMoveName(mapper, this.moveNames[i]);
|
|
1008
994
|
}
|
|
1009
995
|
let doinv = false;
|
|
1010
996
|
if (name2[name2.length - 1] === "'") {
|
|
@@ -1012,13 +998,13 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
1012
998
|
name2 = name2.substring(0, name2.length - 1);
|
|
1013
999
|
}
|
|
1014
1000
|
result.push(`Move ${name2}`);
|
|
1015
|
-
for (let j = 0; j < this.
|
|
1001
|
+
for (let j = 0; j < this.orbitNames.length; j++) {
|
|
1016
1002
|
if (doinv) {
|
|
1017
|
-
this.
|
|
1003
|
+
this.moveOps[i].orbits[j].invert().appendDefinition(result, this.orbitNames[j], true);
|
|
1018
1004
|
} else {
|
|
1019
|
-
this.
|
|
1005
|
+
this.moveOps[i].orbits[j].appendDefinition(
|
|
1020
1006
|
result,
|
|
1021
|
-
this.
|
|
1007
|
+
this.orbitNames[j],
|
|
1022
1008
|
true
|
|
1023
1009
|
);
|
|
1024
1010
|
}
|
|
@@ -1031,22 +1017,22 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
1031
1017
|
toKPuzzleDefinition(includemoves) {
|
|
1032
1018
|
const orbits = [];
|
|
1033
1019
|
const defaultPatternData = {};
|
|
1034
|
-
for (let i = 0; i < this.
|
|
1020
|
+
for (let i = 0; i < this.orbitNames.length; i++) {
|
|
1035
1021
|
orbits.push({
|
|
1036
|
-
orbitName: this.
|
|
1037
|
-
numPieces: this.
|
|
1038
|
-
numOrientations: this.
|
|
1022
|
+
orbitName: this.orbitNames[i],
|
|
1023
|
+
numPieces: this.orbitDefs[i].numPieces,
|
|
1024
|
+
numOrientations: this.orbitDefs[i].numOrientations
|
|
1039
1025
|
});
|
|
1040
1026
|
const defaultPatternFrom = this.solved.orbits[i].toKTransformationOrbitData();
|
|
1041
|
-
defaultPatternData[this.
|
|
1027
|
+
defaultPatternData[this.orbitNames[i]] = {
|
|
1042
1028
|
pieces: defaultPatternFrom.permutation,
|
|
1043
1029
|
orientation: defaultPatternFrom.orientationDelta
|
|
1044
1030
|
};
|
|
1045
1031
|
}
|
|
1046
1032
|
const moves = {};
|
|
1047
1033
|
if (includemoves) {
|
|
1048
|
-
for (let i = 0; i < this.
|
|
1049
|
-
moves[this.
|
|
1034
|
+
for (let i = 0; i < this.moveNames.length; i++) {
|
|
1035
|
+
moves[this.moveNames[i]] = this.toKTransformationData(this.moveOps[i]);
|
|
1050
1036
|
}
|
|
1051
1037
|
}
|
|
1052
1038
|
return {
|
|
@@ -1057,127 +1043,134 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
1057
1043
|
};
|
|
1058
1044
|
}
|
|
1059
1045
|
optimize() {
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1062
|
-
const
|
|
1063
|
-
const
|
|
1064
|
-
for (let j = 0; j < this.
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
for (let i = 0; i < this.
|
|
1068
|
-
const
|
|
1069
|
-
const
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
for (let k = 0; k < n; k++) {
|
|
1046
|
+
const newOrbitNames = [];
|
|
1047
|
+
const newOrbitDefs = [];
|
|
1048
|
+
const newSolved = [];
|
|
1049
|
+
const newMoveOps = this.moveOps.map(() => []);
|
|
1050
|
+
for (let j = 0; j < this.moveOps.length; j++) {
|
|
1051
|
+
newMoveOps.push([]);
|
|
1052
|
+
}
|
|
1053
|
+
for (let i = 0; i < this.orbitDefs.length; i++) {
|
|
1054
|
+
const { numPieces, numOrientations } = this.orbitDefs[i];
|
|
1055
|
+
const disjointUion = new DisjointUnion(numPieces);
|
|
1056
|
+
const changed = new Array(this.orbitDefs[i].numPieces);
|
|
1057
|
+
for (let k = 0; k < numPieces; k++) {
|
|
1073
1058
|
changed[k] = false;
|
|
1074
1059
|
}
|
|
1075
|
-
for (let j = 0; j < this.
|
|
1076
|
-
for (let k = 0; k <
|
|
1077
|
-
if (this.
|
|
1060
|
+
for (let j = 0; j < this.moveOps.length; j++) {
|
|
1061
|
+
for (let k = 0; k < numPieces; k++) {
|
|
1062
|
+
if (this.moveOps[j].orbits[i].permutation[k] !== k || this.moveOps[j].orbits[i].orientationDelta[k] !== 0) {
|
|
1078
1063
|
if (!this.isRotation[j]) {
|
|
1079
1064
|
changed[k] = true;
|
|
1080
1065
|
}
|
|
1081
|
-
|
|
1066
|
+
disjointUion.union(k, this.moveOps[j].orbits[i].permutation[k]);
|
|
1082
1067
|
}
|
|
1083
1068
|
}
|
|
1084
1069
|
}
|
|
1085
|
-
let
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1070
|
+
let keepOrientation = true;
|
|
1071
|
+
if (numOrientations > 1) {
|
|
1072
|
+
keepOrientation = false;
|
|
1073
|
+
const disjointUnion = new DisjointUnion(
|
|
1074
|
+
this.orbitDefs[i].numPieces * numOrientations
|
|
1075
|
+
);
|
|
1076
|
+
for (let j = 0; j < this.moveOps.length; j++) {
|
|
1077
|
+
for (let k = 0; k < numPieces; k++) {
|
|
1078
|
+
if (this.moveOps[j].orbits[i].permutation[k] !== k || this.moveOps[j].orbits[i].orientationDelta[k] !== 0) {
|
|
1079
|
+
for (let o = 0; o < numOrientations; o++) {
|
|
1080
|
+
disjointUnion.union(
|
|
1081
|
+
k * numOrientations + o,
|
|
1082
|
+
this.moveOps[j].orbits[i].permutation[k] * numOrientations + (o + this.moveOps[j].orbits[i].orientationDelta[k]) % numOrientations
|
|
1096
1083
|
);
|
|
1097
1084
|
}
|
|
1098
1085
|
}
|
|
1099
1086
|
}
|
|
1100
1087
|
}
|
|
1101
|
-
for (let j = 0; !
|
|
1102
|
-
for (let o = 1; o <
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1088
|
+
for (let j = 0; !keepOrientation && j < numPieces; j++) {
|
|
1089
|
+
for (let o = 1; o < numOrientations; o++) {
|
|
1090
|
+
if (disjointUnion.find(j * numOrientations) === disjointUnion.find(j * numOrientations + o)) {
|
|
1091
|
+
keepOrientation = true;
|
|
1105
1092
|
}
|
|
1106
1093
|
}
|
|
1107
1094
|
}
|
|
1108
|
-
for (let j = 0; !
|
|
1095
|
+
for (let j = 0; !keepOrientation && j < numPieces; j++) {
|
|
1109
1096
|
for (let k = 0; k < j; k++) {
|
|
1110
|
-
if (this.solved.orbits[i].
|
|
1111
|
-
|
|
1097
|
+
if (this.solved.orbits[i].permutation[j] === this.solved.orbits[i].permutation[k]) {
|
|
1098
|
+
keepOrientation = true;
|
|
1112
1099
|
}
|
|
1113
1100
|
}
|
|
1114
1101
|
}
|
|
1115
1102
|
}
|
|
1116
|
-
let
|
|
1103
|
+
let nontrivial = -1;
|
|
1117
1104
|
let multiple = false;
|
|
1118
|
-
for (let j = 0; j < this.
|
|
1105
|
+
for (let j = 0; j < this.orbitDefs[i].numPieces; j++) {
|
|
1119
1106
|
if (changed[j]) {
|
|
1120
|
-
const h =
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1123
|
-
} else if (
|
|
1107
|
+
const h = disjointUion.find(j);
|
|
1108
|
+
if (nontrivial < 0) {
|
|
1109
|
+
nontrivial = h;
|
|
1110
|
+
} else if (nontrivial !== h) {
|
|
1124
1111
|
multiple = true;
|
|
1125
1112
|
}
|
|
1126
1113
|
}
|
|
1127
1114
|
}
|
|
1128
|
-
for (let j = 0; j < this.
|
|
1115
|
+
for (let j = 0; j < this.orbitDefs[i].numPieces; j++) {
|
|
1129
1116
|
if (!changed[j]) {
|
|
1130
1117
|
continue;
|
|
1131
1118
|
}
|
|
1132
|
-
const h =
|
|
1119
|
+
const h = disjointUion.find(j);
|
|
1133
1120
|
if (h !== j) {
|
|
1134
1121
|
continue;
|
|
1135
1122
|
}
|
|
1136
1123
|
const no = [];
|
|
1137
1124
|
const on = [];
|
|
1138
1125
|
let nv = 0;
|
|
1139
|
-
for (let k = 0; k < this.
|
|
1140
|
-
if (
|
|
1126
|
+
for (let k = 0; k < this.orbitDefs[i].numPieces; k++) {
|
|
1127
|
+
if (disjointUion.find(k) === j) {
|
|
1141
1128
|
no[nv] = k;
|
|
1142
1129
|
on[k] = nv;
|
|
1143
1130
|
nv++;
|
|
1144
1131
|
}
|
|
1145
1132
|
}
|
|
1146
1133
|
if (multiple) {
|
|
1147
|
-
|
|
1134
|
+
newOrbitNames.push(`${this.orbitNames[i]}_p${j}`);
|
|
1148
1135
|
} else {
|
|
1149
|
-
|
|
1136
|
+
newOrbitNames.push(this.orbitNames[i]);
|
|
1150
1137
|
}
|
|
1151
|
-
if (
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1138
|
+
if (keepOrientation) {
|
|
1139
|
+
newOrbitDefs.push(
|
|
1140
|
+
new PGOrbitDef(nv, this.orbitDefs[i].numOrientations)
|
|
1141
|
+
);
|
|
1142
|
+
newSolved.push(this.solved.orbits[i].remapVS(no, nv));
|
|
1143
|
+
for (let k = 0; k < this.moveOps.length; k++) {
|
|
1144
|
+
newMoveOps[k].push(this.moveOps[k].orbits[i].remap(no, on, nv));
|
|
1156
1145
|
}
|
|
1157
1146
|
} else {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1147
|
+
newOrbitDefs.push(new PGOrbitDef(nv, 1));
|
|
1148
|
+
newSolved.push(
|
|
1149
|
+
this.solved.orbits[i].remapVS(no, nv).forgetOrientations()
|
|
1150
|
+
);
|
|
1151
|
+
for (let k = 0; k < this.moveOps.length; k++) {
|
|
1152
|
+
newMoveOps[k].push(
|
|
1153
|
+
this.moveOps[k].orbits[i].remap(no, on, nv).forgetOrientations()
|
|
1163
1154
|
);
|
|
1164
1155
|
}
|
|
1165
1156
|
}
|
|
1166
1157
|
}
|
|
1167
1158
|
}
|
|
1168
1159
|
return new _PGOrbitsDef(
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
new VisibleState(
|
|
1172
|
-
this.
|
|
1173
|
-
|
|
1160
|
+
newOrbitNames,
|
|
1161
|
+
newOrbitDefs,
|
|
1162
|
+
new VisibleState(newSolved),
|
|
1163
|
+
this.moveNames,
|
|
1164
|
+
newMoveOps.map((_) => new PGTransform(_)),
|
|
1174
1165
|
this.isRotation,
|
|
1175
|
-
this.
|
|
1166
|
+
this.forceNames
|
|
1176
1167
|
);
|
|
1177
1168
|
}
|
|
1178
1169
|
// replace the solved state with a new scrambled state.
|
|
1179
1170
|
scramble(n) {
|
|
1180
|
-
this.solved = this.solved.
|
|
1171
|
+
this.solved = this.solved.applyTransformation(
|
|
1172
|
+
this.getScrambleTransformation(n)
|
|
1173
|
+
);
|
|
1181
1174
|
}
|
|
1182
1175
|
// generate a new "random" position based on an entropy pool
|
|
1183
1176
|
// this should be significantly faster and more random than just
|
|
@@ -1187,8 +1180,8 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
1187
1180
|
n = 100;
|
|
1188
1181
|
}
|
|
1189
1182
|
const pool = [];
|
|
1190
|
-
for (let i = 0; i < this.
|
|
1191
|
-
pool[i] = this.
|
|
1183
|
+
for (let i = 0; i < this.moveOps.length; i++) {
|
|
1184
|
+
pool[i] = this.moveOps[i];
|
|
1192
1185
|
}
|
|
1193
1186
|
for (let i = 0; i < pool.length; i++) {
|
|
1194
1187
|
const j = Math.floor(Math.random() * pool.length);
|
|
@@ -1202,167 +1195,167 @@ var PGOrbitsDef = class _PGOrbitsDef {
|
|
|
1202
1195
|
for (let i = 0; i < n; i++) {
|
|
1203
1196
|
const ri = Math.floor(Math.random() * pool.length);
|
|
1204
1197
|
const rj = Math.floor(Math.random() * pool.length);
|
|
1205
|
-
const rm = Math.floor(Math.random() * this.
|
|
1206
|
-
pool[ri] = pool[ri].
|
|
1198
|
+
const rm = Math.floor(Math.random() * this.moveOps.length);
|
|
1199
|
+
pool[ri] = pool[ri].compose(pool[rj]).compose(this.moveOps[rm]);
|
|
1207
1200
|
if (Math.random() < 0.1) {
|
|
1208
|
-
pool[ri] = pool[ri].
|
|
1201
|
+
pool[ri] = pool[ri].compose(this.moveOps[rm]);
|
|
1209
1202
|
}
|
|
1210
1203
|
}
|
|
1211
1204
|
let s = pool[0];
|
|
1212
1205
|
for (let i = 1; i < pool.length; i++) {
|
|
1213
|
-
s = s.
|
|
1206
|
+
s = s.compose(pool[i]);
|
|
1214
1207
|
}
|
|
1215
1208
|
return s;
|
|
1216
1209
|
}
|
|
1217
1210
|
reassemblySize() {
|
|
1218
1211
|
let n = BigInt(1);
|
|
1219
|
-
for (let i = 0; i < this.
|
|
1220
|
-
n *= this.
|
|
1212
|
+
for (let i = 0; i < this.orbitDefs.length; i++) {
|
|
1213
|
+
n *= this.orbitDefs[i].reassemblySize();
|
|
1221
1214
|
}
|
|
1222
1215
|
return n;
|
|
1223
1216
|
}
|
|
1224
1217
|
};
|
|
1225
1218
|
var PGOrbit = class _PGOrbit {
|
|
1226
1219
|
static ktransformationCache = [];
|
|
1227
|
-
static
|
|
1228
|
-
return new _PGOrbit(
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
constructor(
|
|
1234
|
-
this.
|
|
1235
|
-
this.
|
|
1236
|
-
this.
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
const n = this.
|
|
1240
|
-
const
|
|
1241
|
-
if (this.
|
|
1220
|
+
static identity(numPieces, numOrientations) {
|
|
1221
|
+
return new _PGOrbit(range(numPieces), zeros(numPieces), numOrientations);
|
|
1222
|
+
}
|
|
1223
|
+
permutation;
|
|
1224
|
+
orientationDelta;
|
|
1225
|
+
numOrientations;
|
|
1226
|
+
constructor(permutation, orientationDelta, numOrientations) {
|
|
1227
|
+
this.permutation = permutation;
|
|
1228
|
+
this.orientationDelta = orientationDelta;
|
|
1229
|
+
this.numOrientations = numOrientations;
|
|
1230
|
+
}
|
|
1231
|
+
applyTransformation(b) {
|
|
1232
|
+
const n = this.permutation.length;
|
|
1233
|
+
const newPermutation = new Array(n);
|
|
1234
|
+
if (this.numOrientations === 1) {
|
|
1242
1235
|
for (let i = 0; i < n; i++) {
|
|
1243
|
-
|
|
1236
|
+
newPermutation[i] = this.permutation[b.permutation[i]];
|
|
1244
1237
|
}
|
|
1245
|
-
return new _PGOrbit(
|
|
1238
|
+
return new _PGOrbit(
|
|
1239
|
+
newPermutation,
|
|
1240
|
+
this.orientationDelta,
|
|
1241
|
+
this.numOrientations
|
|
1242
|
+
);
|
|
1246
1243
|
} else {
|
|
1247
|
-
const
|
|
1244
|
+
const newOrientationDelta = new Array(n);
|
|
1248
1245
|
for (let i = 0; i < n; i++) {
|
|
1249
|
-
|
|
1250
|
-
|
|
1246
|
+
newPermutation[i] = this.permutation[b.permutation[i]];
|
|
1247
|
+
newOrientationDelta[i] = (this.orientationDelta[b.permutation[i]] + b.orientationDelta[i]) % this.numOrientations;
|
|
1251
1248
|
}
|
|
1252
|
-
return new _PGOrbit(
|
|
1249
|
+
return new _PGOrbit(
|
|
1250
|
+
newPermutation,
|
|
1251
|
+
newOrientationDelta,
|
|
1252
|
+
this.numOrientations
|
|
1253
|
+
);
|
|
1253
1254
|
}
|
|
1254
1255
|
}
|
|
1255
|
-
|
|
1256
|
-
const n = this.
|
|
1256
|
+
invert() {
|
|
1257
|
+
const n = this.permutation.length;
|
|
1257
1258
|
const newPerm = new Array(n);
|
|
1258
1259
|
const newOri = new Array(n);
|
|
1259
1260
|
for (let i = 0; i < n; i++) {
|
|
1260
|
-
newPerm[this.
|
|
1261
|
-
newOri[this.
|
|
1261
|
+
newPerm[this.permutation[i]] = i;
|
|
1262
|
+
newOri[this.permutation[i]] = (this.numOrientations - this.orientationDelta[i]) % this.numOrientations;
|
|
1262
1263
|
}
|
|
1263
|
-
return new _PGOrbit(newPerm, newOri, this.
|
|
1264
|
+
return new _PGOrbit(newPerm, newOri, this.numOrientations);
|
|
1264
1265
|
}
|
|
1265
1266
|
equal(b) {
|
|
1266
|
-
const n = this.
|
|
1267
|
+
const n = this.permutation.length;
|
|
1267
1268
|
for (let i = 0; i < n; i++) {
|
|
1268
|
-
if (this.
|
|
1269
|
+
if (this.permutation[i] !== b.permutation[i] || this.orientationDelta[i] !== b.orientationDelta[i]) {
|
|
1269
1270
|
return false;
|
|
1270
1271
|
}
|
|
1271
1272
|
}
|
|
1272
1273
|
return true;
|
|
1273
1274
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1275
|
+
/**
|
|
1276
|
+
* Set the number of orientations to 1, so that orientations are effectively
|
|
1277
|
+
* no longer tracked for this orbit.
|
|
1278
|
+
*/
|
|
1279
|
+
forgetOrientations() {
|
|
1280
|
+
const n = this.permutation.length;
|
|
1277
1281
|
for (let i = 0; i < n; i++) {
|
|
1278
|
-
this.
|
|
1282
|
+
this.orientationDelta[i] = 0;
|
|
1279
1283
|
}
|
|
1280
|
-
this.
|
|
1284
|
+
this.numOrientations = 1;
|
|
1281
1285
|
return this;
|
|
1282
1286
|
}
|
|
1283
|
-
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
return new
|
|
1287
|
+
toPermutation() {
|
|
1288
|
+
const { numOrientations } = this;
|
|
1289
|
+
if (numOrientations === 1) {
|
|
1290
|
+
return new Permutation(this.permutation);
|
|
1287
1291
|
}
|
|
1288
|
-
const n = this.
|
|
1289
|
-
const newPerm = new Array(n *
|
|
1292
|
+
const n = this.permutation.length;
|
|
1293
|
+
const newPerm = new Array(n * numOrientations);
|
|
1290
1294
|
for (let i = 0; i < n; i++) {
|
|
1291
|
-
for (let j = 0; j <
|
|
1292
|
-
newPerm[i *
|
|
1295
|
+
for (let j = 0; j < numOrientations; j++) {
|
|
1296
|
+
newPerm[i * numOrientations + j] = numOrientations * this.permutation[i] + (this.orientationDelta[i] + j) % numOrientations;
|
|
1293
1297
|
}
|
|
1294
1298
|
}
|
|
1295
|
-
return new
|
|
1299
|
+
return new Permutation(newPerm);
|
|
1296
1300
|
}
|
|
1297
1301
|
// number the pieces in order.
|
|
1298
1302
|
renumberPieces() {
|
|
1299
|
-
const seen = new Array(this.
|
|
1300
|
-
const newPerm = new Array(this.
|
|
1303
|
+
const seen = new Array(this.permutation.length);
|
|
1304
|
+
const newPerm = new Array(this.permutation.length);
|
|
1301
1305
|
let id = 0;
|
|
1302
|
-
for (let i = 0; i < this.
|
|
1303
|
-
const v = this.
|
|
1306
|
+
for (let i = 0; i < this.permutation.length; i++) {
|
|
1307
|
+
const v = this.permutation[i];
|
|
1304
1308
|
if (seen[v] === void 0) {
|
|
1305
1309
|
seen[v] = id++;
|
|
1306
1310
|
}
|
|
1307
1311
|
newPerm[i] = seen[v];
|
|
1308
1312
|
}
|
|
1309
|
-
return new _PGOrbit(newPerm, this.
|
|
1313
|
+
return new _PGOrbit(newPerm, this.orientationDelta, this.numOrientations);
|
|
1310
1314
|
}
|
|
1311
|
-
// returns tuple of
|
|
1315
|
+
// returns tuple of arrays of indices identical pieces in this orbit
|
|
1312
1316
|
identicalPieces() {
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
const v = this.perm[i];
|
|
1318
|
-
if (done[v] === void 0) {
|
|
1319
|
-
const s = [i];
|
|
1320
|
-
done[v] = true;
|
|
1321
|
-
for (let j = i + 1; j < n; j++) {
|
|
1322
|
-
if (this.perm[j] === v) {
|
|
1323
|
-
s.push(j);
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
r.push(s);
|
|
1327
|
-
}
|
|
1317
|
+
const output = {};
|
|
1318
|
+
for (let i = 0; i < this.permutation.length; i++) {
|
|
1319
|
+
const pieceNumber = this.permutation[i];
|
|
1320
|
+
(output[pieceNumber] ??= []).push(i);
|
|
1328
1321
|
}
|
|
1329
|
-
return
|
|
1322
|
+
return output;
|
|
1330
1323
|
}
|
|
1331
1324
|
order() {
|
|
1332
|
-
return this.
|
|
1325
|
+
return this.toPermutation().order();
|
|
1333
1326
|
}
|
|
1334
1327
|
isIdentity() {
|
|
1335
|
-
const n = this.
|
|
1336
|
-
if (this.
|
|
1328
|
+
const n = this.permutation.length;
|
|
1329
|
+
if (this.permutation === range(n) && this.orientationDelta === zeros(n)) {
|
|
1337
1330
|
return true;
|
|
1338
1331
|
}
|
|
1339
1332
|
for (let i = 0; i < n; i++) {
|
|
1340
|
-
if (this.
|
|
1333
|
+
if (this.permutation[i] !== i || this.orientationDelta[i] !== 0) {
|
|
1341
1334
|
return false;
|
|
1342
1335
|
}
|
|
1343
1336
|
}
|
|
1344
1337
|
return true;
|
|
1345
1338
|
}
|
|
1346
1339
|
zeroOris() {
|
|
1347
|
-
const n = this.
|
|
1348
|
-
if (this.
|
|
1340
|
+
const n = this.permutation.length;
|
|
1341
|
+
if (this.orientationDelta === zeros(n)) {
|
|
1349
1342
|
return true;
|
|
1350
1343
|
}
|
|
1351
1344
|
for (let i = 0; i < n; i++) {
|
|
1352
|
-
if (this.
|
|
1345
|
+
if (this.orientationDelta[i] !== 0) {
|
|
1353
1346
|
return false;
|
|
1354
1347
|
}
|
|
1355
1348
|
}
|
|
1356
1349
|
return true;
|
|
1357
1350
|
}
|
|
1358
1351
|
remap(no, on, nv) {
|
|
1359
|
-
const
|
|
1360
|
-
const
|
|
1352
|
+
const newPermutation = new Array(nv);
|
|
1353
|
+
const newOrientation = new Array(nv);
|
|
1361
1354
|
for (let i = 0; i < nv; i++) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1355
|
+
newPermutation[i] = on[this.permutation[no[i]]];
|
|
1356
|
+
newOrientation[i] = this.orientationDelta[no[i]];
|
|
1364
1357
|
}
|
|
1365
|
-
return new _PGOrbit(
|
|
1358
|
+
return new _PGOrbit(newPermutation, newOrientation, this.numOrientations);
|
|
1366
1359
|
}
|
|
1367
1360
|
remapVS(no, nv) {
|
|
1368
1361
|
const newPerm = new Array(nv);
|
|
@@ -1370,52 +1363,55 @@ var PGOrbit = class _PGOrbit {
|
|
|
1370
1363
|
let nextNew = 0;
|
|
1371
1364
|
const reassign = [];
|
|
1372
1365
|
for (let i = 0; i < nv; i++) {
|
|
1373
|
-
const ov = this.
|
|
1366
|
+
const ov = this.permutation[no[i]];
|
|
1374
1367
|
if (reassign[ov] === void 0) {
|
|
1375
1368
|
reassign[ov] = nextNew++;
|
|
1376
1369
|
}
|
|
1377
1370
|
newPerm[i] = reassign[ov];
|
|
1378
|
-
newOri[i] = this.
|
|
1371
|
+
newOri[i] = this.orientationDelta[no[i]];
|
|
1379
1372
|
}
|
|
1380
|
-
return new _PGOrbit(newPerm, newOri, this.
|
|
1373
|
+
return new _PGOrbit(newPerm, newOri, this.numOrientations);
|
|
1381
1374
|
}
|
|
1382
1375
|
appendDefinition(result, name, useVS, concise = true) {
|
|
1383
1376
|
if (concise && this.isIdentity()) {
|
|
1384
1377
|
return;
|
|
1385
1378
|
}
|
|
1386
1379
|
result.push(name);
|
|
1387
|
-
result.push(this.
|
|
1380
|
+
result.push(this.permutation.map((_) => _ + 1).join(" "));
|
|
1388
1381
|
if (!this.zeroOris()) {
|
|
1389
1382
|
if (useVS) {
|
|
1390
|
-
const newori = new Array(this.
|
|
1383
|
+
const newori = new Array(this.orientationDelta.length);
|
|
1391
1384
|
for (let i = 0; i < newori.length; i++) {
|
|
1392
|
-
newori[this.
|
|
1385
|
+
newori[this.permutation[i]] = this.orientationDelta[i];
|
|
1393
1386
|
}
|
|
1394
1387
|
result.push(newori.join(" "));
|
|
1395
1388
|
} else {
|
|
1396
|
-
result.push(this.
|
|
1389
|
+
result.push(this.orientationDelta.join(" "));
|
|
1397
1390
|
}
|
|
1398
1391
|
}
|
|
1399
1392
|
}
|
|
1400
1393
|
toKTransformationOrbitData() {
|
|
1401
|
-
const n = this.
|
|
1394
|
+
const n = this.permutation.length;
|
|
1402
1395
|
if (this.isIdentity()) {
|
|
1403
1396
|
if (!_PGOrbit.ktransformationCache[n]) {
|
|
1404
1397
|
_PGOrbit.ktransformationCache[n] = {
|
|
1405
|
-
permutation:
|
|
1398
|
+
permutation: range(n),
|
|
1406
1399
|
orientationDelta: zeros(n)
|
|
1407
1400
|
};
|
|
1408
1401
|
}
|
|
1409
1402
|
return _PGOrbit.ktransformationCache[n];
|
|
1410
1403
|
} else {
|
|
1411
|
-
return {
|
|
1404
|
+
return {
|
|
1405
|
+
permutation: this.permutation,
|
|
1406
|
+
orientationDelta: this.orientationDelta
|
|
1407
|
+
};
|
|
1412
1408
|
}
|
|
1413
1409
|
}
|
|
1414
1410
|
toKPatternOrbitData() {
|
|
1415
|
-
const n = this.
|
|
1411
|
+
const n = this.permutation.length;
|
|
1416
1412
|
return {
|
|
1417
|
-
pieces: this.
|
|
1418
|
-
orientation: this.
|
|
1413
|
+
pieces: this.permutation,
|
|
1414
|
+
orientation: this.orientationDelta,
|
|
1419
1415
|
orientationMod: zeros(n)
|
|
1420
1416
|
};
|
|
1421
1417
|
}
|
|
@@ -1425,17 +1421,17 @@ var PGTransformBase = class {
|
|
|
1425
1421
|
constructor(orbits) {
|
|
1426
1422
|
this.orbits = orbits;
|
|
1427
1423
|
}
|
|
1428
|
-
|
|
1424
|
+
internalApplyTransformation(b) {
|
|
1429
1425
|
const newOrbits = [];
|
|
1430
1426
|
for (let i = 0; i < this.orbits.length; i++) {
|
|
1431
|
-
newOrbits.push(this.orbits[i].
|
|
1427
|
+
newOrbits.push(this.orbits[i].applyTransformation(b.orbits[i]));
|
|
1432
1428
|
}
|
|
1433
1429
|
return newOrbits;
|
|
1434
1430
|
}
|
|
1435
|
-
|
|
1431
|
+
internalInvert() {
|
|
1436
1432
|
const newOrbits = [];
|
|
1437
1433
|
for (const orbit of this.orbits) {
|
|
1438
|
-
newOrbits.push(orbit.
|
|
1434
|
+
newOrbits.push(orbit.invert());
|
|
1439
1435
|
}
|
|
1440
1436
|
return newOrbits;
|
|
1441
1437
|
}
|
|
@@ -1447,40 +1443,39 @@ var PGTransformBase = class {
|
|
|
1447
1443
|
}
|
|
1448
1444
|
return true;
|
|
1449
1445
|
}
|
|
1450
|
-
|
|
1446
|
+
forgetOrientations() {
|
|
1451
1447
|
for (const orbit of this.orbits) {
|
|
1452
|
-
orbit.
|
|
1448
|
+
orbit.forgetOrientations();
|
|
1453
1449
|
}
|
|
1454
1450
|
return this;
|
|
1455
1451
|
}
|
|
1456
|
-
|
|
1452
|
+
toPermutation() {
|
|
1457
1453
|
const perms = [];
|
|
1458
1454
|
let n = 0;
|
|
1459
1455
|
for (const orbit of this.orbits) {
|
|
1460
|
-
const p = orbit.
|
|
1456
|
+
const p = orbit.toPermutation();
|
|
1461
1457
|
perms.push(p);
|
|
1462
|
-
n += p.
|
|
1458
|
+
n += p.length;
|
|
1463
1459
|
}
|
|
1464
1460
|
const newPerm = new Array(n);
|
|
1465
1461
|
n = 0;
|
|
1466
1462
|
for (const p of perms) {
|
|
1467
|
-
for (let j = 0; j < p.
|
|
1468
|
-
newPerm[n + j] = n + p.
|
|
1463
|
+
for (let j = 0; j < p.length; j++) {
|
|
1464
|
+
newPerm[n + j] = n + p.permutation[j];
|
|
1469
1465
|
}
|
|
1470
|
-
n += p.
|
|
1466
|
+
n += p.length;
|
|
1471
1467
|
}
|
|
1472
|
-
return new
|
|
1468
|
+
return new Permutation(newPerm);
|
|
1473
1469
|
}
|
|
1474
1470
|
identicalPieces() {
|
|
1475
1471
|
const r = [];
|
|
1476
1472
|
let n = 0;
|
|
1477
1473
|
for (const orbit of this.orbits) {
|
|
1478
|
-
const o = orbit.
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
r.push(s[j].map((_) => _ * o + n));
|
|
1474
|
+
const o = orbit.numOrientations;
|
|
1475
|
+
for (const occurences of Object.values(orbit.identicalPieces())) {
|
|
1476
|
+
r.push(occurences.map((i) => i * o + n));
|
|
1482
1477
|
}
|
|
1483
|
-
n += o * orbit.
|
|
1478
|
+
n += o * orbit.permutation.length;
|
|
1484
1479
|
}
|
|
1485
1480
|
return r;
|
|
1486
1481
|
}
|
|
@@ -1493,50 +1488,52 @@ var PGTransformBase = class {
|
|
|
1493
1488
|
}
|
|
1494
1489
|
};
|
|
1495
1490
|
var PGTransform = class _PGTransform extends PGTransformBase {
|
|
1496
|
-
|
|
1497
|
-
return new _PGTransform(this.
|
|
1491
|
+
compose(b) {
|
|
1492
|
+
return new _PGTransform(this.internalApplyTransformation(b));
|
|
1498
1493
|
}
|
|
1499
|
-
|
|
1500
|
-
if (
|
|
1501
|
-
return this.
|
|
1494
|
+
multiplyByScalar(s) {
|
|
1495
|
+
if (s === 0) {
|
|
1496
|
+
return this.identity();
|
|
1502
1497
|
}
|
|
1503
1498
|
let t = this;
|
|
1504
|
-
if (
|
|
1505
|
-
t = t.
|
|
1506
|
-
|
|
1499
|
+
if (s < 0) {
|
|
1500
|
+
t = t.inverrt();
|
|
1501
|
+
s = -s;
|
|
1507
1502
|
}
|
|
1508
|
-
while ((
|
|
1509
|
-
t = t.
|
|
1510
|
-
|
|
1503
|
+
while ((s & 1) === 0) {
|
|
1504
|
+
t = t.compose(t);
|
|
1505
|
+
s >>= 1;
|
|
1511
1506
|
}
|
|
1512
|
-
if (
|
|
1507
|
+
if (s === 1) {
|
|
1513
1508
|
return t;
|
|
1514
1509
|
}
|
|
1515
|
-
let
|
|
1516
|
-
let r = this.
|
|
1517
|
-
while (
|
|
1518
|
-
if (
|
|
1519
|
-
r = r.
|
|
1510
|
+
let transform = t;
|
|
1511
|
+
let r = this.identity();
|
|
1512
|
+
while (s > 0) {
|
|
1513
|
+
if (s & 1) {
|
|
1514
|
+
r = r.compose(transform);
|
|
1520
1515
|
}
|
|
1521
|
-
if (
|
|
1522
|
-
|
|
1516
|
+
if (s > 1) {
|
|
1517
|
+
transform = transform.compose(transform);
|
|
1523
1518
|
}
|
|
1524
|
-
|
|
1519
|
+
s >>= 1;
|
|
1525
1520
|
}
|
|
1526
1521
|
return r;
|
|
1527
1522
|
}
|
|
1528
|
-
|
|
1529
|
-
return new _PGTransform(this.
|
|
1523
|
+
inverrt() {
|
|
1524
|
+
return new _PGTransform(this.internalInvert());
|
|
1530
1525
|
}
|
|
1531
|
-
|
|
1526
|
+
identity() {
|
|
1532
1527
|
return new _PGTransform(
|
|
1533
|
-
this.orbits.map(
|
|
1528
|
+
this.orbits.map(
|
|
1529
|
+
(orbit) => PGOrbit.identity(orbit.permutation.length, orbit.numOrientations)
|
|
1530
|
+
)
|
|
1534
1531
|
);
|
|
1535
1532
|
}
|
|
1536
1533
|
};
|
|
1537
1534
|
var VisibleState = class _VisibleState extends PGTransformBase {
|
|
1538
|
-
|
|
1539
|
-
return new _VisibleState(this.
|
|
1535
|
+
applyTransformation(b) {
|
|
1536
|
+
return new _VisibleState(this.internalApplyTransformation(b));
|
|
1540
1537
|
}
|
|
1541
1538
|
};
|
|
1542
1539
|
var DisjointUnion = class {
|
|
@@ -1568,23 +1565,23 @@ var DisjointUnion = class {
|
|
|
1568
1565
|
}
|
|
1569
1566
|
}
|
|
1570
1567
|
};
|
|
1571
|
-
function
|
|
1572
|
-
const n = g.
|
|
1568
|
+
function showCanonical(g, disp) {
|
|
1569
|
+
const n = g.moveOps.length;
|
|
1573
1570
|
if (n > 30) {
|
|
1574
1571
|
throw new Error("Canon info too big for bitmask");
|
|
1575
1572
|
}
|
|
1576
1573
|
const orders = [];
|
|
1577
1574
|
const commutes = [];
|
|
1578
1575
|
for (let i = 0; i < n; i++) {
|
|
1579
|
-
const permA = g.
|
|
1576
|
+
const permA = g.moveOps[i];
|
|
1580
1577
|
orders.push(permA.order());
|
|
1581
1578
|
let bits = 0;
|
|
1582
1579
|
for (let j = 0; j < n; j++) {
|
|
1583
1580
|
if (j === i) {
|
|
1584
1581
|
continue;
|
|
1585
1582
|
}
|
|
1586
|
-
const permB = g.
|
|
1587
|
-
if (permA.
|
|
1583
|
+
const permB = g.moveOps[j];
|
|
1584
|
+
if (permA.compose(permB).equal(permB.compose(permA))) {
|
|
1588
1585
|
bits |= 1 << j;
|
|
1589
1586
|
}
|
|
1590
1587
|
}
|
|
@@ -2089,7 +2086,7 @@ var FactoredNumber = class {
|
|
|
2089
2086
|
}
|
|
2090
2087
|
};
|
|
2091
2088
|
function schreierSims(g, disp) {
|
|
2092
|
-
const n = g[0].
|
|
2089
|
+
const n = g[0].permutation.length;
|
|
2093
2090
|
const e = identity(n);
|
|
2094
2091
|
let sgs = [];
|
|
2095
2092
|
let sgsi = [];
|
|
@@ -2097,13 +2094,13 @@ function schreierSims(g, disp) {
|
|
|
2097
2094
|
let Tk = [];
|
|
2098
2095
|
let Tklen = [];
|
|
2099
2096
|
function resolve(p) {
|
|
2100
|
-
for (let i = p.
|
|
2101
|
-
const j = p.
|
|
2097
|
+
for (let i = p.permutation.length - 1; i >= 0; i--) {
|
|
2098
|
+
const j = p.permutation[i];
|
|
2102
2099
|
if (j !== i) {
|
|
2103
2100
|
if (!sgs[i][j]) {
|
|
2104
2101
|
return false;
|
|
2105
2102
|
}
|
|
2106
|
-
p = p.
|
|
2103
|
+
p = p.multiply(sgsi[i][j]);
|
|
2107
2104
|
}
|
|
2108
2105
|
}
|
|
2109
2106
|
return true;
|
|
@@ -2113,22 +2110,22 @@ function schreierSims(g, disp) {
|
|
|
2113
2110
|
Tklen[k].push(len);
|
|
2114
2111
|
for (let i = 0; i < sgs[k].length; i++) {
|
|
2115
2112
|
if (sgs[k][i]) {
|
|
2116
|
-
knuthb(k, sgs[k][i].
|
|
2113
|
+
knuthb(k, sgs[k][i].multiply(p), len + sgslen[k][i]);
|
|
2117
2114
|
}
|
|
2118
2115
|
}
|
|
2119
2116
|
}
|
|
2120
2117
|
function knuthb(k, p, len) {
|
|
2121
|
-
const j = p.
|
|
2118
|
+
const j = p.permutation[k];
|
|
2122
2119
|
if (!sgs[k][j]) {
|
|
2123
2120
|
sgs[k][j] = p;
|
|
2124
|
-
sgsi[k][j] = p.
|
|
2121
|
+
sgsi[k][j] = p.invert();
|
|
2125
2122
|
sgslen[k][j] = len;
|
|
2126
2123
|
for (let i = 0; i < Tk[k].length; i++) {
|
|
2127
|
-
knuthb(k, p.
|
|
2124
|
+
knuthb(k, p.multiply(Tk[k][i]), len + Tklen[k][i]);
|
|
2128
2125
|
}
|
|
2129
2126
|
return;
|
|
2130
2127
|
}
|
|
2131
|
-
const p2 = p.
|
|
2128
|
+
const p2 = p.multiply(sgsi[k][j]);
|
|
2132
2129
|
if (!resolve(p2)) {
|
|
2133
2130
|
knutha(k - 1, p2, len + sgslen[k][j]);
|
|
2134
2131
|
}
|
|
@@ -4168,10 +4165,10 @@ ${comment}
|
|
|
4168
4165
|
const os = this.getOrbitsDef(false);
|
|
4169
4166
|
const r = [];
|
|
4170
4167
|
const mvs = [];
|
|
4171
|
-
for (let i = 0; i < os.
|
|
4172
|
-
let movename = os.
|
|
4173
|
-
if (!os.
|
|
4174
|
-
movename = `M_${
|
|
4168
|
+
for (let i = 0; i < os.moveOps.length; i++) {
|
|
4169
|
+
let movename = os.moveNames[i];
|
|
4170
|
+
if (!os.forceNames[i]) {
|
|
4171
|
+
movename = `M_${externalMoveName(this.notationMapper, movename)}`;
|
|
4175
4172
|
}
|
|
4176
4173
|
movename = `M_${movename}`;
|
|
4177
4174
|
let doinv = false;
|
|
@@ -4181,9 +4178,11 @@ ${comment}
|
|
|
4181
4178
|
}
|
|
4182
4179
|
mvs.push(movename);
|
|
4183
4180
|
if (doinv) {
|
|
4184
|
-
r.push(
|
|
4181
|
+
r.push(
|
|
4182
|
+
`${movename}:=${os.moveOps[i].toPermutation().invert().toGap()};`
|
|
4183
|
+
);
|
|
4185
4184
|
} else {
|
|
4186
|
-
r.push(`${movename}:=${os.
|
|
4185
|
+
r.push(`${movename}:=${os.moveOps[i].toPermutation().toGap()};`);
|
|
4187
4186
|
}
|
|
4188
4187
|
}
|
|
4189
4188
|
r.push("Gen:=[");
|
|
@@ -4203,8 +4202,8 @@ ${comment}
|
|
|
4203
4202
|
const r = [];
|
|
4204
4203
|
const mvs = [];
|
|
4205
4204
|
r.push(`(* ${this.header("").trim()} *)`);
|
|
4206
|
-
for (let i = 0; i < os.
|
|
4207
|
-
let movename = `m${
|
|
4205
|
+
for (let i = 0; i < os.moveOps.length; i++) {
|
|
4206
|
+
let movename = `m${externalMoveName(this.notationMapper, os.moveNames[i])}`;
|
|
4208
4207
|
let doinv = false;
|
|
4209
4208
|
if (movename[movename.length - 1] === "'") {
|
|
4210
4209
|
movename = movename.substring(0, movename.length - 1);
|
|
@@ -4212,9 +4211,11 @@ ${comment}
|
|
|
4212
4211
|
}
|
|
4213
4212
|
mvs.push(movename);
|
|
4214
4213
|
if (doinv) {
|
|
4215
|
-
r.push(
|
|
4214
|
+
r.push(
|
|
4215
|
+
`${movename}=${os.moveOps[i].toPermutation().invert().toMathematica()};`
|
|
4216
|
+
);
|
|
4216
4217
|
} else {
|
|
4217
|
-
r.push(`${movename}=${os.
|
|
4218
|
+
r.push(`${movename}=${os.moveOps[i].toPermutation().toMathematica()};`);
|
|
4218
4219
|
}
|
|
4219
4220
|
}
|
|
4220
4221
|
r.push(`gen={${mvs.join(",")}};`);
|
|
@@ -4238,7 +4239,7 @@ ${comment}
|
|
|
4238
4239
|
const perms = [];
|
|
4239
4240
|
const oris = [];
|
|
4240
4241
|
for (const len of this.cubieOrbitSizes) {
|
|
4241
|
-
perms.push(
|
|
4242
|
+
perms.push(range(len));
|
|
4242
4243
|
oris.push(zeros(len));
|
|
4243
4244
|
}
|
|
4244
4245
|
for (let m = moverange[0]; m <= moverange[1]; m++) {
|
|
@@ -4255,7 +4256,7 @@ ${comment}
|
|
|
4255
4256
|
inc = mperm.length - 2;
|
|
4256
4257
|
oinc = mperm.length - 1;
|
|
4257
4258
|
}
|
|
4258
|
-
if (perms[setnum] ===
|
|
4259
|
+
if (perms[setnum] === range(this.cubieOrbitSizes[setnum])) {
|
|
4259
4260
|
perms[setnum] = perms[setnum].slice();
|
|
4260
4261
|
if (this.orbitOrientations[setnum] > 1 && // TODO: refactor to avoid non-null-assertion
|
|
4261
4262
|
!this.options.fixedOrientation) {
|
|
@@ -4272,14 +4273,14 @@ ${comment}
|
|
|
4272
4273
|
}
|
|
4273
4274
|
}
|
|
4274
4275
|
}
|
|
4275
|
-
let lastId = new PGOrbit(
|
|
4276
|
+
let lastId = new PGOrbit(range(24), zeros(24), 1);
|
|
4276
4277
|
for (let ii = 0; ii < this.cubieSetNames.length; ii++) {
|
|
4277
4278
|
if (setmoves && !setmoves[ii]) {
|
|
4278
4279
|
continue;
|
|
4279
4280
|
}
|
|
4280
4281
|
if (this.orbitOrientations[ii] === 1 || this.options.fixedOrientation) {
|
|
4281
|
-
if (perms[ii] ===
|
|
4282
|
-
if (perms[ii] !== lastId.
|
|
4282
|
+
if (perms[ii] === range(lastId.permutation.length)) {
|
|
4283
|
+
if (perms[ii] !== lastId.permutation) {
|
|
4283
4284
|
lastId = new PGOrbit(perms[ii], oris[ii], 1);
|
|
4284
4285
|
}
|
|
4285
4286
|
moveorbits.push(lastId);
|
|
@@ -4298,7 +4299,7 @@ ${comment}
|
|
|
4298
4299
|
}
|
|
4299
4300
|
let mv = new PGTransform(moveorbits);
|
|
4300
4301
|
if (amount !== 1) {
|
|
4301
|
-
mv = mv.
|
|
4302
|
+
mv = mv.multiplyByScalar(amount);
|
|
4302
4303
|
}
|
|
4303
4304
|
return mv;
|
|
4304
4305
|
}
|
|
@@ -4589,10 +4590,10 @@ ${comment}
|
|
|
4589
4590
|
return od.toKTransformationData(od.getScrambleTransformation(n));
|
|
4590
4591
|
}
|
|
4591
4592
|
getMovesAsPerms() {
|
|
4592
|
-
return this.getOrbitsDef(false).
|
|
4593
|
+
return this.getOrbitsDef(false).moveOps.map((_) => _.toPermutation());
|
|
4593
4594
|
}
|
|
4594
4595
|
showcanon(disp) {
|
|
4595
|
-
|
|
4596
|
+
showCanonical(this.getOrbitsDef(false), disp);
|
|
4596
4597
|
}
|
|
4597
4598
|
getsolved() {
|
|
4598
4599
|
const r = [];
|
|
@@ -4601,7 +4602,7 @@ ${comment}
|
|
|
4601
4602
|
r.push(i);
|
|
4602
4603
|
}
|
|
4603
4604
|
}
|
|
4604
|
-
return new
|
|
4605
|
+
return new Permutation(r);
|
|
4605
4606
|
}
|
|
4606
4607
|
// Given a rotation description that says to align feature1
|
|
4607
4608
|
// with a given vector, and then as much as possible feature2
|
|
@@ -4908,7 +4909,7 @@ ${comment}
|
|
|
4908
4909
|
const cubieori = this.faceToCubieOrd[i];
|
|
4909
4910
|
const cubiesetnum = this.cubieSetNums[cubie];
|
|
4910
4911
|
const cubieord = this.cubieOrdNums[cubie];
|
|
4911
|
-
const color = this.graybyori(cubie) ? "#808080" : colormap[pos.
|
|
4912
|
+
const color = this.graybyori(cubie) ? "#808080" : colormap[pos.permutation[i]];
|
|
4912
4913
|
let id = `${this.cubieSetNames[cubiesetnum]}-l${cubieord}-o${cubieori}`;
|
|
4913
4914
|
svg.push(drawedges(id, facegeo[i], color));
|
|
4914
4915
|
if (this.duplicatedFaces[i]) {
|
|
@@ -5072,7 +5073,7 @@ var PGNotation = class {
|
|
|
5072
5073
|
pg;
|
|
5073
5074
|
constructor(pg, od) {
|
|
5074
5075
|
this.pg = pg;
|
|
5075
|
-
this.orbitNames = od.
|
|
5076
|
+
this.orbitNames = od.orbitNames;
|
|
5076
5077
|
}
|
|
5077
5078
|
lookupMove(move) {
|
|
5078
5079
|
const mv = this.pg.parseMove(move);
|
|
@@ -5121,4 +5122,3 @@ export {
|
|
|
5121
5122
|
parsePuzzleDescription,
|
|
5122
5123
|
schreierSims
|
|
5123
5124
|
};
|
|
5124
|
-
//# sourceMappingURL=index.js.map
|