@cubingcenter/scrambler 0.6.1 → 0.6.3
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/puzzles/cube3/solver/pair-tables.d.ts.map +1 -1
- package/dist/puzzles/cube3/solver/pair-tables.js +13 -8
- package/dist/puzzles/cube4/scrambler.d.ts.map +1 -1
- package/dist/puzzles/cube4/scrambler.js +11 -1
- package/dist-cjs/puzzles/cube3/solver/pair-tables.js +13 -8
- package/dist-cjs/puzzles/cube4/scrambler.js +11 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair-tables.d.ts","sourceRoot":"","sources":["../../../../src/puzzles/cube3/solver/pair-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D,wBAAgB,mBAAmB,IAAI,eAAe,GAAG,SAAS,CAEjE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAKhF;
|
|
1
|
+
{"version":3,"file":"pair-tables.d.ts","sourceRoot":"","sources":["../../../../src/puzzles/cube3/solver/pair-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D,wBAAgB,mBAAmB,IAAI,eAAe,GAAG,SAAS,CAEjE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAKhF;AAwBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAelF"}
|
|
@@ -29,18 +29,23 @@ export async function loadCube3PairTables() {
|
|
|
29
29
|
return cached;
|
|
30
30
|
}
|
|
31
31
|
async function loadPairTables() {
|
|
32
|
-
|
|
32
|
+
try {
|
|
33
|
+
if (typeof self !== "undefined") {
|
|
34
|
+
const loader = await import(
|
|
35
|
+
/* webpackIgnore: true */
|
|
36
|
+
/* @vite-ignore */
|
|
37
|
+
"./pair-browser-loader.js");
|
|
38
|
+
return await loader.loadBrowserPairTables();
|
|
39
|
+
}
|
|
33
40
|
const loader = await import(
|
|
34
41
|
/* webpackIgnore: true */
|
|
35
42
|
/* @vite-ignore */
|
|
36
|
-
"./pair-
|
|
37
|
-
return loader.
|
|
43
|
+
"./pair-node-loader.js");
|
|
44
|
+
return loader.loadNodePairTables();
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
38
48
|
}
|
|
39
|
-
const loader = await import(
|
|
40
|
-
/* webpackIgnore: true */
|
|
41
|
-
/* @vite-ignore */
|
|
42
|
-
"./pair-node-loader.js");
|
|
43
|
-
return loader.loadNodePairTables();
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* The pair distance of (cp, uep) — the exact distance to (cp==0 && uep==0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrambler.d.ts","sourceRoot":"","sources":["../../../src/puzzles/cube4/scrambler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAmJ9F,eAAO,MAAM,sBAAsB,EAAE,iBAYpC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,eAAe,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3D,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"scrambler.d.ts","sourceRoot":"","sources":["../../../src/puzzles/cube4/scrambler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAmJ9F,eAAO,MAAM,sBAAsB,EAAE,iBAYpC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,eAAe,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3D,OAAO,CAAC,cAAc,CAAC,CAiGzB"}
|
|
@@ -147,7 +147,17 @@ export const cube4ScrambleGenerator = {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
export async function generateCube4Scramble(options = {}) {
|
|
150
|
-
|
|
150
|
+
let tables;
|
|
151
|
+
try {
|
|
152
|
+
tables = await loadCube4Tables();
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.warn("[cube4-scrambler] Failed to load reduction tables; using fallback.", error);
|
|
156
|
+
const cubingJsResult = await generateCube4WithCubingJs();
|
|
157
|
+
if (cubingJsResult)
|
|
158
|
+
return cubingJsResult;
|
|
159
|
+
return generateCube4RandomMoves(options);
|
|
160
|
+
}
|
|
151
161
|
let lastError;
|
|
152
162
|
// Retry with different states if the solver fails to find a physical
|
|
153
163
|
// reduction (some random states are outside the solver's effective
|
|
@@ -67,18 +67,23 @@ async function loadCube3PairTables() {
|
|
|
67
67
|
return cached;
|
|
68
68
|
}
|
|
69
69
|
async function loadPairTables() {
|
|
70
|
-
|
|
70
|
+
try {
|
|
71
|
+
if (typeof self !== "undefined") {
|
|
72
|
+
const loader = await Promise.resolve().then(() => __importStar(require(
|
|
73
|
+
/* webpackIgnore: true */
|
|
74
|
+
/* @vite-ignore */
|
|
75
|
+
"./pair-browser-loader.js")));
|
|
76
|
+
return await loader.loadBrowserPairTables();
|
|
77
|
+
}
|
|
71
78
|
const loader = await Promise.resolve().then(() => __importStar(require(
|
|
72
79
|
/* webpackIgnore: true */
|
|
73
80
|
/* @vite-ignore */
|
|
74
|
-
"./pair-
|
|
75
|
-
return loader.
|
|
81
|
+
"./pair-node-loader.js")));
|
|
82
|
+
return loader.loadNodePairTables();
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return undefined;
|
|
76
86
|
}
|
|
77
|
-
const loader = await Promise.resolve().then(() => __importStar(require(
|
|
78
|
-
/* webpackIgnore: true */
|
|
79
|
-
/* @vite-ignore */
|
|
80
|
-
"./pair-node-loader.js")));
|
|
81
|
-
return loader.loadNodePairTables();
|
|
82
87
|
}
|
|
83
88
|
/**
|
|
84
89
|
* The pair distance of (cp, uep) — the exact distance to (cp==0 && uep==0)
|
|
@@ -184,7 +184,17 @@ exports.cube4ScrambleGenerator = {
|
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
async function generateCube4Scramble(options = {}) {
|
|
187
|
-
|
|
187
|
+
let tables;
|
|
188
|
+
try {
|
|
189
|
+
tables = await loadCube4Tables();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
console.warn("[cube4-scrambler] Failed to load reduction tables; using fallback.", error);
|
|
193
|
+
const cubingJsResult = await generateCube4WithCubingJs();
|
|
194
|
+
if (cubingJsResult)
|
|
195
|
+
return cubingJsResult;
|
|
196
|
+
return generateCube4RandomMoves(options);
|
|
197
|
+
}
|
|
188
198
|
let lastError;
|
|
189
199
|
// Retry with different states if the solver fails to find a physical
|
|
190
200
|
// reduction (some random states are outside the solver's effective
|