cubing 0.55.2 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/chunks/{chunk-DFQMTDRG.js → chunk-J53ID3VX.js} +2 -2
- package/dist/bin/chunks/chunk-J53ID3VX.js.map +7 -0
- package/dist/bin/order.js +1 -1
- package/dist/bin/order.js.map +2 -2
- package/dist/bin/puzzle-geometry-bin.js +1 -1
- package/dist/bin/puzzle-geometry-bin.js.map +2 -2
- package/dist/bin/scramble.js +2 -1
- package/dist/bin/scramble.js.map +2 -2
- package/dist/lib/cubing/{PuzzleLoader-DGpDr4U9.d.ts → PuzzleLoader-Dd4G1VlU.d.ts} +358 -314
- package/dist/lib/cubing/alg/index.d.ts +9 -9
- package/dist/lib/cubing/alg/index.js +1 -1
- package/dist/lib/cubing/bluetooth/index.d.ts +11 -12
- package/dist/lib/cubing/bluetooth/index.js +72 -57
- package/dist/lib/cubing/bluetooth/index.js.map +3 -3
- package/dist/lib/cubing/{bluetooth-puzzle-C097rA5h.d.ts → bluetooth-puzzle-FIXncgc8.d.ts} +1 -1
- package/dist/lib/cubing/chunks/big-puzzle-orientation-IZASZS5A.js +70 -0
- package/dist/lib/cubing/chunks/big-puzzle-orientation-IZASZS5A.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-TQF5J7MH.js → chunk-3YVVF3KK.js} +79 -79
- package/dist/lib/cubing/chunks/chunk-3YVVF3KK.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-ZOU73IV5.js → chunk-CGV5LY7H.js} +2 -2
- package/dist/lib/cubing/chunks/chunk-CGV5LY7H.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-Y5U55NHQ.js → chunk-DWN2US56.js} +11 -11
- package/dist/lib/cubing/chunks/chunk-DWN2US56.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-PJH5IVDC.js → chunk-EVYENG3X.js} +40 -42
- package/dist/lib/cubing/chunks/chunk-EVYENG3X.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-BQNTAVTA.js → chunk-GKM2CK6T.js} +2 -2
- package/dist/lib/cubing/chunks/{chunk-MFK4M6PV.js → chunk-J6NSY47E.js} +120 -18
- package/dist/lib/cubing/chunks/chunk-J6NSY47E.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-2QDTMC3W.js → chunk-KAXXPFNE.js} +4 -4
- package/dist/lib/cubing/chunks/{chunk-2QDTMC3W.js.map → chunk-KAXXPFNE.js.map} +2 -2
- package/dist/lib/cubing/chunks/{chunk-SGPKF5IH.js → chunk-MITU5GJ5.js} +55 -51
- package/dist/lib/cubing/chunks/{chunk-SGPKF5IH.js.map → chunk-MITU5GJ5.js.map} +3 -3
- package/dist/lib/cubing/chunks/{chunk-WELOEBCE.js → chunk-SNKS5WOA.js} +166 -150
- package/dist/lib/cubing/chunks/chunk-SNKS5WOA.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-2SBMIHZV.js → chunk-SWKNZGJF.js} +100 -108
- package/dist/lib/cubing/chunks/chunk-SWKNZGJF.js.map +7 -0
- package/dist/lib/cubing/chunks/{chunk-G3WJVG4K.js → chunk-XKTLEY2R.js} +2 -2
- package/dist/lib/cubing/chunks/chunk-XKTLEY2R.js.map +7 -0
- package/dist/lib/cubing/chunks/{inside-DZMTYTHV.js → inside-AF5A42Y6.js} +18 -18
- package/dist/lib/cubing/chunks/{inside-DZMTYTHV.js.map → inside-AF5A42Y6.js.map} +2 -2
- package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-QIADTLKJ.js → puzzles-dynamic-side-events-BOGUHF4Q.js} +1681 -1800
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-BOGUHF4Q.js.map +7 -0
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-EGIM6IYZ.js → search-dynamic-sgs-side-events-PVOJWVJF.js} +7 -7
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-EGIM6IYZ.js.map → search-dynamic-sgs-side-events-PVOJWVJF.js.map} +2 -2
- package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-R2TXOWXD.js → search-dynamic-sgs-unofficial-HRR5D2US.js} +648 -648
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-HRR5D2US.js.map +7 -0
- package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-6XXEHLWN.js → search-dynamic-solve-4x4x4-3CROPIQD.js} +7 -7
- package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-5YRST2XM.js → search-dynamic-solve-fto-NKAFVO65.js} +2 -2
- package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-W64XQPBF.js → search-dynamic-solve-kilominx-EDGE5SP4.js} +2 -2
- package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
- package/dist/lib/cubing/chunks/{twisty-dynamic-3d-H7YMZQPB.js → twisty-dynamic-3d-EIIPCTEF.js} +106 -93
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-EIIPCTEF.js.map +7 -0
- package/dist/lib/cubing/chunks/{twsearch-ZJ4WTIBT.js → twsearch-TGLVN7TI.js} +4 -4
- package/dist/lib/cubing/chunks/twsearch-TGLVN7TI.js.map +7 -0
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-NHUYB5UW-HHHVHFI5.js +10 -0
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-NHUYB5UW-HHHVHFI5.js.map +7 -0
- package/dist/lib/cubing/{index-3pTbhXFM.d.ts → index-Drw5ySJm.d.ts} +2 -2
- package/dist/lib/cubing/kpuzzle/index.d.ts +2 -2
- package/dist/lib/cubing/kpuzzle/index.js +2 -2
- package/dist/lib/cubing/notation/index.d.ts +4 -4
- package/dist/lib/cubing/notation/index.js +4 -4
- package/dist/lib/cubing/protocol/index.d.ts +2 -2
- package/dist/lib/cubing/protocol/index.js +4 -4
- package/dist/lib/cubing/puzzle-geometry/index.d.ts +3 -3
- package/dist/lib/cubing/puzzle-geometry/index.js +616 -483
- package/dist/lib/cubing/puzzle-geometry/index.js.map +3 -3
- package/dist/lib/cubing/puzzles/index.d.ts +2 -2
- package/dist/lib/cubing/puzzles/index.js +4 -4
- package/dist/lib/cubing/scramble/index.d.ts +3 -3
- package/dist/lib/cubing/scramble/index.js +6 -6
- package/dist/lib/cubing/search/index.d.ts +3 -3
- package/dist/lib/cubing/search/index.js +6 -6
- package/dist/lib/cubing/stream/index.d.ts +23 -23
- package/dist/lib/cubing/stream/index.js +41 -41
- package/dist/lib/cubing/stream/index.js.map +3 -3
- package/dist/lib/cubing/twisty/index.d.ts +9 -9
- package/dist/lib/cubing/twisty/index.js +3675 -3630
- package/dist/lib/cubing/twisty/index.js.map +4 -4
- package/package.json +16 -10
- package/dist/bin/chunks/chunk-DFQMTDRG.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-2SBMIHZV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-G3WJVG4K.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-MFK4M6PV.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-PJH5IVDC.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-TQF5J7MH.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-WELOEBCE.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-Y5U55NHQ.js.map +0 -7
- package/dist/lib/cubing/chunks/chunk-ZOU73IV5.js.map +0 -7
- package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-QIADTLKJ.js.map +0 -7
- package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-R2TXOWXD.js.map +0 -7
- package/dist/lib/cubing/chunks/twisty-dynamic-3d-H7YMZQPB.js.map +0 -7
- package/dist/lib/cubing/chunks/twsearch-ZJ4WTIBT.js.map +0 -7
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-FWKR4AQ6-XETKNJAN.js +0 -10
- package/dist/lib/cubing/chunks/twsearch_wasm_bg-FWKR4AQ6-XETKNJAN.js.map +0 -7
- /package/dist/lib/cubing/chunks/{chunk-BQNTAVTA.js.map → chunk-GKM2CK6T.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-6XXEHLWN.js.map → search-dynamic-solve-4x4x4-3CROPIQD.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-fto-5YRST2XM.js.map → search-dynamic-solve-fto-NKAFVO65.js.map} +0 -0
- /package/dist/lib/cubing/chunks/{search-dynamic-solve-kilominx-W64XQPBF.js.map → search-dynamic-solve-kilominx-EDGE5SP4.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as AlgNode, s as Alg, M as Move, R as AppendOptions, U as
|
|
2
|
-
export {
|
|
3
|
-
import 'three';
|
|
1
|
+
import { O as AlgNode, s as Alg, M as Move, R as AppendOptions, U as Grouping, W as LineComment, X as Commutator, Y as Conjugate, Z as Newline, _ as Pause, $ as KeyMapping, A as AlgLeaf } from '../PuzzleLoader-Dd4G1VlU.js';
|
|
2
|
+
export { a0 as AlgBranch, a5 as AppendCancelOptions, a3 as ExperimentalNotationType, a2 as ExperimentalParsed, a4 as ExperimentalSerializationOptions, a1 as MoveModifications, x as PuzzleSpecificSimplifyOptions, a7 as QuantumMove, a6 as SimplifyOptions } from '../PuzzleLoader-Dd4G1VlU.js';
|
|
3
|
+
import 'three/src/Three.js';
|
|
4
4
|
|
|
5
5
|
/** @deprecated */
|
|
6
6
|
type Unit = AlgNode;
|
|
@@ -18,6 +18,10 @@ declare class AlgBuilder {
|
|
|
18
18
|
reset(): void;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
declare function setAlgDebug(options: {
|
|
22
|
+
caretNISSNotationEnabled?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
|
|
21
25
|
declare const Example: {
|
|
22
26
|
Sune: Alg;
|
|
23
27
|
AntiSune: Alg;
|
|
@@ -32,6 +36,8 @@ declare const Example: {
|
|
|
32
36
|
TriplePause: Alg;
|
|
33
37
|
};
|
|
34
38
|
|
|
39
|
+
declare function experimentalIs(v: any, c: typeof Alg | typeof Grouping | typeof LineComment | typeof Commutator | typeof Conjugate | typeof Move | typeof Newline | typeof Pause): boolean;
|
|
40
|
+
|
|
35
41
|
declare function keyToMove(keyMapping: KeyMapping | undefined, e: KeyboardEvent): AlgLeaf | null;
|
|
36
42
|
|
|
37
43
|
declare abstract class TraversalDownUp<DataDown, DataAlgUp, DataAlgNodeUp = DataAlgUp> {
|
|
@@ -74,10 +80,4 @@ interface AlgCubingNetOptions {
|
|
|
74
80
|
/** @deprecated */
|
|
75
81
|
declare function experimentalAlgCubingNetLink(options: AlgCubingNetOptions): string;
|
|
76
82
|
|
|
77
|
-
declare function experimentalIs(v: any, c: typeof Alg | typeof Grouping | typeof LineComment | typeof Commutator | typeof Conjugate | typeof Move | typeof Newline | typeof Pause): boolean;
|
|
78
|
-
|
|
79
|
-
declare function setAlgDebug(options: {
|
|
80
|
-
caretNISSNotationEnabled?: boolean;
|
|
81
|
-
}): void;
|
|
82
|
-
|
|
83
83
|
export { Alg, AlgBuilder, type AlgCubingNetOptions, AlgLeaf, AlgNode, Commutator, Conjugate, Example, Grouping, LineComment, Move, Newline, Pause, TraversalDownUp, TraversalUp, type Unit, experimentalAlgCubingNetLink, experimentalAppendMove, experimentalIs, functionFromTraversal, keyToMove, setAlgDebug };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { u as PuzzleID, t as PuzzleLoader, K as KPattern, s as Alg, M as Move } from '../PuzzleLoader-
|
|
2
|
-
import { B as BluetoothPuzzle } from '../bluetooth-puzzle-
|
|
3
|
-
export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-
|
|
4
|
-
import 'three';
|
|
1
|
+
import { u as PuzzleID, t as PuzzleLoader, $ as KeyMapping, K as KPattern, s as Alg, M as Move } from '../PuzzleLoader-Dd4G1VlU.js';
|
|
2
|
+
import { B as BluetoothPuzzle } from '../bluetooth-puzzle-FIXncgc8.js';
|
|
3
|
+
export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-FIXncgc8.js';
|
|
4
|
+
import 'three/src/Three.js';
|
|
5
5
|
|
|
6
6
|
declare function enableDebugLogging(enable: boolean): void;
|
|
7
7
|
|
|
8
8
|
/** @category Keyboard Puzzles */
|
|
9
9
|
declare class KeyboardPuzzle extends BluetoothPuzzle {
|
|
10
10
|
private target;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
listener: (e: KeyboardEvent) => Promise<void>;
|
|
11
|
+
private keyMappingAndPatternPromise;
|
|
12
|
+
listener: EventListener;
|
|
14
13
|
constructor(target: Element, puzzle?: PuzzleID | PuzzleLoader);
|
|
15
14
|
name(): string | undefined;
|
|
16
|
-
|
|
15
|
+
setPuzzleInternal(puzzle: PuzzleID | PuzzleLoader): Promise<[KeyMapping | undefined, KPattern]>;
|
|
17
16
|
disconnect(): void;
|
|
18
17
|
getPattern(): Promise<KPattern>;
|
|
19
18
|
private onKeyDown;
|
|
@@ -56,9 +55,9 @@ declare class GanCube extends BluetoothPuzzle {
|
|
|
56
55
|
faceletStatus2Characteristic(): Promise<BluetoothRemoteGATTCharacteristic>;
|
|
57
56
|
actualAngleAndBatteryCharacteristic(): Promise<BluetoothRemoteGATTCharacteristic>;
|
|
58
57
|
reset(): Promise<void>;
|
|
59
|
-
readFaceletStatus1Characteristic(): Promise<
|
|
58
|
+
readFaceletStatus1Characteristic(): Promise<ArrayBufferLike>;
|
|
60
59
|
readFaceletStatus2Characteristic(): Promise<string>;
|
|
61
|
-
readActualAngleAndBatteryCharacteristic(): Promise<
|
|
60
|
+
readActualAngleAndBatteryCharacteristic(): Promise<ArrayBufferLike>;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/** @category Smart Puzzles */
|
|
@@ -116,7 +115,7 @@ declare class GanRobot extends EventTarget {
|
|
|
116
115
|
name(): string | undefined;
|
|
117
116
|
disconnect(): void;
|
|
118
117
|
onDisconnect(): void;
|
|
119
|
-
private
|
|
118
|
+
private algNodeToNibble;
|
|
120
119
|
private writeNibbles;
|
|
121
120
|
private getStatus;
|
|
122
121
|
locked: boolean;
|
|
@@ -142,7 +141,7 @@ declare class GanTimer extends EventTarget {
|
|
|
142
141
|
disconnect(): void;
|
|
143
142
|
poll(): Promise<void>;
|
|
144
143
|
onDisconnect(): void;
|
|
145
|
-
getTimeCharacteristic(): Promise<Uint8Array
|
|
144
|
+
getTimeCharacteristic(): Promise<Uint8Array<ArrayBufferLike>>;
|
|
146
145
|
getTime(): Promise<number>;
|
|
147
146
|
decodeTimeMs(bytes: Uint8Array): number;
|
|
148
147
|
startPolling(): void;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
binaryComponentsToReid3x3x3,
|
|
3
3
|
twizzleBinaryToBinaryComponents
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-KAXXPFNE.js";
|
|
5
5
|
import {
|
|
6
6
|
cube3x3x3,
|
|
7
7
|
puzzles
|
|
8
|
-
} from "../chunks/chunk-
|
|
8
|
+
} from "../chunks/chunk-J6NSY47E.js";
|
|
9
9
|
import {
|
|
10
10
|
experimental3x3x3KPuzzle
|
|
11
|
-
} from "../chunks/chunk-
|
|
11
|
+
} from "../chunks/chunk-MITU5GJ5.js";
|
|
12
12
|
import {
|
|
13
13
|
KPattern
|
|
14
|
-
} from "../chunks/chunk-
|
|
14
|
+
} from "../chunks/chunk-3YVVF3KK.js";
|
|
15
15
|
import {
|
|
16
16
|
Alg,
|
|
17
17
|
Move,
|
|
18
18
|
experimentalAppendMove,
|
|
19
19
|
keyToMove
|
|
20
|
-
} from "../chunks/chunk-
|
|
20
|
+
} from "../chunks/chunk-SWKNZGJF.js";
|
|
21
21
|
|
|
22
22
|
// src/cubing/bluetooth/debug.ts
|
|
23
23
|
var DEBUG_LOGGING_ENABLED = false;
|
|
@@ -36,7 +36,8 @@ function debugLog(...args) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// src/cubing/bluetooth/transformer.ts
|
|
39
|
-
import { Quaternion
|
|
39
|
+
import { Quaternion } from "three/src/math/Quaternion.js";
|
|
40
|
+
import { Vector3 } from "three/src/math/Vector3.js";
|
|
40
41
|
function maxAxis(v) {
|
|
41
42
|
const maxVal = Math.max(Math.abs(v.x), Math.abs(v.y), Math.abs(v.z));
|
|
42
43
|
switch (maxVal) {
|
|
@@ -131,6 +132,7 @@ var BluetoothPuzzle = class extends EventTarget {
|
|
|
131
132
|
|
|
132
133
|
// src/cubing/bluetooth/keyboard.ts
|
|
133
134
|
var KeyboardPuzzle = class extends BluetoothPuzzle {
|
|
135
|
+
// (e: KeyboardEvent) => Promise<void>;
|
|
134
136
|
// TODO: Decide on the right arguments.
|
|
135
137
|
// TODO: support tying the puzzle to a TwistyPlayer.
|
|
136
138
|
constructor(target, puzzle = "3x3x3") {
|
|
@@ -138,41 +140,43 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
|
|
|
138
140
|
this.target = target;
|
|
139
141
|
this.listener = this.onKeyDown.bind(this);
|
|
140
142
|
target.addEventListener("keydown", this.listener);
|
|
141
|
-
this.
|
|
143
|
+
this.keyMappingAndPatternPromise = this.setPuzzleInternal(puzzle);
|
|
142
144
|
}
|
|
143
|
-
|
|
144
|
-
pattern;
|
|
145
|
+
keyMappingAndPatternPromise;
|
|
145
146
|
listener;
|
|
146
147
|
name() {
|
|
147
148
|
return "Keyboard Input";
|
|
148
149
|
}
|
|
149
|
-
async
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
this.pattern = (async () => (await kpuzzlePromise).defaultPattern())();
|
|
150
|
+
async setPuzzleInternal(puzzle) {
|
|
151
|
+
const puzzleLoader = await (async () => typeof puzzle === "string" ? (await import("../puzzles/index.js")).puzzles[puzzle] : puzzle)();
|
|
152
|
+
const kpuzzle = await (async () => puzzleLoader.kpuzzle())();
|
|
153
|
+
return Promise.all([puzzleLoader.keyMapping?.(), kpuzzle.defaultPattern()]);
|
|
154
154
|
}
|
|
155
155
|
disconnect() {
|
|
156
156
|
this.target.removeEventListener("keydown", this.listener);
|
|
157
157
|
}
|
|
158
158
|
async getPattern() {
|
|
159
|
-
return this.
|
|
159
|
+
return (await this.keyMappingAndPatternPromise)[1];
|
|
160
160
|
}
|
|
161
161
|
async onKeyDown(e) {
|
|
162
162
|
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
this.keyMappingAndPatternPromise = (async () => {
|
|
166
|
+
const [keyMapping, pattern] = await this.keyMappingAndPatternPromise;
|
|
167
|
+
const algLeaf = keyToMove(keyMapping, e);
|
|
168
|
+
let newPattern;
|
|
169
|
+
if (algLeaf) {
|
|
170
|
+
newPattern = pattern.applyAlg(new Alg([algLeaf]));
|
|
171
|
+
this.dispatchAlgLeaf({
|
|
172
|
+
latestAlgLeaf: algLeaf,
|
|
173
|
+
timeStamp: e.timeStamp,
|
|
174
|
+
pattern: newPattern
|
|
175
|
+
});
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
}
|
|
178
|
+
return [keyMapping, newPattern ?? pattern];
|
|
179
|
+
})();
|
|
176
180
|
}
|
|
177
181
|
};
|
|
178
182
|
async function debugKeyboardConnect(target = window, puzzle = "3x3x3") {
|
|
@@ -218,7 +222,7 @@ async function bluetoothConnect(configs, options = {}) {
|
|
|
218
222
|
consecutiveFailures = 0;
|
|
219
223
|
} catch (e) {
|
|
220
224
|
consecutiveFailures++;
|
|
221
|
-
throw
|
|
225
|
+
throw e;
|
|
222
226
|
}
|
|
223
227
|
debugLog("Device:", device);
|
|
224
228
|
if (typeof device.gatt === "undefined") {
|
|
@@ -238,7 +242,7 @@ async function bluetoothConnect(configs, options = {}) {
|
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
// src/cubing/bluetooth/smart-puzzle/gan.ts
|
|
241
|
-
import { Quaternion as Quaternion2 } from "three";
|
|
245
|
+
import { Quaternion as Quaternion2 } from "three/src/math/Quaternion.js";
|
|
242
246
|
|
|
243
247
|
// src/cubing/vendor/public-domain/unsafe-raw-aes/unsafe-raw-aes.ts
|
|
244
248
|
var blockSize = 16;
|
|
@@ -639,13 +643,13 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
|
|
|
639
643
|
};
|
|
640
644
|
for (const cornerMapping of gan356iCornerMappings) {
|
|
641
645
|
const pieceInfo = pieceMap[cornerMapping.map((i) => faceOrder[stickers[i]]).join("")];
|
|
642
|
-
patternData
|
|
643
|
-
patternData
|
|
646
|
+
patternData["CORNERS"].pieces.push(pieceInfo.piece);
|
|
647
|
+
patternData["CORNERS"].orientation.push(pieceInfo.orientation);
|
|
644
648
|
}
|
|
645
649
|
for (const edgeMapping of gan356iEdgeMappings) {
|
|
646
650
|
const pieceInfo = pieceMap[edgeMapping.map((i) => faceOrder[stickers[i]]).join("")];
|
|
647
|
-
patternData
|
|
648
|
-
patternData
|
|
651
|
+
patternData["EDGES"].pieces.push(pieceInfo.piece);
|
|
652
|
+
patternData["EDGES"].orientation.push(pieceInfo.orientation);
|
|
649
653
|
}
|
|
650
654
|
return new KPattern(this.kpuzzle, patternData);
|
|
651
655
|
}
|
|
@@ -663,7 +667,7 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
|
|
|
663
667
|
}
|
|
664
668
|
async reset() {
|
|
665
669
|
const faceletStatus1Characteristic = await this.faceletStatus1Characteristic();
|
|
666
|
-
await faceletStatus1Characteristic.writeValue(commands
|
|
670
|
+
await faceletStatus1Characteristic.writeValue(commands["reset"]);
|
|
667
671
|
}
|
|
668
672
|
async readFaceletStatus1Characteristic() {
|
|
669
673
|
const faceletStatus1Characteristic = await this.faceletStatus1Characteristic();
|
|
@@ -857,13 +861,13 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
|
|
|
857
861
|
};
|
|
858
862
|
for (let i = 0; i < 12; i++) {
|
|
859
863
|
const gi = epReid333toGiiKER[i];
|
|
860
|
-
patternData
|
|
861
|
-
patternData
|
|
864
|
+
patternData["EDGES"].pieces[i] = epGiiKERtoReid333[getNibble(val, gi + 16) - 1];
|
|
865
|
+
patternData["EDGES"].orientation[i] = this.getBit(val, gi + 112) ^ preEO[patternData["EDGES"].pieces[i]] ^ postEO[i];
|
|
862
866
|
}
|
|
863
867
|
for (let i = 0; i < 8; i++) {
|
|
864
868
|
const gi = cpReid333toGiiKER[i];
|
|
865
|
-
patternData
|
|
866
|
-
patternData
|
|
869
|
+
patternData["CORNERS"].pieces[i] = cpGiiKERtoReid333[getNibble(val, gi) - 1];
|
|
870
|
+
patternData["CORNERS"].orientation[i] = (getNibble(val, gi + 8) * coFlip[gi] + preCO[patternData["CORNERS"].pieces[i]] + postCO[i]) % 3;
|
|
867
871
|
}
|
|
868
872
|
return new KPattern(experimental3x3x3KPuzzle, patternData);
|
|
869
873
|
}
|
|
@@ -935,7 +939,7 @@ var giiKERConfig = {
|
|
|
935
939
|
};
|
|
936
940
|
|
|
937
941
|
// src/cubing/bluetooth/smart-puzzle/gocube.ts
|
|
938
|
-
import { Quaternion as Quaternion3 } from "three";
|
|
942
|
+
import { Quaternion as Quaternion3 } from "three/src/math/Quaternion.js";
|
|
939
943
|
var UUIDs3 = {
|
|
940
944
|
goCubeService: "6e400001-b5a3-f393-e0a9-e50e24dcca9e",
|
|
941
945
|
goCubeStateCharacteristic: "6e400003-b5a3-f393-e0a9-e50e24dcca9e"
|
|
@@ -1275,9 +1279,9 @@ function isDoubleTurnNibble(nibble) {
|
|
|
1275
1279
|
function nibbleDuration(nibble) {
|
|
1276
1280
|
return isDoubleTurnNibble(nibble) ? DOUBLE_TURN_DURATION_MS : QUANTUM_TURN_DURATION_MS;
|
|
1277
1281
|
}
|
|
1278
|
-
function
|
|
1279
|
-
console.error("invalid
|
|
1280
|
-
throw new Error("invalid
|
|
1282
|
+
function throwInvalidAlgNode(algNode) {
|
|
1283
|
+
console.error("invalid alg node", algNode, algNode.toString());
|
|
1284
|
+
throw new Error("invalid alg node!");
|
|
1281
1285
|
}
|
|
1282
1286
|
function sleep(ms) {
|
|
1283
1287
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1332,10 +1336,14 @@ var GanRobot = class _GanRobot extends EventTarget {
|
|
|
1332
1336
|
onDisconnect() {
|
|
1333
1337
|
this.dispatchEvent(new CustomEvent("disconnect"));
|
|
1334
1338
|
}
|
|
1335
|
-
|
|
1339
|
+
algNodeToNibble(algNode) {
|
|
1340
|
+
const move = algNode.as(Move);
|
|
1341
|
+
if (!move) {
|
|
1342
|
+
throwInvalidAlgNode(algNode);
|
|
1343
|
+
}
|
|
1336
1344
|
const nibble = (this.experimentalOptions.xAngle ? moveMapX : moveMap2)[move.toString()] ?? null;
|
|
1337
1345
|
if (nibble === null) {
|
|
1338
|
-
|
|
1346
|
+
throwInvalidAlgNode(move);
|
|
1339
1347
|
}
|
|
1340
1348
|
return nibble;
|
|
1341
1349
|
}
|
|
@@ -1398,22 +1406,29 @@ var GanRobot = class _GanRobot extends EventTarget {
|
|
|
1398
1406
|
while (this.moveQueue.experimentalNumChildAlgNodes() > 0) {
|
|
1399
1407
|
let algNodes = Array.from(this.moveQueue.childAlgNodes());
|
|
1400
1408
|
if (this.experimentalOptions.singleMoveFixHack && algNodes.length === 1) {
|
|
1401
|
-
const move = algNodes[0];
|
|
1402
|
-
if (move
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1409
|
+
const move = algNodes[0].as(Move);
|
|
1410
|
+
if (move) {
|
|
1411
|
+
if (move.amount === 2) {
|
|
1412
|
+
algNodes = [
|
|
1413
|
+
move.modified({ amount: 1 }),
|
|
1414
|
+
move.modified({ amount: 1 })
|
|
1415
|
+
];
|
|
1416
|
+
} else {
|
|
1417
|
+
algNodes = [
|
|
1418
|
+
move.modified({ amount: -move.amount }),
|
|
1419
|
+
move.modified({ amount: 2 })
|
|
1420
|
+
];
|
|
1421
|
+
}
|
|
1412
1422
|
}
|
|
1413
1423
|
}
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1424
|
+
const splicedAlgNodes = algNodes.splice(
|
|
1425
|
+
0,
|
|
1426
|
+
MAX_NIBBLES_PER_WRITE
|
|
1427
|
+
);
|
|
1428
|
+
const nibbles = splicedAlgNodes.map(
|
|
1429
|
+
this.algNodeToNibble.bind(this)
|
|
1430
|
+
);
|
|
1431
|
+
const sending = new Alg(splicedAlgNodes);
|
|
1417
1432
|
this.experimentalDebugLog("SENDING", sending.toString());
|
|
1418
1433
|
if (this.experimentalDebugOnSend) {
|
|
1419
1434
|
this.experimentalDebugOnSend(sending);
|