cubing 0.48.4 → 0.49.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/lib/cubing/{Alg.d-B5bAxd5U.d.ts → Alg.d-T-vs-GDG.d.ts} +1 -1
- package/dist/lib/cubing/{KPattern.d-Iv89gNss.d.ts → KPattern.d-eWxoJtl0.d.ts} +1 -1
- package/dist/lib/cubing/{TwizzleLink.d-DVId206j.d.ts → TwizzleLink.d-S18moNia.d.ts} +4 -4
- package/dist/lib/cubing/alg/index.d.ts +3 -3
- package/dist/lib/cubing/bluetooth/index.d.ts +4 -4
- package/dist/lib/cubing/{bluetooth-puzzle.d-CZReUDb1.d.ts → bluetooth-puzzle.d-NEYj0B8F.d.ts} +2 -2
- package/dist/lib/cubing/{index-BhH6DKdK.d.ts → index-t97giMqB.d.ts} +2 -2
- package/dist/lib/cubing/kpuzzle/index.d.ts +2 -2
- package/dist/lib/cubing/notation/index.d.ts +4 -4
- package/dist/lib/cubing/{parseAlg.d-HDV9mtha.d.ts → parseAlg.d-tIlAma60.d.ts} +1 -1
- package/dist/lib/cubing/protocol/index.d.ts +2 -2
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +3 -3
- package/dist/lib/cubing/puzzles/index.d.ts +875 -4
- package/dist/lib/cubing/scramble/index.d.ts +3 -3
- package/dist/lib/cubing/search/index.d.ts +3 -3
- package/dist/lib/cubing/stream/index.d.ts +3 -3
- package/dist/lib/cubing/twisty/index.d.ts +5 -5
- package/package.json +2 -5
|
@@ -339,4 +339,4 @@ declare class Alg extends AlgCommon<Alg> {
|
|
|
339
339
|
simplify(options?: SimplifyOptions): Alg;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
export { Alg as A, Commutator as C, Grouping as G, IterationDirection as I, LineComment as L, Move as M, Newline as N,
|
|
342
|
+
export { Alg as A, Commutator as C, Grouping as G, IterationDirection as I, LineComment as L, Move as M, Newline as N, Pause as P, QuantumMove as Q, type SimplifyOptions as S, type AlgNode as a, type AlgLeaf as b, type AppendOptions as c, Conjugate as d, type MoveModifications as e, type AlgBranch as f, type PuzzleSpecificSimplifyOptions as g, type AppendCancelOptions as h };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Texture, Object3D, Raycaster, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import { P as Parsed } from './parseAlg.d-
|
|
4
|
-
import { s as KPuzzle, d as PuzzleGeometry, K as KPattern, t as KTransformation, u as PuzzleDescriptionString } from './KPattern.d-
|
|
2
|
+
import { g as PuzzleSpecificSimplifyOptions, M as Move, A as Alg, P as Pause, h as AppendCancelOptions, b as AlgLeaf, c as AppendOptions, a as AlgNode, I as IterationDirection } from './Alg.d-T-vs-GDG.js';
|
|
3
|
+
import { P as Parsed } from './parseAlg.d-tIlAma60.js';
|
|
4
|
+
import { s as KPuzzle, d as PuzzleGeometry, K as KPattern, t as KTransformation, u as PuzzleDescriptionString } from './KPattern.d-eWxoJtl0.js';
|
|
5
5
|
|
|
6
6
|
type FaceletMeshStickeringMask = "regular" | "dim" | "oriented" | "experimentalOriented2" | "ignored" | "invisible";
|
|
7
7
|
type FaceletStickeringMask = {
|
|
@@ -1364,4 +1364,4 @@ declare global {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
1366
|
|
|
1367
|
-
export { type AlgIndexer as A, type BackViewLayout as B, type Duration as D, type ExperimentalStickering as E, type MillisecondTimestamp as M, NO_VALUE as N, type PuzzleLoader as P, type StickeringMask as S, type Timestamp as T, type VisualizationFormat as V,
|
|
1367
|
+
export { type AlgIndexer as A, type BackViewLayout as B, type Duration as D, type ExperimentalStickering as E, type MillisecondTimestamp as M, NO_VALUE as N, type PuzzleLoader as P, type StickeringMask as S, type Timestamp as T, type VisualizationFormat as V, TwistyPlayer as a, TwistyAlgViewer as b, TwistyAlgEditor as c, type TwistyPlayerConfig as d, backViewLayouts as e, type PuzzleID as f, TwizzleLink as g };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as AlgNode, A as Alg, M as Move, c as AppendOptions, G as Grouping, C as Commutator, d as Conjugate,
|
|
2
|
-
export {
|
|
3
|
-
export { P as ExperimentalParsed } from '../parseAlg.d-
|
|
1
|
+
import { a as AlgNode, A as Alg, M as Move, c as AppendOptions, G as Grouping, C as Commutator, d as Conjugate, P as Pause, N as Newline, L as LineComment, b as AlgLeaf } from '../Alg.d-T-vs-GDG.js';
|
|
2
|
+
export { f as AlgBranch, h as AppendCancelOptions, e as MoveModifications, g as PuzzleSpecificSimplifyOptions, Q as QuantumMove, S as SimplifyOptions } from '../Alg.d-T-vs-GDG.js';
|
|
3
|
+
export { P as ExperimentalParsed } from '../parseAlg.d-tIlAma60.js';
|
|
4
4
|
|
|
5
5
|
/** @deprecated */
|
|
6
6
|
type Unit = AlgNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="web-bluetooth" />
|
|
2
|
-
import { K as KPattern } from '../KPattern.d-
|
|
3
|
-
import { B as BluetoothPuzzle } from '../bluetooth-puzzle.d-
|
|
4
|
-
export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle.d-
|
|
5
|
-
import { A as Alg, M as Move } from '../Alg.d-
|
|
2
|
+
import { K as KPattern } from '../KPattern.d-eWxoJtl0.js';
|
|
3
|
+
import { B as BluetoothPuzzle } from '../bluetooth-puzzle.d-NEYj0B8F.js';
|
|
4
|
+
export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle.d-NEYj0B8F.js';
|
|
5
|
+
import { A as Alg, M as Move } from '../Alg.d-T-vs-GDG.js';
|
|
6
6
|
|
|
7
7
|
declare function enableDebugLogging(enable: boolean): void;
|
|
8
8
|
|
package/dist/lib/cubing/{bluetooth-puzzle.d-CZReUDb1.d.ts → bluetooth-puzzle.d-NEYj0B8F.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="web-bluetooth" />
|
|
2
|
-
import { b as AlgLeaf } from './Alg.d-
|
|
3
|
-
import { K as KPattern } from './KPattern.d-
|
|
2
|
+
import { b as AlgLeaf } from './Alg.d-T-vs-GDG.js';
|
|
3
|
+
import { K as KPattern } from './KPattern.d-eWxoJtl0.js';
|
|
4
4
|
|
|
5
5
|
interface StreamTransformer {
|
|
6
6
|
transformAlgLeaf(algLeafEvent: AlgLeafEvent): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Alg } from './Alg.d-
|
|
2
|
-
import { K as KPattern, s as KPuzzle } from './KPattern.d-
|
|
1
|
+
import { A as Alg } from './Alg.d-T-vs-GDG.js';
|
|
2
|
+
import { K as KPattern, s as KPuzzle } from './KPattern.d-eWxoJtl0.js';
|
|
3
3
|
|
|
4
4
|
declare enum PrefetchLevel {
|
|
5
5
|
Auto = "auto",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { K as KPattern, w as KPatternData, x as KPatternOrbitData, s as KPuzzle, v as KPuzzleDefinition, t as KTransformation, y as KTransformationData, z as KTransformationOrbitData } from '../KPattern.d-
|
|
2
|
-
import '../Alg.d-
|
|
1
|
+
export { K as KPattern, w as KPatternData, x as KPatternOrbitData, s as KPuzzle, v as KPuzzleDefinition, t as KTransformation, y as KTransformationData, z as KTransformationOrbitData } from '../KPattern.d-eWxoJtl0.js';
|
|
2
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as Alg } from '../Alg.d-
|
|
2
|
-
import { P as PuzzleLoader } from '../TwizzleLink.d-
|
|
1
|
+
import { A as Alg } from '../Alg.d-T-vs-GDG.js';
|
|
2
|
+
import { P as PuzzleLoader } from '../TwizzleLink.d-S18moNia.js';
|
|
3
3
|
import 'three';
|
|
4
|
-
import '../parseAlg.d-
|
|
5
|
-
import '../KPattern.d-
|
|
4
|
+
import '../parseAlg.d-tIlAma60.js';
|
|
5
|
+
import '../KPattern.d-eWxoJtl0.js';
|
|
6
6
|
|
|
7
7
|
declare enum CommonMetric {
|
|
8
8
|
OuterBlockTurnMetric = "OBTM",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Perm } from '../KPattern.d-
|
|
2
|
-
export { q as EXPERIMENTAL_PUZZLE_BASE_SHAPES, n as EXPERIMENTAL_PUZZLE_CUT_TYPES, k as ExperimentalPGNotation, r as ExperimentalPuzzleBaseShape, l as ExperimentalPuzzleCutDescription, o as ExperimentalPuzzleCutType, m as ExperimentalPuzzleDescription, j as ExperimentalPuzzleGeometryOptions, d as PuzzleGeometry, Q as Quat, S as StickerDat, e as StickerDatAxis, f as StickerDatFace, h as StickerDatSticker, c as getPG3DNamedPuzzles, g as getPuzzleDescriptionString, a as getPuzzleGeometryByDesc, b as getPuzzleGeometryByName, i as parseOptions, p as parsePuzzleDescription } from '../KPattern.d-
|
|
3
|
-
import '../Alg.d-
|
|
1
|
+
import { P as Perm } from '../KPattern.d-eWxoJtl0.js';
|
|
2
|
+
export { q as EXPERIMENTAL_PUZZLE_BASE_SHAPES, n as EXPERIMENTAL_PUZZLE_CUT_TYPES, k as ExperimentalPGNotation, r as ExperimentalPuzzleBaseShape, l as ExperimentalPuzzleCutDescription, o as ExperimentalPuzzleCutType, m as ExperimentalPuzzleDescription, j as ExperimentalPuzzleGeometryOptions, d as PuzzleGeometry, Q as Quat, S as StickerDat, e as StickerDatAxis, f as StickerDatFace, h as StickerDatSticker, c as getPG3DNamedPuzzles, g as getPuzzleDescriptionString, a as getPuzzleGeometryByDesc, b as getPuzzleGeometryByName, i as parseOptions, p as parsePuzzleDescription } from '../KPattern.d-eWxoJtl0.js';
|
|
3
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
4
4
|
|
|
5
5
|
declare function schreierSims(g: Perm[], disp: (s: string) => void): bigint;
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as PuzzleSpecificSimplifyOptions } from '../Alg.d-B5bAxd5U.js';
|
|
3
|
-
import { s as KPuzzle, d as PuzzleGeometry } from '../KPattern.d-Iv89gNss.js';
|
|
1
|
+
import { f as PuzzleID, P as PuzzleLoader, E as ExperimentalStickering, S as StickeringMask } from '../TwizzleLink.d-S18moNia.js';
|
|
4
2
|
import 'three';
|
|
5
|
-
import '../
|
|
3
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
4
|
+
import '../parseAlg.d-tIlAma60.js';
|
|
5
|
+
import '../KPattern.d-eWxoJtl0.js';
|
|
6
6
|
|
|
7
7
|
interface EventInfo {
|
|
8
8
|
puzzleID: PuzzleID;
|
|
@@ -18,6 +18,877 @@ declare function eventInfo(event: string): EventInfo | null;
|
|
|
18
18
|
/** @category Specific Puzzles */
|
|
19
19
|
declare const cube2x2x2: PuzzleLoader;
|
|
20
20
|
|
|
21
|
+
declare enum IterationDirection {
|
|
22
|
+
Forwards = 1,
|
|
23
|
+
Backwards = -1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare abstract class Comparable {
|
|
27
|
+
is(c: any): boolean;
|
|
28
|
+
as<T>(c: new (...args: any) => T): T | null;
|
|
29
|
+
abstract isIdentical(other: Comparable): boolean;
|
|
30
|
+
}
|
|
31
|
+
interface Repeatable extends Comparable {
|
|
32
|
+
experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
|
|
33
|
+
}
|
|
34
|
+
declare abstract class AlgCommon<T extends Alg | AlgNode> extends Comparable implements Repeatable {
|
|
35
|
+
constructor();
|
|
36
|
+
get log(): (message?: any) => void;
|
|
37
|
+
abstract toString(): string;
|
|
38
|
+
abstract invert(): T;
|
|
39
|
+
abstract experimentalExpand(iterDir: IterationDirection): Generator<AlgLeaf>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface QuantumMoveModifications {
|
|
43
|
+
outerLayer?: number;
|
|
44
|
+
innerLayer?: number;
|
|
45
|
+
family?: string;
|
|
46
|
+
}
|
|
47
|
+
declare class QuantumMove extends Comparable {
|
|
48
|
+
#private;
|
|
49
|
+
constructor(family: string, innerLayer?: number | null, outerLayer?: number | null);
|
|
50
|
+
static fromString(s: string): QuantumMove;
|
|
51
|
+
modified(modifications: QuantumMoveModifications): QuantumMove;
|
|
52
|
+
isIdentical(other: QuantumMove): boolean;
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
get family(): string;
|
|
55
|
+
/** @deprecated */
|
|
56
|
+
get outerLayer(): number | null;
|
|
57
|
+
/** @deprecated */
|
|
58
|
+
get innerLayer(): number | null;
|
|
59
|
+
experimentalExpand(): Generator<AlgLeaf>;
|
|
60
|
+
toString(): string;
|
|
61
|
+
}
|
|
62
|
+
interface MoveModifications {
|
|
63
|
+
outerLayer?: number;
|
|
64
|
+
innerLayer?: number;
|
|
65
|
+
family?: string;
|
|
66
|
+
amount?: number;
|
|
67
|
+
}
|
|
68
|
+
/** @category Alg Nodes */
|
|
69
|
+
declare class Move extends AlgCommon<Move> {
|
|
70
|
+
#private;
|
|
71
|
+
constructor(...args: [QuantumMove] | [QuantumMove, number] | [string] | [string, number]);
|
|
72
|
+
isIdentical(other: Comparable): boolean;
|
|
73
|
+
invert(): Move;
|
|
74
|
+
experimentalExpand(iterDir?: IterationDirection): Generator<AlgLeaf>;
|
|
75
|
+
get quantum(): QuantumMove;
|
|
76
|
+
modified(modifications: MoveModifications): Move;
|
|
77
|
+
static fromString(s: string): Move;
|
|
78
|
+
get amount(): number;
|
|
79
|
+
/** @deprecated */
|
|
80
|
+
get type(): string;
|
|
81
|
+
/** @deprecated */
|
|
82
|
+
get family(): string;
|
|
83
|
+
/** @deprecated */
|
|
84
|
+
get outerLayer(): number | undefined;
|
|
85
|
+
/** @deprecated */
|
|
86
|
+
get innerLayer(): number | undefined;
|
|
87
|
+
toString(): string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** @category Alg Nodes */
|
|
91
|
+
declare class Pause extends AlgCommon<Pause> {
|
|
92
|
+
experimentalNISSGrouping?: Grouping;
|
|
93
|
+
toString(): string;
|
|
94
|
+
isIdentical(other: Comparable): boolean;
|
|
95
|
+
invert(): Pause;
|
|
96
|
+
experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @category Alg Nodes */
|
|
100
|
+
declare class Grouping extends AlgCommon<Grouping> {
|
|
101
|
+
#private;
|
|
102
|
+
experimentalNISSPlaceholder?: Pause;
|
|
103
|
+
constructor(algSource: FlexibleAlgSource, amount?: number);
|
|
104
|
+
isIdentical(other: Comparable): boolean;
|
|
105
|
+
get alg(): Alg;
|
|
106
|
+
get amount(): number;
|
|
107
|
+
/** @deprecated */
|
|
108
|
+
get experimentalRepetitionSuffix(): string;
|
|
109
|
+
invert(): Grouping;
|
|
110
|
+
experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
|
|
111
|
+
static fromString(): Grouping;
|
|
112
|
+
toString(): string;
|
|
113
|
+
experimentalAsSquare1Tuple(): [moveU: Move, moveD: Move] | null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @category Alg Nodes */
|
|
117
|
+
declare class LineComment extends AlgCommon<LineComment> {
|
|
118
|
+
#private;
|
|
119
|
+
constructor(commentText: string);
|
|
120
|
+
get text(): string;
|
|
121
|
+
isIdentical(other: Comparable): boolean;
|
|
122
|
+
invert(): LineComment;
|
|
123
|
+
experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
|
|
124
|
+
toString(): string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** @category Alg Nodes */
|
|
128
|
+
declare class Commutator extends AlgCommon<Commutator> {
|
|
129
|
+
#private;
|
|
130
|
+
constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource);
|
|
131
|
+
get A(): Alg;
|
|
132
|
+
get B(): Alg;
|
|
133
|
+
isIdentical(other: Comparable): boolean;
|
|
134
|
+
invert(): Commutator;
|
|
135
|
+
experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
|
|
136
|
+
toString(): string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** @category Alg Nodes */
|
|
140
|
+
declare class Conjugate extends AlgCommon<Conjugate> {
|
|
141
|
+
#private;
|
|
142
|
+
constructor(aSource: FlexibleAlgSource, bSource: FlexibleAlgSource);
|
|
143
|
+
get A(): Alg;
|
|
144
|
+
get B(): Alg;
|
|
145
|
+
isIdentical(other: Comparable): boolean;
|
|
146
|
+
invert(): Conjugate;
|
|
147
|
+
experimentalExpand(iterDir: IterationDirection, depth?: number): Generator<AlgLeaf>;
|
|
148
|
+
toString(): string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** @category Alg Nodes */
|
|
152
|
+
declare class Newline extends AlgCommon<Newline> {
|
|
153
|
+
toString(): string;
|
|
154
|
+
isIdentical(other: Comparable): boolean;
|
|
155
|
+
invert(): Newline;
|
|
156
|
+
experimentalExpand(_iterDir?: IterationDirection, _depth?: number): Generator<AlgLeaf>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** @category Alg Nodes */
|
|
160
|
+
type AlgLeaf = Move | LineComment | Newline | Pause;
|
|
161
|
+
/** @category Alg Nodes */
|
|
162
|
+
type AlgBranch = Grouping | Conjugate | Commutator;
|
|
163
|
+
/** @category Alg Nodes */
|
|
164
|
+
type AlgNode = AlgLeaf | AlgBranch;
|
|
165
|
+
|
|
166
|
+
declare const DEFAULT_DIRECTIONAL = "any-direction";
|
|
167
|
+
type QuantumDirectionalCancellation = typeof DEFAULT_DIRECTIONAL | "same-direction" | "none";
|
|
168
|
+
type ModWrap = "none" | "gravity" | "canonical-centered" | "canonical-positive" | "preserve-sign";
|
|
169
|
+
interface AppendCancelOptions {
|
|
170
|
+
directional?: QuantumDirectionalCancellation;
|
|
171
|
+
puzzleSpecificModWrap?: ModWrap;
|
|
172
|
+
}
|
|
173
|
+
interface AppendOptions {
|
|
174
|
+
cancel?: boolean | AppendCancelOptions;
|
|
175
|
+
puzzleLoader?: {
|
|
176
|
+
puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions;
|
|
177
|
+
};
|
|
178
|
+
puzzleSpecificSimplifyOptions?: PuzzleSpecificSimplifyOptions;
|
|
179
|
+
}
|
|
180
|
+
interface SimplifyOptions extends AppendOptions {
|
|
181
|
+
depth?: number | null;
|
|
182
|
+
}
|
|
183
|
+
interface PuzzleSpecificAxisSimplifyInfo {
|
|
184
|
+
areQuantumMovesSameAxis: (quantumMove1: QuantumMove, quantumMove2: QuantumMove) => boolean;
|
|
185
|
+
simplifySameAxisMoves: (moves: Move[], quantumMod: boolean) => Move[];
|
|
186
|
+
}
|
|
187
|
+
interface PuzzleSpecificSimplifyOptions {
|
|
188
|
+
quantumMoveOrder?: (quantumMove: QuantumMove) => number;
|
|
189
|
+
axis?: PuzzleSpecificAxisSimplifyInfo;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
type FlexibleAlgSource = string | Iterable<AlgNode> | Alg;
|
|
193
|
+
/**
|
|
194
|
+
* `Alg` is a class that encapsulates a structured alg. To create an `Alg` from a string, use:
|
|
195
|
+
*
|
|
196
|
+
* new Alg("R U R'"); // Convenient
|
|
197
|
+
* Alg.fromString(dynamicString); // Recommended when the string input is user-provided.
|
|
198
|
+
*
|
|
199
|
+
* Once you have an `Alg`, you can call methods to transform it:
|
|
200
|
+
*
|
|
201
|
+
* new Alg("[[R: U], R U R2']").expand().experimentalSimplify({cancel: true}).invert().log()
|
|
202
|
+
*
|
|
203
|
+
* To convert an `Alg` to a string, use .toString():
|
|
204
|
+
*
|
|
205
|
+
* new Alg("R U F").invert().toString();
|
|
206
|
+
*
|
|
207
|
+
* If you need to debug, you may also find it convenient to use .log():
|
|
208
|
+
*
|
|
209
|
+
* if (alg.isIdentical(alg.invert())) {
|
|
210
|
+
* alg.log("A self-inverse!")
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
* For more information, see: {@link https://js.cubing.net/cubing/alg/}
|
|
214
|
+
*
|
|
215
|
+
* @category Alg
|
|
216
|
+
*/
|
|
217
|
+
declare class Alg extends AlgCommon<Alg> {
|
|
218
|
+
#private;
|
|
219
|
+
constructor(alg?: FlexibleAlgSource);
|
|
220
|
+
/**
|
|
221
|
+
* Checks whether this Alg is structurally identical to another Alg. This
|
|
222
|
+
* essentially means that they are written identically apart from whitespace.
|
|
223
|
+
*
|
|
224
|
+
* const alg1 = new Alg("R U L'");
|
|
225
|
+
* const alg2 = new Alg("L U' R'").invert();
|
|
226
|
+
* // true
|
|
227
|
+
* alg1.isIdentical(alg2);
|
|
228
|
+
*
|
|
229
|
+
* // false
|
|
230
|
+
* new Alg("[R, U]").isIdentical(new Alg("R U R' U'"));
|
|
231
|
+
* // true
|
|
232
|
+
* new Alg("[R, U]").expand().isIdentical(new Alg("R U R' U'"));
|
|
233
|
+
*
|
|
234
|
+
* Note that .isIdentical() efficiently compares algorithms, but mainly exists
|
|
235
|
+
* to help optimize code when the structure of an algorithm hasn't changed.
|
|
236
|
+
* There are many ways to write the "same" alg on most puzzles, but is
|
|
237
|
+
* *highly* recommended to avoid expanding two Alg instances to compare them,
|
|
238
|
+
* since that can easily slow your program to a crawl if someone inputs an alg
|
|
239
|
+
* containing a large repetition. In general, you should use `cubing/kpuzzle`
|
|
240
|
+
* to compare if two algs have the same effect on a puzzle.
|
|
241
|
+
*
|
|
242
|
+
* Also note that parser annotations are not taken into account while comparing
|
|
243
|
+
* algs:
|
|
244
|
+
*
|
|
245
|
+
* const alg = new Alg([new Move("R"), new Move("U2")]);
|
|
246
|
+
* // true, even though one of the algs has parser annotations
|
|
247
|
+
* alg.isIdentical(new Alg("R U2"))
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
isIdentical(other: Comparable): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Returns the inverse of the given alg.
|
|
253
|
+
*
|
|
254
|
+
* Note that that this does not make any assumptions about what puzzle the alg
|
|
255
|
+
* is for. For example, U2 is its own inverse on a cube, but U2' has the same
|
|
256
|
+
* effect U3 (and not U2) on Megaminx:
|
|
257
|
+
*
|
|
258
|
+
* // Outputs: R U2' L'
|
|
259
|
+
* new Alg("L U2 R'").invert().log();
|
|
260
|
+
*/
|
|
261
|
+
invert(): Alg;
|
|
262
|
+
/** @deprecated Use {@link Alg.expand} instead. */
|
|
263
|
+
experimentalExpand(iterDir?: IterationDirection, depth?: number): Generator<AlgLeaf>;
|
|
264
|
+
/**
|
|
265
|
+
* Expands all Grouping, Commutator, and Conjugate parts nested inside the
|
|
266
|
+
* alg.
|
|
267
|
+
*
|
|
268
|
+
* // F R U R' U' F'
|
|
269
|
+
* new Alg("[F: [R, U]]").expand().log();
|
|
270
|
+
*
|
|
271
|
+
* // F [R, U] F'
|
|
272
|
+
* new Alg("[F: [R, U]]").expand(({ depth: 1 }).log();
|
|
273
|
+
*
|
|
274
|
+
* Avoid calling this on a user-provided alg unless the user explicitly asks
|
|
275
|
+
* to see the expanded alg. Otherwise, it's easy to make your program freeze
|
|
276
|
+
* when someone passes in an alg like: (R U)10000000
|
|
277
|
+
*
|
|
278
|
+
* Generally, if you want to perform an operation on an entire alg, you'll
|
|
279
|
+
* want to use something based on the `Traversal` mechanism, like countMoves()
|
|
280
|
+
* from `cubing/notation`.
|
|
281
|
+
*/
|
|
282
|
+
expand(options?: {
|
|
283
|
+
depth?: number;
|
|
284
|
+
}): Alg;
|
|
285
|
+
/** @deprecated */
|
|
286
|
+
experimentalLeafMoves(): Generator<Move>;
|
|
287
|
+
concat(input: FlexibleAlgSource): Alg;
|
|
288
|
+
/** @deprecated */
|
|
289
|
+
experimentalIsEmpty(): boolean;
|
|
290
|
+
static fromString(s: string): Alg;
|
|
291
|
+
/** @deprecated */
|
|
292
|
+
units(): Generator<AlgNode>;
|
|
293
|
+
childAlgNodes(): Generator<AlgNode>;
|
|
294
|
+
/** @deprecated */
|
|
295
|
+
experimentalNumUnits(): number;
|
|
296
|
+
experimentalNumChildAlgNodes(): number;
|
|
297
|
+
/** @deprecated */
|
|
298
|
+
get type(): string;
|
|
299
|
+
/**
|
|
300
|
+
* Converts the Alg to a string:
|
|
301
|
+
*
|
|
302
|
+
* const alg = new Alg([new Move("R"), new Move("U2"), new Move("L")])
|
|
303
|
+
* // R U2 L
|
|
304
|
+
* console.log(alg.toString())
|
|
305
|
+
*/
|
|
306
|
+
toString(): string;
|
|
307
|
+
/**
|
|
308
|
+
* `experimentalSimplify` can perform several mostly-syntactic simplifications on an alg:
|
|
309
|
+
*
|
|
310
|
+
* // Logs: R' U3
|
|
311
|
+
* import { Alg } from "cubing/alg";
|
|
312
|
+
* new Alg("R R2' U U2").experimentalSimplify({ cancel: true }).log()
|
|
313
|
+
*
|
|
314
|
+
* You can pass in a `PuzzleLoader` (currently only for 3x3x3) for puzzle-specific simplifications:
|
|
315
|
+
*
|
|
316
|
+
* // Logs: R' U'
|
|
317
|
+
* import { Alg } from "cubing/alg";
|
|
318
|
+
* import { cube3x3x3 } from "cubing/puzzles";
|
|
319
|
+
* new Alg("R R2' U U2").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
|
|
320
|
+
*
|
|
321
|
+
* You can also cancel only moves that are in the same direction:
|
|
322
|
+
*
|
|
323
|
+
* // Logs: R R2' U'
|
|
324
|
+
* import { Alg } from "cubing/alg";
|
|
325
|
+
* import { cube3x3x3 } from "cubing/puzzles";
|
|
326
|
+
* new Alg("R R2' U U2").experimentalSimplify({
|
|
327
|
+
* cancel: { directional: "same-direction" },
|
|
328
|
+
* puzzleLoader: cube3x3x3
|
|
329
|
+
* }).log()
|
|
330
|
+
*
|
|
331
|
+
* Additionally, you can specify how moves are "wrapped":
|
|
332
|
+
*
|
|
333
|
+
* import { Alg } from "cubing/alg";
|
|
334
|
+
* import { cube3x3x3 } from "cubing/puzzles";
|
|
335
|
+
*
|
|
336
|
+
* function example(puzzleSpecificModWrap) {
|
|
337
|
+
* alg.experimentalSimplify({
|
|
338
|
+
* cancel: { puzzleSpecificModWrap },
|
|
339
|
+
* puzzleLoader: cube3x3x3
|
|
340
|
+
* }).log()
|
|
341
|
+
* }
|
|
342
|
+
*
|
|
343
|
+
* const alg = new Alg("R7' . R6' . R5' . R6")
|
|
344
|
+
* example("none") // R7' . R6' . R5' . R6
|
|
345
|
+
* example("gravity") // R . R2' . R' . R2
|
|
346
|
+
* example("canonical-centered") // R . R2 . R' . R2
|
|
347
|
+
* example("canonical-positive") // R . R2 . R3 . R2
|
|
348
|
+
* example("preserve-sign") // R3' . R2' . R' . R2
|
|
349
|
+
*
|
|
350
|
+
* Same-axis and simultaneous move canonicalization is not implemented yet:
|
|
351
|
+
*
|
|
352
|
+
* // Logs: R L R
|
|
353
|
+
* import { Alg } from "cubing/alg";
|
|
354
|
+
* import { cube3x3x3 } from "cubing/puzzles";
|
|
355
|
+
* new Alg("R L R").experimentalSimplify({ cancel: true, puzzleLoader: cube3x3x3 }).log()
|
|
356
|
+
*/
|
|
357
|
+
experimentalSimplify(options?: SimplifyOptions): Alg;
|
|
358
|
+
/** @deprecated See {@link experimentalSimplify} */
|
|
359
|
+
simplify(options?: SimplifyOptions): Alg;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
declare class KTransformation {
|
|
363
|
+
#private;
|
|
364
|
+
readonly kpuzzle: KPuzzle;
|
|
365
|
+
readonly transformationData: KTransformationData;
|
|
366
|
+
constructor(kpuzzle: KPuzzle, transformationData: KTransformationData);
|
|
367
|
+
toJSON(): any;
|
|
368
|
+
invert(): KTransformation;
|
|
369
|
+
isIdentityTransformation(): boolean;
|
|
370
|
+
/** @deprecated */
|
|
371
|
+
static experimentalConstructIdentity(kpuzzle: KPuzzle): KTransformation;
|
|
372
|
+
isIdentical(t2: KTransformation): boolean;
|
|
373
|
+
/** @deprecated */
|
|
374
|
+
apply(source: KTransformationSource): KTransformation;
|
|
375
|
+
applyTransformation(t2: KTransformation): KTransformation;
|
|
376
|
+
applyMove(move: Move | string): KTransformation;
|
|
377
|
+
applyAlg(alg: Alg | string): KTransformation;
|
|
378
|
+
toKPattern(): KPattern;
|
|
379
|
+
repetitionOrder(): number;
|
|
380
|
+
selfMultiply(amount: number): KTransformation;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
declare class KPattern {
|
|
384
|
+
readonly kpuzzle: KPuzzle;
|
|
385
|
+
readonly patternData: KPatternData;
|
|
386
|
+
constructor(kpuzzle: KPuzzle, patternData: KPatternData);
|
|
387
|
+
toJSON(): any;
|
|
388
|
+
static fromTransformation(transformation: KTransformation): KPattern;
|
|
389
|
+
/** @deprecated */
|
|
390
|
+
apply(source: KTransformationSource): KPattern;
|
|
391
|
+
applyTransformation(transformation: KTransformation): KPattern;
|
|
392
|
+
applyMove(move: Move | string): KPattern;
|
|
393
|
+
applyAlg(alg: Alg | string): KPattern;
|
|
394
|
+
isIdentical(other: KPattern): boolean;
|
|
395
|
+
/** @deprecated */
|
|
396
|
+
experimentalToTransformation(): KTransformation | null;
|
|
397
|
+
experimentalIsSolved(options: {
|
|
398
|
+
ignorePuzzleOrientation: boolean;
|
|
399
|
+
ignoreCenterOrientation: boolean;
|
|
400
|
+
}): boolean;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
type KPatternData = Record<string, KPatternOrbitData>;
|
|
404
|
+
interface KPatternOrbitData {
|
|
405
|
+
pieces: number[];
|
|
406
|
+
orientation: number[];
|
|
407
|
+
/** Each piece may have an "orientation mod" that means "the orientation of
|
|
408
|
+
* this piece is known mod [value]".
|
|
409
|
+
*
|
|
410
|
+
* Suppose `.numOrientations` for this orbit has a value of N. This is
|
|
411
|
+
* considered the default value for the orientation mod of each piece in the
|
|
412
|
+
* orbit.
|
|
413
|
+
*
|
|
414
|
+
* - Each entry must be one of the following:
|
|
415
|
+
* - A proper divisor of N.
|
|
416
|
+
* - For example: if N is 12, then one of: 1, 2, 3, 6
|
|
417
|
+
* - The special value 0, indicating the default value (N).
|
|
418
|
+
* - This indicates that the orientation of a piece is fully known, i.e.
|
|
419
|
+
* that its "orientation mod" is the default value (N). However, such a
|
|
420
|
+
* value is recorded as 0 instead of N, in order to make it simpler to
|
|
421
|
+
* implement and debug pattern logic involving the default value.
|
|
422
|
+
* - If `.orientationMod[i]` is a proper divisor of N (i.e. not 0), then
|
|
423
|
+
* `.orientation[i]` must be less than `.orientationMod[i]`. That is, the
|
|
424
|
+
* orientation values must be individually "normalized" for each piece.
|
|
425
|
+
* - If the `orientationMod` field is not present, then every piece is
|
|
426
|
+
* considered to have the default value for its "orientation mod".
|
|
427
|
+
*
|
|
428
|
+
* For a "real-world" example of this concept, consider a traditional analog
|
|
429
|
+
* 12-hour clock dial, like one that might hang on the wall in a school room.
|
|
430
|
+
* Although there are 24 hours in a day, A.M. and P.M. times are not
|
|
431
|
+
* distinguishable on such a clock. Since 3:00 (AM) and 15:00 are not
|
|
432
|
+
* distinguishable, we would read either of those times as 3:00 with an
|
|
433
|
+
* implicit "orientation mod" of 12.
|
|
434
|
+
*
|
|
435
|
+
* For most puzzles, however, we care about "visual" indistinguishability
|
|
436
|
+
* rather than "temporal" indistinguishability. To adapt the previous example,
|
|
437
|
+
* imagine a 24-hour clock with 24 hour marks around the dial, but where the
|
|
438
|
+
* hour hand is symmetric and points equally at the current hour as well as
|
|
439
|
+
* its diametic opposite (like a compass needle but painted all in one color).
|
|
440
|
+
* This has the same set of "valid patterns" as a normal 12-hour clock. Such a
|
|
441
|
+
* clock also has an "orientation mod" of 12, but where the multiples of the
|
|
442
|
+
* modulus have been "unfolded" to show their full symmetry instead of being
|
|
443
|
+
* implicit.
|
|
444
|
+
*
|
|
445
|
+
* For a non-trivial puzzle example, consider Eitan's FisherTwist, a shape mod
|
|
446
|
+
* of the 3x3x3 cube:
|
|
447
|
+
* https://www.hknowstore.com/locale/en-US/item.aspx?corpname=nowstore&itemid=97eb4e89-367e-4d02-b7f0-34e5e7f3cd12
|
|
448
|
+
*
|
|
449
|
+
* - The 4 equatorial centers have C₂ symmetry — it is possible to rotate any
|
|
450
|
+
* of these centers 180° without a visible change to the state. This means
|
|
451
|
+
* that the possible orientations "loop" after incrementing the orientation
|
|
452
|
+
* by 2 (two turns clockwise), and therefore the "orientation mod" of a
|
|
453
|
+
* given piece is only 2.
|
|
454
|
+
* - If we apply a counter-clockwise rotation to one of these centers, the
|
|
455
|
+
* transformation applies an orientation of 3. But the net orientation is
|
|
456
|
+
* recorded as a normalized value of 1 instead, because 3 (mod 2) ≡ 1 (mod
|
|
457
|
+
* 2).
|
|
458
|
+
* - The 2 polar centers (U and D) have no distinguishable rotations. This
|
|
459
|
+
* means that their orientation is "known mod 1" — any transformation of one
|
|
460
|
+
* of these centers is indistinguishable from another transformation of the
|
|
461
|
+
* same center, and all of them are mapped to a value of 0 (the only
|
|
462
|
+
* possible value that exists mod 1).
|
|
463
|
+
*
|
|
464
|
+
* For 3x3x3:
|
|
465
|
+
*
|
|
466
|
+
* - When solving a normal 3x3x3, center orientations are conventionally
|
|
467
|
+
* ignored. This is similar to the polar center case for Eitan's
|
|
468
|
+
* FisherTwist, and the "orientation mod" of each piece is 1. This is also
|
|
469
|
+
* the core motivating use case.
|
|
470
|
+
* - For a supercube
|
|
471
|
+
* (https://experiments.cubing.net/cubing.js/twisty/supercube.html) or the
|
|
472
|
+
* general case of a "picture cube", all four center orientations are
|
|
473
|
+
* distinguishable for every center. This means all centers have the default
|
|
474
|
+
* orientation mod of 4. As documented above, this can be recorded with a
|
|
475
|
+
* `.orientationMod` of `[0, 0, 0, 0, 0, 0]`, or equivalently by omitting
|
|
476
|
+
* the `.orientationMod` field.
|
|
477
|
+
* - When modeling a real 3x3x3 speedcube, it is common to have a logo on a
|
|
478
|
+
* single sticker. If you want to model the exact visually distinguishable
|
|
479
|
+
* states of such a puzzles, it is possible to use an `.orientationMod` such
|
|
480
|
+
* as `[0, 1, 1, 1, 1, 1]`. For example, this can make it easy to find an
|
|
481
|
+
* alg for a given case "while keeping the logo the same", without placing
|
|
482
|
+
* more restrictions on other centers (which could make the search slower or
|
|
483
|
+
* produce longer solutions).
|
|
484
|
+
*
|
|
485
|
+
* For those with a mathematical background, you may notice a relationship to
|
|
486
|
+
* the concept of a coset (https://en.wikipedia.org/wiki/Coset). For example,
|
|
487
|
+
* consider the group of patterns of a `KPuzzle` (without indistinguishable
|
|
488
|
+
* pieces) generated by a set of transformations. We can assign each set of
|
|
489
|
+
* piece orbits an orientation mod value (which must be identical for all
|
|
490
|
+
* constituent pieces of the same orbit). Each such choice generates a set of
|
|
491
|
+
* valid `KPattern`s that forms a subgroup, and each set of valid `.orientation`
|
|
492
|
+
* values defines one coset of this set. However, note that the set of valid
|
|
493
|
+
* `KPattern`s does *not* form a group when there are any pieces with different
|
|
494
|
+
* `.orientationMod` values that share an orbit.
|
|
495
|
+
*
|
|
496
|
+
* --------
|
|
497
|
+
*
|
|
498
|
+
* Note that the concept of "orientation mod" exclusively applies to `KPattern`,
|
|
499
|
+
* not `KTransformation`. If we tried to apply the orientation mod
|
|
500
|
+
* calculations to the *transformations* of Eitan's FisherTwist, then `SWAP =
|
|
501
|
+
* [U, M' E2 M]` would be indistinguishable from the identity. This would mean
|
|
502
|
+
* that if we calculated `SWAP` and then used this calculation for `S SWAP
|
|
503
|
+
* S'`, then we would conclude that it has no net effect. However, `S SWAP S'`
|
|
504
|
+
* does *not* have the same effect as doing nothing — it visibly rotates the L
|
|
505
|
+
* and R centers! (In mathematical terms: the set of `KTransformation`s would
|
|
506
|
+
* not form a valid set of semigroup actions, due to broken associativity.)
|
|
507
|
+
*
|
|
508
|
+
* Although there are times that we could theoretically save some time/space
|
|
509
|
+
* by ignoring some information when it's not needed for working with certain
|
|
510
|
+
* `KTransformation`s (e.g. ignoring all center orientations for 3x3x3), it is
|
|
511
|
+
* more practical for each `KTransformation` to always track the full range
|
|
512
|
+
* for each piece's `.orientation`. For example:
|
|
513
|
+
*
|
|
514
|
+
* - This is simpler, both conceptually and in code.
|
|
515
|
+
* - This allows changing the set of moves for a puzzle, without recalculating
|
|
516
|
+
* cached transformations or certain lookup tables (useful for alg
|
|
517
|
+
* searches).
|
|
518
|
+
* - This allows swapping out a normal 3x3x3 in a `<twisty-player>` for a
|
|
519
|
+
* picture cube, without re-calculating the center orientations of the
|
|
520
|
+
* current alg.
|
|
521
|
+
*
|
|
522
|
+
* These use cases may not be strictly "necessary", but the opposite behaviour
|
|
523
|
+
* might be surprising or frustrating if someone does not expect it. So we
|
|
524
|
+
* implement it this way.
|
|
525
|
+
*
|
|
526
|
+
* Informally, the `KTransformation` has the full responsibility for tracking
|
|
527
|
+
* "what really happens" — even if the effect is invisible in some cases,
|
|
528
|
+
* while the `KPattern` tracks both what "is" and what "isn't" known.
|
|
529
|
+
**/
|
|
530
|
+
orientationMod?: number[];
|
|
531
|
+
}
|
|
532
|
+
type KTransformationData = Record<string, KTransformationOrbitData>;
|
|
533
|
+
interface KTransformationOrbitData {
|
|
534
|
+
permutation: number[];
|
|
535
|
+
orientationDelta: number[];
|
|
536
|
+
}
|
|
537
|
+
interface KPuzzleOrbitDefinition {
|
|
538
|
+
orbitName: string;
|
|
539
|
+
numPieces: number;
|
|
540
|
+
numOrientations: number;
|
|
541
|
+
}
|
|
542
|
+
interface KPuzzleDefinition {
|
|
543
|
+
name: string;
|
|
544
|
+
orbits: KPuzzleOrbitDefinition[];
|
|
545
|
+
defaultPattern: KPatternData;
|
|
546
|
+
moves: Record<string, KTransformationData>;
|
|
547
|
+
derivedMoves?: Record<string, string>;
|
|
548
|
+
experimentalIsPatternSolved?: (kpattern: KPattern, options: {
|
|
549
|
+
ignorePuzzleOrientation: boolean;
|
|
550
|
+
ignoreCenterOrientation: boolean;
|
|
551
|
+
}) => boolean;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
type KTransformationSource = Alg | Move | string | KTransformation;
|
|
555
|
+
declare class KPuzzle {
|
|
556
|
+
#private;
|
|
557
|
+
readonly definition: KPuzzleDefinition;
|
|
558
|
+
private experimentalPGNotation;
|
|
559
|
+
constructor(definition: KPuzzleDefinition, options?: {
|
|
560
|
+
experimentalPGNotation?: PGNotation;
|
|
561
|
+
});
|
|
562
|
+
lookupOrbitDefinition(orbitName: string): KPuzzleOrbitDefinition;
|
|
563
|
+
name(): string;
|
|
564
|
+
identityTransformation(): KTransformation;
|
|
565
|
+
moveToTransformation(move: Move | string): KTransformation;
|
|
566
|
+
algToTransformation(alg: Alg | string): KTransformation;
|
|
567
|
+
/** @deprecated */
|
|
568
|
+
toTransformation(source: KTransformationSource): KTransformation;
|
|
569
|
+
defaultPattern(): KPattern;
|
|
570
|
+
canConvertDefaultPatternToUniqueTransformation(): boolean;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
interface NotationMapper {
|
|
574
|
+
notationToInternal(move: Move): Move | null;
|
|
575
|
+
notationToExternal(move: Move): Move | null;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
type FaceName = string;
|
|
579
|
+
type OrientationDirection = [number, number, number];
|
|
580
|
+
type FaceBasedOrientationDescription = [
|
|
581
|
+
[
|
|
582
|
+
FaceName,
|
|
583
|
+
OrientationDirection
|
|
584
|
+
],
|
|
585
|
+
[
|
|
586
|
+
FaceName,
|
|
587
|
+
OrientationDirection
|
|
588
|
+
]
|
|
589
|
+
];
|
|
590
|
+
type BaseFaceCount = 4 | 6 | 8 | 12 | 20;
|
|
591
|
+
type FaceBasedOrientationDescriptionLookup = Record<BaseFaceCount, FaceBasedOrientationDescription>;
|
|
592
|
+
declare class PuzzleGeometryFullOptions {
|
|
593
|
+
verbosity: number;
|
|
594
|
+
allMoves: boolean;
|
|
595
|
+
outerBlockMoves: boolean;
|
|
596
|
+
vertexMoves: boolean;
|
|
597
|
+
addRotations: boolean;
|
|
598
|
+
moveList: string[] | null;
|
|
599
|
+
fixedOrientation: boolean;
|
|
600
|
+
fixedPieceType: null | "e" | "v" | "f";
|
|
601
|
+
orientCenters: boolean;
|
|
602
|
+
includeCornerOrbits: boolean;
|
|
603
|
+
includeCenterOrbits: boolean;
|
|
604
|
+
includeEdgeOrbits: boolean;
|
|
605
|
+
excludeOrbits: string[];
|
|
606
|
+
optimizeOrbits: boolean;
|
|
607
|
+
grayCorners: boolean;
|
|
608
|
+
grayCenters: boolean;
|
|
609
|
+
grayEdges: boolean;
|
|
610
|
+
puzzleOrientation: FaceBasedOrientationDescription | null;
|
|
611
|
+
puzzleOrientations: FaceBasedOrientationDescriptionLookup | null;
|
|
612
|
+
scrambleAmount: number;
|
|
613
|
+
constructor(options?: PuzzleGeometryOptions);
|
|
614
|
+
}
|
|
615
|
+
type PuzzleGeometryOptions = Partial<PuzzleGeometryFullOptions>;
|
|
616
|
+
|
|
617
|
+
declare class Perm {
|
|
618
|
+
n: number;
|
|
619
|
+
p: number[];
|
|
620
|
+
constructor(a: number[]);
|
|
621
|
+
toString(): string;
|
|
622
|
+
mul(p2: Perm): Perm;
|
|
623
|
+
rmul(p2: Perm): Perm;
|
|
624
|
+
inv(): Perm;
|
|
625
|
+
compareTo(p2: Perm): number;
|
|
626
|
+
toGap(): string;
|
|
627
|
+
toMathematica(): string;
|
|
628
|
+
order(): number;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
declare class PGOrbitDef {
|
|
632
|
+
size: number;
|
|
633
|
+
mod: number;
|
|
634
|
+
constructor(size: number, mod: number);
|
|
635
|
+
reassemblySize(): bigint;
|
|
636
|
+
}
|
|
637
|
+
declare class PGOrbitsDef {
|
|
638
|
+
orbitnames: string[];
|
|
639
|
+
private orbitdefs;
|
|
640
|
+
solved: VisibleState;
|
|
641
|
+
movenames: string[];
|
|
642
|
+
moveops: PGTransform[];
|
|
643
|
+
isRotation: boolean[];
|
|
644
|
+
forcenames: boolean[];
|
|
645
|
+
constructor(orbitnames: string[], orbitdefs: PGOrbitDef[], solved: VisibleState, movenames: string[], moveops: PGTransform[], isRotation: boolean[], forcenames: boolean[]);
|
|
646
|
+
toKTransformationData(t: PGTransform): KTransformationData;
|
|
647
|
+
toKPatternData(t: PGTransform): KPatternData;
|
|
648
|
+
static transformToKTransformationData(orbitnames: string[], t: PGTransform): KTransformationData;
|
|
649
|
+
private describeSet;
|
|
650
|
+
toKsolve(name: string, mapper?: NotationMapper): string[];
|
|
651
|
+
toKPuzzleDefinition(includemoves: boolean): KPuzzleDefinition;
|
|
652
|
+
optimize(): PGOrbitsDef;
|
|
653
|
+
scramble(n: number): void;
|
|
654
|
+
getScrambleTransformation(n: number): PGTransform;
|
|
655
|
+
reassemblySize(): bigint;
|
|
656
|
+
}
|
|
657
|
+
declare class PGOrbit {
|
|
658
|
+
perm: number[];
|
|
659
|
+
ori: number[];
|
|
660
|
+
orimod: number;
|
|
661
|
+
private static ktransformationCache;
|
|
662
|
+
static e(n: number, mod: number): PGOrbit;
|
|
663
|
+
constructor(perm: number[], ori: number[], orimod: number);
|
|
664
|
+
mul(b: PGOrbit): PGOrbit;
|
|
665
|
+
inv(): PGOrbit;
|
|
666
|
+
equal(b: PGOrbit): boolean;
|
|
667
|
+
killOri(): this;
|
|
668
|
+
toPerm(): Perm;
|
|
669
|
+
identicalPieces(): number[][];
|
|
670
|
+
order(): number;
|
|
671
|
+
isIdentity(): boolean;
|
|
672
|
+
private zeroOris;
|
|
673
|
+
remap(no: number[], on: number[], nv: number): PGOrbit;
|
|
674
|
+
remapVS(no: number[], nv: number): PGOrbit;
|
|
675
|
+
appendDefinition(result: string[], name: string, useVS: boolean, concise?: boolean): void;
|
|
676
|
+
toKTransformationOrbitData(): KTransformationOrbitData;
|
|
677
|
+
toKPatternOrbitData(): KPatternOrbitData;
|
|
678
|
+
}
|
|
679
|
+
declare class PGTransformBase {
|
|
680
|
+
orbits: PGOrbit[];
|
|
681
|
+
constructor(orbits: PGOrbit[]);
|
|
682
|
+
internalMul(b: PGTransformBase): PGOrbit[];
|
|
683
|
+
protected internalInv(): PGOrbit[];
|
|
684
|
+
equal(b: PGTransformBase): boolean;
|
|
685
|
+
protected killOri(): this;
|
|
686
|
+
toPerm(): Perm;
|
|
687
|
+
identicalPieces(): number[][];
|
|
688
|
+
order(): number;
|
|
689
|
+
}
|
|
690
|
+
declare class PGTransform extends PGTransformBase {
|
|
691
|
+
mul(b: PGTransform): PGTransform;
|
|
692
|
+
mulScalar(n: number): PGTransform;
|
|
693
|
+
inv(): PGTransform;
|
|
694
|
+
e(): PGTransform;
|
|
695
|
+
}
|
|
696
|
+
declare class VisibleState extends PGTransformBase {
|
|
697
|
+
mul(b: PGTransform): VisibleState;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
declare class Quat {
|
|
701
|
+
a: number;
|
|
702
|
+
b: number;
|
|
703
|
+
c: number;
|
|
704
|
+
d: number;
|
|
705
|
+
constructor(a: number, b: number, c: number, d: number);
|
|
706
|
+
mul(q: Quat): Quat;
|
|
707
|
+
toString(): string;
|
|
708
|
+
dist(q: Quat): number;
|
|
709
|
+
len(): number;
|
|
710
|
+
cross(q: Quat): Quat;
|
|
711
|
+
dot(q: Quat): number;
|
|
712
|
+
normalize(): Quat;
|
|
713
|
+
makenormal(): Quat;
|
|
714
|
+
normalizeplane(): Quat;
|
|
715
|
+
smul(m: number): Quat;
|
|
716
|
+
sum(q: Quat): Quat;
|
|
717
|
+
sub(q: Quat): Quat;
|
|
718
|
+
angle(): number;
|
|
719
|
+
invrot(): Quat;
|
|
720
|
+
det3x3(a00: number, a01: number, a02: number, a10: number, a11: number, a12: number, a20: number, a21: number, a22: number): number;
|
|
721
|
+
rotateplane(q: Quat): Quat;
|
|
722
|
+
orthogonal(): Quat;
|
|
723
|
+
pointrotation(b: Quat): Quat;
|
|
724
|
+
unproject(b: Quat): Quat;
|
|
725
|
+
rotatepoint(q: Quat): Quat;
|
|
726
|
+
rotateface(face: Quat[]): Quat[];
|
|
727
|
+
intersect3(p2: Quat, p3: Quat): Quat | false;
|
|
728
|
+
side(x: number): number;
|
|
729
|
+
/**
|
|
730
|
+
* Cuts a face by this plane, or returns null if there
|
|
731
|
+
* is no intersection.
|
|
732
|
+
* @param face The face to cut.
|
|
733
|
+
*/
|
|
734
|
+
cutface(face: Quat[]): Quat[][] | null;
|
|
735
|
+
cutfaces(faces: Quat[][]): Quat[][];
|
|
736
|
+
faceside(face: Quat[]): number;
|
|
737
|
+
sameplane(p: Quat): boolean;
|
|
738
|
+
makecut(r: number): Quat;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
interface TextureMapper {
|
|
742
|
+
getuv(fn: number, threed: number[]): number[];
|
|
743
|
+
}
|
|
744
|
+
interface StickerDatSticker {
|
|
745
|
+
coords: number[];
|
|
746
|
+
color: string;
|
|
747
|
+
orbit: string;
|
|
748
|
+
ord: number;
|
|
749
|
+
ori: number;
|
|
750
|
+
face: number;
|
|
751
|
+
isDup?: boolean;
|
|
752
|
+
}
|
|
753
|
+
interface StickerDatFace {
|
|
754
|
+
coords: number[];
|
|
755
|
+
name: string;
|
|
756
|
+
}
|
|
757
|
+
type StickerDatAxis = {
|
|
758
|
+
coordinates: number[];
|
|
759
|
+
quantumMove: Move;
|
|
760
|
+
order: number;
|
|
761
|
+
};
|
|
762
|
+
interface StickerDat {
|
|
763
|
+
stickers: StickerDatSticker[];
|
|
764
|
+
faces: StickerDatFace[];
|
|
765
|
+
axis: StickerDatAxis[];
|
|
766
|
+
unswizzle(mv: Move): Move | null;
|
|
767
|
+
notationMapper: NotationMapper;
|
|
768
|
+
textureMapper: TextureMapper;
|
|
769
|
+
}
|
|
770
|
+
declare const PUZZLE_BASE_SHAPES: readonly ["c", "t", "o", "d", "i"];
|
|
771
|
+
type PuzzleBaseShape = (typeof PUZZLE_BASE_SHAPES)[number];
|
|
772
|
+
declare const PUZZLE_CUT_TYPES: readonly ["f", "v", "e"];
|
|
773
|
+
type PuzzleCutType = (typeof PUZZLE_CUT_TYPES)[number];
|
|
774
|
+
type PuzzleCutDescription = {
|
|
775
|
+
cutType: PuzzleCutType;
|
|
776
|
+
distance: number;
|
|
777
|
+
};
|
|
778
|
+
type PuzzleDescription = {
|
|
779
|
+
shape: PuzzleBaseShape;
|
|
780
|
+
cuts: PuzzleCutDescription[];
|
|
781
|
+
};
|
|
782
|
+
type MoveSetGeo = [string, string, string, string, number];
|
|
783
|
+
/** @category PuzzleGeometry */
|
|
784
|
+
declare class PuzzleGeometry {
|
|
785
|
+
puzzleDescription: PuzzleDescription;
|
|
786
|
+
private rotations;
|
|
787
|
+
baseplanerot: Quat[];
|
|
788
|
+
private baseplanes;
|
|
789
|
+
private facenames;
|
|
790
|
+
private faceplanes;
|
|
791
|
+
private edgenames;
|
|
792
|
+
private vertexnames;
|
|
793
|
+
private geonormals;
|
|
794
|
+
private moveplanes;
|
|
795
|
+
private moveplanes2;
|
|
796
|
+
moveplanesets: Quat[][];
|
|
797
|
+
private moveplanenormals;
|
|
798
|
+
movesetorders: number[];
|
|
799
|
+
movesetgeos: MoveSetGeo[];
|
|
800
|
+
private basefaces;
|
|
801
|
+
private faces;
|
|
802
|
+
private facecentermass;
|
|
803
|
+
private baseFaceCount;
|
|
804
|
+
stickersperface: number;
|
|
805
|
+
shortedge: number;
|
|
806
|
+
private markedface;
|
|
807
|
+
cubies: number[][];
|
|
808
|
+
private vertexdistance;
|
|
809
|
+
private edgedistance;
|
|
810
|
+
private facetocubie;
|
|
811
|
+
private facetoord;
|
|
812
|
+
private moverotations;
|
|
813
|
+
private facelisthash;
|
|
814
|
+
private cubiesetnames;
|
|
815
|
+
private cubieords;
|
|
816
|
+
private cubiesetnums;
|
|
817
|
+
private cubieordnums;
|
|
818
|
+
private orbitoris;
|
|
819
|
+
private cubievaluemap;
|
|
820
|
+
private cubiesetcubies;
|
|
821
|
+
cmovesbyslice: number[][][];
|
|
822
|
+
parsedmovelist: [
|
|
823
|
+
string | undefined,
|
|
824
|
+
number,
|
|
825
|
+
number,
|
|
826
|
+
number,
|
|
827
|
+
boolean,
|
|
828
|
+
number
|
|
829
|
+
][];
|
|
830
|
+
private duplicatedFaces;
|
|
831
|
+
private duplicatedCubies;
|
|
832
|
+
private fixedCubie;
|
|
833
|
+
private net;
|
|
834
|
+
private colors;
|
|
835
|
+
private swizzler;
|
|
836
|
+
notationMapper: NotationMapper;
|
|
837
|
+
private addNotationMapper;
|
|
838
|
+
private setReidOrder;
|
|
839
|
+
private options;
|
|
840
|
+
constructor(puzzleDescription: PuzzleDescription, options: PuzzleGeometryOptions);
|
|
841
|
+
create(puzzleDescription: PuzzleDescription): void;
|
|
842
|
+
private keyface;
|
|
843
|
+
private keyface2;
|
|
844
|
+
private keyface3;
|
|
845
|
+
private findface;
|
|
846
|
+
private project2d;
|
|
847
|
+
allstickers(): void;
|
|
848
|
+
unswizzle(mv: Move): Move | null;
|
|
849
|
+
private stringToBlockMove;
|
|
850
|
+
parseMove(move: Move): [string | undefined, number, number, number, boolean, number];
|
|
851
|
+
private parsemove;
|
|
852
|
+
genperms(): void;
|
|
853
|
+
private getboundarygeometry;
|
|
854
|
+
private getmovesets;
|
|
855
|
+
private graybyori;
|
|
856
|
+
private skipbyori;
|
|
857
|
+
private skipcubie;
|
|
858
|
+
private header;
|
|
859
|
+
writegap(): string;
|
|
860
|
+
writemathematica(): string;
|
|
861
|
+
writeksolve(name?: string): string;
|
|
862
|
+
getKPuzzleDefinition(fortwisty?: boolean, includemoves?: boolean): KPuzzleDefinition;
|
|
863
|
+
getMoveFromBits(moverange: number[], amount: number, inverted: boolean, axiscmoves: number[][], setmoves: number[] | undefined, movesetorder: number): PGTransform;
|
|
864
|
+
private omitSet;
|
|
865
|
+
private diffmvsets;
|
|
866
|
+
getOrbitsDef(fortwisty: boolean, includemoves?: boolean): PGOrbitsDef;
|
|
867
|
+
getScramble(n?: number): KTransformationData;
|
|
868
|
+
getMovesAsPerms(): Perm[];
|
|
869
|
+
showcanon(disp: (s: string) => void): void;
|
|
870
|
+
getsolved(): Perm;
|
|
871
|
+
private getOrientationRotation;
|
|
872
|
+
private getInitial3DRotation;
|
|
873
|
+
private generate2dmapping;
|
|
874
|
+
generatesvg(w?: number, h?: number, trim?: number, threed?: boolean): string;
|
|
875
|
+
get3d(options?: {
|
|
876
|
+
stickerColors?: string[];
|
|
877
|
+
darkIgnoredOrbits?: boolean;
|
|
878
|
+
}): StickerDat;
|
|
879
|
+
getGeoNormal(geoname: string): number[] | undefined;
|
|
880
|
+
private getfaceindex;
|
|
881
|
+
textForTwizzleExplorer(): string;
|
|
882
|
+
writeSchreierSims(tw: (s: string) => void): void;
|
|
883
|
+
}
|
|
884
|
+
declare class PGNotation {
|
|
885
|
+
private pg;
|
|
886
|
+
private orbitNames;
|
|
887
|
+
constructor(pg: PuzzleGeometry, od: PGOrbitsDef);
|
|
888
|
+
lookupMove(move: Move): KTransformationData | null;
|
|
889
|
+
remapKPuzzleDefinition(kpuzzleDefinition: KPuzzleDefinition): KPuzzleDefinition;
|
|
890
|
+
}
|
|
891
|
+
|
|
21
892
|
/** @category Specific Puzzles */
|
|
22
893
|
declare const cube3x3x3: {
|
|
23
894
|
id: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { r as randomScrambleForEvent } from '../index-
|
|
2
|
-
import '../Alg.d-
|
|
3
|
-
import '../KPattern.d-
|
|
1
|
+
export { r as randomScrambleForEvent } from '../index-t97giMqB.js';
|
|
2
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
3
|
+
import '../KPattern.d-eWxoJtl0.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as experimentalSolve2x2x2, e as experimentalSolve3x3x3IgnoringCenters, f as experimentalSolveTwsearch, d as setSearchDebug, c as solveMegaminx, b as solvePyraminx, s as solveSkewb } from '../index-
|
|
2
|
-
import { K as KPattern } from '../KPattern.d-
|
|
3
|
-
import '../Alg.d-
|
|
1
|
+
export { a as experimentalSolve2x2x2, e as experimentalSolve3x3x3IgnoringCenters, f as experimentalSolveTwsearch, d as setSearchDebug, c as solveMegaminx, b as solvePyraminx, s as solveSkewb } from '../index-t97giMqB.js';
|
|
2
|
+
import { K as KPattern } from '../KPattern.d-eWxoJtl0.js';
|
|
3
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
4
4
|
|
|
5
5
|
declare function random333Pattern(): Promise<KPattern>;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AlgLeafEvent, O as OrientationEvent } from '../bluetooth-puzzle.d-
|
|
2
|
-
import '../Alg.d-
|
|
3
|
-
import '../KPattern.d-
|
|
1
|
+
import { A as AlgLeafEvent, O as OrientationEvent } from '../bluetooth-puzzle.d-NEYj0B8F.js';
|
|
2
|
+
import '../Alg.d-T-vs-GDG.js';
|
|
3
|
+
import '../KPattern.d-eWxoJtl0.js';
|
|
4
4
|
|
|
5
5
|
interface ProxyMoveEvent {
|
|
6
6
|
event: "move";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AlgIndexer, T as Timestamp, D as Duration, S as StickeringMask } from '../TwizzleLink.d-
|
|
2
|
-
export { B as BackViewLayout, N as EXPERIMENTAL_PROP_NO_VALUE, M as ExperimentalMillisecondTimestamp, E as ExperimentalStickering,
|
|
3
|
-
import { A as Alg, M as Move } from '../Alg.d-
|
|
4
|
-
import { s as KPuzzle, K as KPattern, t as KTransformation } from '../KPattern.d-
|
|
1
|
+
import { A as AlgIndexer, T as Timestamp, D as Duration, S as StickeringMask } from '../TwizzleLink.d-S18moNia.js';
|
|
2
|
+
export { B as BackViewLayout, N as EXPERIMENTAL_PROP_NO_VALUE, M as ExperimentalMillisecondTimestamp, E as ExperimentalStickering, f as PuzzleID, c as TwistyAlgEditor, b as TwistyAlgViewer, a as TwistyPlayer, d as TwistyPlayerConfig, g as TwizzleLink, V as VisualizationFormat, e as backViewLayouts } from '../TwizzleLink.d-S18moNia.js';
|
|
3
|
+
import { A as Alg, M as Move } from '../Alg.d-T-vs-GDG.js';
|
|
4
|
+
import { s as KPuzzle, K as KPattern, t as KTransformation } from '../KPattern.d-eWxoJtl0.js';
|
|
5
5
|
import 'three';
|
|
6
|
-
import '../parseAlg.d-
|
|
6
|
+
import '../parseAlg.d-tIlAma60.js';
|
|
7
7
|
|
|
8
8
|
declare const twistyDebugGlobals: {
|
|
9
9
|
shareAllNewRenderers: "auto" | "always" | "never";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cubing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "A collection of JavaScript cubing libraries.",
|
|
5
5
|
"author": "The js.cubing.net team",
|
|
6
6
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@types/three": "^0.162.0",
|
|
60
60
|
"@types/web-bluetooth": "^0.0.20",
|
|
61
61
|
"comlink": "^4.4.1",
|
|
62
|
-
"random-uint-below": "^
|
|
62
|
+
"random-uint-below": "^3.0.0",
|
|
63
63
|
"three": "^0.162.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@types/dom-speech-recognition": "^0.0.4",
|
|
70
70
|
"@types/mocha": "^10.0.6",
|
|
71
71
|
"@types/node": "^20.11.30",
|
|
72
|
-
"@types/node-fetch": "^2.6.11",
|
|
73
72
|
"@types/yargs": "^17.0.32",
|
|
74
73
|
"@web/dev-server-esbuild": "^1.0.2",
|
|
75
74
|
"@web/test-runner": "^0.18.1",
|
|
@@ -79,8 +78,6 @@
|
|
|
79
78
|
"esbuild": "latest",
|
|
80
79
|
"jszip": "^3.10.1",
|
|
81
80
|
"mocha": "^10.4.0",
|
|
82
|
-
"node-fetch": "^3.3.2",
|
|
83
|
-
"peggy": "^4.0.2",
|
|
84
81
|
"playwright": "^1.42.1",
|
|
85
82
|
"tsup": "^8.0.2",
|
|
86
83
|
"typedoc": "^0.25.12",
|