@cubingcenter/scrambler 0.1.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/README.md +169 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +10 -0
- package/dist/cli/run.d.ts +9 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +139 -0
- package/dist/core/api.d.ts +19 -0
- package/dist/core/api.d.ts.map +1 -0
- package/dist/core/api.js +94 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +34 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/registry.d.ts +10 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +35 -0
- package/dist/core/types.d.ts +34 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/puzzles/clock/index.d.ts +2 -0
- package/dist/puzzles/clock/index.d.ts.map +1 -0
- package/dist/puzzles/clock/index.js +1 -0
- package/dist/puzzles/clock/scrambler.d.ts +4 -0
- package/dist/puzzles/clock/scrambler.d.ts.map +1 -0
- package/dist/puzzles/clock/scrambler.js +50 -0
- package/dist/puzzles/cube2/facelets.d.ts +5 -0
- package/dist/puzzles/cube2/facelets.d.ts.map +1 -0
- package/dist/puzzles/cube2/facelets.js +53 -0
- package/dist/puzzles/cube2/index.d.ts +10 -0
- package/dist/puzzles/cube2/index.d.ts.map +1 -0
- package/dist/puzzles/cube2/index.js +8 -0
- package/dist/puzzles/cube2/moves.d.ts +9 -0
- package/dist/puzzles/cube2/moves.d.ts.map +1 -0
- package/dist/puzzles/cube2/moves.js +79 -0
- package/dist/puzzles/cube2/random-state.d.ts +3 -0
- package/dist/puzzles/cube2/random-state.d.ts.map +1 -0
- package/dist/puzzles/cube2/random-state.js +51 -0
- package/dist/puzzles/cube2/scrambler.d.ts +6 -0
- package/dist/puzzles/cube2/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube2/scrambler.js +54 -0
- package/dist/puzzles/cube2/solver/browser-loader.d.ts +12 -0
- package/dist/puzzles/cube2/solver/browser-loader.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/browser-loader.js +80 -0
- package/dist/puzzles/cube2/solver/generated/distances.bin +1 -0
- package/dist/puzzles/cube2/solver/generated/manifest.json +21 -0
- package/dist/puzzles/cube2/solver/generated/orientation-distances.bin +0 -0
- package/dist/puzzles/cube2/solver/generated/orientation-table.bin +0 -0
- package/dist/puzzles/cube2/solver/generated/permutation-distances.bin +0 -0
- package/dist/puzzles/cube2/solver/generated/permutation-table.bin +0 -0
- package/dist/puzzles/cube2/solver/generated-assets.d.ts +6 -0
- package/dist/puzzles/cube2/solver/generated-assets.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/generated-assets.js +25 -0
- package/dist/puzzles/cube2/solver/index.d.ts +3 -0
- package/dist/puzzles/cube2/solver/index.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/index.js +1 -0
- package/dist/puzzles/cube2/solver/node-loader.d.ts +6 -0
- package/dist/puzzles/cube2/solver/node-loader.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/node-loader.js +83 -0
- package/dist/puzzles/cube2/solver/search.d.ts +8 -0
- package/dist/puzzles/cube2/solver/search.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/search.js +50 -0
- package/dist/puzzles/cube2/solver/table-metadata.d.ts +16 -0
- package/dist/puzzles/cube2/solver/table-metadata.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/table-metadata.js +15 -0
- package/dist/puzzles/cube2/solver/tables.d.ts +14 -0
- package/dist/puzzles/cube2/solver/tables.d.ts.map +1 -0
- package/dist/puzzles/cube2/solver/tables.js +82 -0
- package/dist/puzzles/cube2/state.d.ts +6 -0
- package/dist/puzzles/cube2/state.d.ts.map +1 -0
- package/dist/puzzles/cube2/state.js +30 -0
- package/dist/puzzles/cube2/types.d.ts +23 -0
- package/dist/puzzles/cube2/types.d.ts.map +1 -0
- package/dist/puzzles/cube2/types.js +21 -0
- package/dist/puzzles/cube2/validation.d.ts +6 -0
- package/dist/puzzles/cube2/validation.d.ts.map +1 -0
- package/dist/puzzles/cube2/validation.js +72 -0
- package/dist/puzzles/cube3/facelets.d.ts +5 -0
- package/dist/puzzles/cube3/facelets.d.ts.map +1 -0
- package/dist/puzzles/cube3/facelets.js +89 -0
- package/dist/puzzles/cube3/index.d.ts +10 -0
- package/dist/puzzles/cube3/index.d.ts.map +1 -0
- package/dist/puzzles/cube3/index.js +8 -0
- package/dist/puzzles/cube3/moves.d.ts +9 -0
- package/dist/puzzles/cube3/moves.d.ts.map +1 -0
- package/dist/puzzles/cube3/moves.js +210 -0
- package/dist/puzzles/cube3/random-state.d.ts +3 -0
- package/dist/puzzles/cube3/random-state.d.ts.map +1 -0
- package/dist/puzzles/cube3/random-state.js +59 -0
- package/dist/puzzles/cube3/scrambler.d.ts +6 -0
- package/dist/puzzles/cube3/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube3/scrambler.js +59 -0
- package/dist/puzzles/cube3/solver/browser-loader.d.ts +5 -0
- package/dist/puzzles/cube3/solver/browser-loader.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/browser-loader.js +134 -0
- package/dist/puzzles/cube3/solver/browser-worker-pool.d.ts +31 -0
- package/dist/puzzles/cube3/solver/browser-worker-pool.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/browser-worker-pool.js +118 -0
- package/dist/puzzles/cube3/solver/browser-worker.d.ts +2 -0
- package/dist/puzzles/cube3/solver/browser-worker.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/browser-worker.js +71 -0
- package/dist/puzzles/cube3/solver/coordinates.d.ts +34 -0
- package/dist/puzzles/cube3/solver/coordinates.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/coordinates.js +266 -0
- package/dist/puzzles/cube3/solver/generated/manifest.json +404 -0
- package/dist/puzzles/cube3/solver/generated/move-cornerOrientation.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/move-cornerPermutation.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/move-edgeOrientation.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/move-slicePermutation.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/move-udEdgePermutation.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/move-udSlice.bin +0 -0
- package/dist/puzzles/cube3/solver/generated/pruning-cornerOrientation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-cornerOrientationEdgeOrientation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-cornerPermutation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-cornerPermutationSlicePermutation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-edgeOrientation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-slicePermutation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-udEdgePermutation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-udEdgePermutationSlicePermutation.bin +1 -0
- package/dist/puzzles/cube3/solver/generated/pruning-udSlice.bin +0 -0
- package/dist/puzzles/cube3/solver/generated-assets.d.ts +5 -0
- package/dist/puzzles/cube3/solver/generated-assets.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/generated-assets.js +60 -0
- package/dist/puzzles/cube3/solver/index.d.ts +10 -0
- package/dist/puzzles/cube3/solver/index.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/index.js +5 -0
- package/dist/puzzles/cube3/solver/node-loader.d.ts +3 -0
- package/dist/puzzles/cube3/solver/node-loader.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/node-loader.js +120 -0
- package/dist/puzzles/cube3/solver/phase1.d.ts +28 -0
- package/dist/puzzles/cube3/solver/phase1.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/phase1.js +150 -0
- package/dist/puzzles/cube3/solver/phase2.d.ts +44 -0
- package/dist/puzzles/cube3/solver/phase2.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/phase2.js +270 -0
- package/dist/puzzles/cube3/solver/search-utils.d.ts +9 -0
- package/dist/puzzles/cube3/solver/search-utils.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/search-utils.js +41 -0
- package/dist/puzzles/cube3/solver/table-metadata.d.ts +97 -0
- package/dist/puzzles/cube3/solver/table-metadata.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/table-metadata.js +21 -0
- package/dist/puzzles/cube3/solver/tables.d.ts +72 -0
- package/dist/puzzles/cube3/solver/tables.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/tables.js +202 -0
- package/dist/puzzles/cube3/solver/worker-pool.d.ts +18 -0
- package/dist/puzzles/cube3/solver/worker-pool.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/worker-pool.js +116 -0
- package/dist/puzzles/cube3/solver/worker.d.ts +2 -0
- package/dist/puzzles/cube3/solver/worker.d.ts.map +1 -0
- package/dist/puzzles/cube3/solver/worker.js +73 -0
- package/dist/puzzles/cube3/state.d.ts +6 -0
- package/dist/puzzles/cube3/state.d.ts.map +1 -0
- package/dist/puzzles/cube3/state.js +40 -0
- package/dist/puzzles/cube3/subset-state.d.ts +4 -0
- package/dist/puzzles/cube3/subset-state.d.ts.map +1 -0
- package/dist/puzzles/cube3/subset-state.js +163 -0
- package/dist/puzzles/cube3/types.d.ts +29 -0
- package/dist/puzzles/cube3/types.d.ts.map +1 -0
- package/dist/puzzles/cube3/types.js +22 -0
- package/dist/puzzles/cube3/validation.d.ts +6 -0
- package/dist/puzzles/cube3/validation.d.ts.map +1 -0
- package/dist/puzzles/cube3/validation.js +83 -0
- package/dist/puzzles/cube4/facelets.d.ts +5 -0
- package/dist/puzzles/cube4/facelets.d.ts.map +1 -0
- package/dist/puzzles/cube4/facelets.js +135 -0
- package/dist/puzzles/cube4/index.d.ts +7 -0
- package/dist/puzzles/cube4/index.d.ts.map +1 -0
- package/dist/puzzles/cube4/index.js +8 -0
- package/dist/puzzles/cube4/moves.d.ts +37 -0
- package/dist/puzzles/cube4/moves.d.ts.map +1 -0
- package/dist/puzzles/cube4/moves.js +243 -0
- package/dist/puzzles/cube4/scrambler.d.ts +4 -0
- package/dist/puzzles/cube4/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube4/scrambler.js +98 -0
- package/dist/puzzles/cube4/state.d.ts +16 -0
- package/dist/puzzles/cube4/state.d.ts.map +1 -0
- package/dist/puzzles/cube4/state.js +84 -0
- package/dist/puzzles/cube4/types.d.ts +76 -0
- package/dist/puzzles/cube4/types.d.ts.map +1 -0
- package/dist/puzzles/cube4/types.js +62 -0
- package/dist/puzzles/cube5x5/index.d.ts +4 -0
- package/dist/puzzles/cube5x5/index.d.ts.map +1 -0
- package/dist/puzzles/cube5x5/index.js +2 -0
- package/dist/puzzles/cube5x5/scrambler.d.ts +4 -0
- package/dist/puzzles/cube5x5/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube5x5/scrambler.js +93 -0
- package/dist/puzzles/cube5x5/types.d.ts +4 -0
- package/dist/puzzles/cube5x5/types.d.ts.map +1 -0
- package/dist/puzzles/cube5x5/types.js +4 -0
- package/dist/puzzles/cube6x6/index.d.ts +4 -0
- package/dist/puzzles/cube6x6/index.d.ts.map +1 -0
- package/dist/puzzles/cube6x6/index.js +2 -0
- package/dist/puzzles/cube6x6/scrambler.d.ts +4 -0
- package/dist/puzzles/cube6x6/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube6x6/scrambler.js +105 -0
- package/dist/puzzles/cube6x6/types.d.ts +4 -0
- package/dist/puzzles/cube6x6/types.d.ts.map +1 -0
- package/dist/puzzles/cube6x6/types.js +8 -0
- package/dist/puzzles/cube7x7/index.d.ts +4 -0
- package/dist/puzzles/cube7x7/index.d.ts.map +1 -0
- package/dist/puzzles/cube7x7/index.js +2 -0
- package/dist/puzzles/cube7x7/scrambler.d.ts +4 -0
- package/dist/puzzles/cube7x7/scrambler.d.ts.map +1 -0
- package/dist/puzzles/cube7x7/scrambler.js +93 -0
- package/dist/puzzles/cube7x7/types.d.ts +4 -0
- package/dist/puzzles/cube7x7/types.d.ts.map +1 -0
- package/dist/puzzles/cube7x7/types.js +8 -0
- package/dist/puzzles/index.d.ts +10 -0
- package/dist/puzzles/index.d.ts.map +1 -0
- package/dist/puzzles/index.js +28 -0
- package/dist/puzzles/megaminx/index.d.ts +4 -0
- package/dist/puzzles/megaminx/index.d.ts.map +1 -0
- package/dist/puzzles/megaminx/index.js +2 -0
- package/dist/puzzles/megaminx/scrambler.d.ts +4 -0
- package/dist/puzzles/megaminx/scrambler.d.ts.map +1 -0
- package/dist/puzzles/megaminx/scrambler.js +56 -0
- package/dist/puzzles/megaminx/types.d.ts +6 -0
- package/dist/puzzles/megaminx/types.d.ts.map +1 -0
- package/dist/puzzles/megaminx/types.js +4 -0
- package/dist/puzzles/pyraminx/index.d.ts +9 -0
- package/dist/puzzles/pyraminx/index.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/index.js +7 -0
- package/dist/puzzles/pyraminx/moves.d.ts +9 -0
- package/dist/puzzles/pyraminx/moves.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/moves.js +117 -0
- package/dist/puzzles/pyraminx/random-state.d.ts +3 -0
- package/dist/puzzles/pyraminx/random-state.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/random-state.js +53 -0
- package/dist/puzzles/pyraminx/scrambler.d.ts +6 -0
- package/dist/puzzles/pyraminx/scrambler.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/scrambler.js +56 -0
- package/dist/puzzles/pyraminx/solver.d.ts +10 -0
- package/dist/puzzles/pyraminx/solver.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/solver.js +160 -0
- package/dist/puzzles/pyraminx/state.d.ts +6 -0
- package/dist/puzzles/pyraminx/state.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/state.js +32 -0
- package/dist/puzzles/pyraminx/types.d.ts +17 -0
- package/dist/puzzles/pyraminx/types.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/types.js +7 -0
- package/dist/puzzles/pyraminx/validation.d.ts +8 -0
- package/dist/puzzles/pyraminx/validation.d.ts.map +1 -0
- package/dist/puzzles/pyraminx/validation.js +79 -0
- package/dist/random/index.d.ts +3 -0
- package/dist/random/index.d.ts.map +1 -0
- package/dist/random/index.js +1 -0
- package/dist/random/prng.d.ts +7 -0
- package/dist/random/prng.d.ts.map +1 -0
- package/dist/random/prng.js +60 -0
- package/dist-cjs/cli/index.js +12 -0
- package/dist-cjs/cli/run.js +142 -0
- package/dist-cjs/core/api.js +102 -0
- package/dist-cjs/core/errors.js +42 -0
- package/dist-cjs/core/index.js +19 -0
- package/dist-cjs/core/registry.js +39 -0
- package/dist-cjs/core/types.js +2 -0
- package/dist-cjs/index.js +19 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/puzzles/clock/index.js +6 -0
- package/dist-cjs/puzzles/clock/scrambler.js +54 -0
- package/dist-cjs/puzzles/cube2/facelets.js +58 -0
- package/dist-cjs/puzzles/cube2/index.js +67 -0
- package/dist-cjs/puzzles/cube2/moves.js +88 -0
- package/dist-cjs/puzzles/cube2/random-state.js +54 -0
- package/dist-cjs/puzzles/cube2/scrambler.js +58 -0
- package/dist-cjs/puzzles/cube2/solver/browser-loader.js +85 -0
- package/dist-cjs/puzzles/cube2/solver/generated/distances.bin +1 -0
- package/dist-cjs/puzzles/cube2/solver/generated/manifest.json +21 -0
- package/dist-cjs/puzzles/cube2/solver/generated/orientation-distances.bin +0 -0
- package/dist-cjs/puzzles/cube2/solver/generated/orientation-table.bin +0 -0
- package/dist-cjs/puzzles/cube2/solver/generated/permutation-distances.bin +0 -0
- package/dist-cjs/puzzles/cube2/solver/generated/permutation-table.bin +0 -0
- package/dist-cjs/puzzles/cube2/solver/generated-assets.js +61 -0
- package/dist-cjs/puzzles/cube2/solver/index.js +5 -0
- package/dist-cjs/puzzles/cube2/solver/node-loader.js +89 -0
- package/dist-cjs/puzzles/cube2/solver/search.js +53 -0
- package/dist-cjs/puzzles/cube2/solver/table-metadata.js +18 -0
- package/dist-cjs/puzzles/cube2/solver/tables.js +91 -0
- package/dist-cjs/puzzles/cube2/state.js +36 -0
- package/dist-cjs/puzzles/cube2/types.js +24 -0
- package/dist-cjs/puzzles/cube2/validation.js +78 -0
- package/dist-cjs/puzzles/cube3/facelets.js +94 -0
- package/dist-cjs/puzzles/cube3/index.js +68 -0
- package/dist-cjs/puzzles/cube3/moves.js +219 -0
- package/dist-cjs/puzzles/cube3/random-state.js +62 -0
- package/dist-cjs/puzzles/cube3/scrambler.js +63 -0
- package/dist-cjs/puzzles/cube3/solver/browser-loader.js +139 -0
- package/dist-cjs/puzzles/cube3/solver/coordinates.js +285 -0
- package/dist-cjs/puzzles/cube3/solver/generated/manifest.json +404 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-cornerOrientation.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-cornerPermutation.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-edgeOrientation.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-slicePermutation.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-udEdgePermutation.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/move-udSlice.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-cornerOrientation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-cornerOrientationEdgeOrientation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-cornerPermutation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-cornerPermutationSlicePermutation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-edgeOrientation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-slicePermutation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-udEdgePermutation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-udEdgePermutationSlicePermutation.bin +1 -0
- package/dist-cjs/puzzles/cube3/solver/generated/pruning-udSlice.bin +0 -0
- package/dist-cjs/puzzles/cube3/solver/generated-assets.js +98 -0
- package/dist-cjs/puzzles/cube3/solver/index.js +49 -0
- package/dist-cjs/puzzles/cube3/solver/node-loader.js +126 -0
- package/dist-cjs/puzzles/cube3/solver/phase1.js +158 -0
- package/dist-cjs/puzzles/cube3/solver/phase2.js +279 -0
- package/dist-cjs/puzzles/cube3/solver/search-utils.js +49 -0
- package/dist-cjs/puzzles/cube3/solver/table-metadata.js +24 -0
- package/dist-cjs/puzzles/cube3/solver/tables.js +216 -0
- package/dist-cjs/puzzles/cube3/state.js +46 -0
- package/dist-cjs/puzzles/cube3/subset-state.js +166 -0
- package/dist-cjs/puzzles/cube3/types.js +25 -0
- package/dist-cjs/puzzles/cube3/validation.js +89 -0
- package/dist-cjs/puzzles/cube4/facelets.js +140 -0
- package/dist-cjs/puzzles/cube4/index.js +45 -0
- package/dist-cjs/puzzles/cube4/moves.js +251 -0
- package/dist-cjs/puzzles/cube4/scrambler.js +135 -0
- package/dist-cjs/puzzles/cube4/state.js +92 -0
- package/dist-cjs/puzzles/cube4/types.js +65 -0
- package/dist-cjs/puzzles/cube5x5/index.js +9 -0
- package/dist-cjs/puzzles/cube5x5/scrambler.js +97 -0
- package/dist-cjs/puzzles/cube5x5/types.js +7 -0
- package/dist-cjs/puzzles/cube6x6/index.js +9 -0
- package/dist-cjs/puzzles/cube6x6/scrambler.js +109 -0
- package/dist-cjs/puzzles/cube6x6/types.js +11 -0
- package/dist-cjs/puzzles/cube7x7/index.js +9 -0
- package/dist-cjs/puzzles/cube7x7/scrambler.js +97 -0
- package/dist-cjs/puzzles/cube7x7/types.js +11 -0
- package/dist-cjs/puzzles/index.js +64 -0
- package/dist-cjs/puzzles/megaminx/index.js +11 -0
- package/dist-cjs/puzzles/megaminx/scrambler.js +60 -0
- package/dist-cjs/puzzles/megaminx/types.js +7 -0
- package/dist-cjs/puzzles/pyraminx/index.js +30 -0
- package/dist-cjs/puzzles/pyraminx/moves.js +126 -0
- package/dist-cjs/puzzles/pyraminx/random-state.js +56 -0
- package/dist-cjs/puzzles/pyraminx/scrambler.js +60 -0
- package/dist-cjs/puzzles/pyraminx/solver.js +170 -0
- package/dist-cjs/puzzles/pyraminx/state.js +38 -0
- package/dist-cjs/puzzles/pyraminx/types.js +10 -0
- package/dist-cjs/puzzles/pyraminx/validation.js +84 -0
- package/dist-cjs/random/index.js +5 -0
- package/dist-cjs/random/prng.js +63 -0
- package/docs/cubingcenter-integration.md +69 -0
- package/docs/development.md +44 -0
- package/docs/facelets.md +64 -0
- package/docs/getting-started.md +73 -0
- package/examples/cli-json.md +30 -0
- package/examples/commonjs.cjs +11 -0
- package/examples/esm.mjs +9 -0
- package/examples/timer-preview.mjs +29 -0
- package/package.json +53 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 4x4 Move Definitions
|
|
4
|
+
*
|
|
5
|
+
* Each base move (CW quarter-turn) is defined by its effect on:
|
|
6
|
+
* - Corner permutation & orientation (same as 3x3 for outer moves; identity for wide-only slice)
|
|
7
|
+
* - Wing permutation (24 wings)
|
|
8
|
+
* - Center permutation (24 centers)
|
|
9
|
+
*
|
|
10
|
+
* Wide moves (Uw, Rw, etc.) = outer move + inner slice.
|
|
11
|
+
* We define outer moves and inner slices separately, then compose.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.FACE_MOVE_EFFECTS = void 0;
|
|
15
|
+
exports.parseMove = parseMove;
|
|
16
|
+
exports.applyCube4Move = applyCube4Move;
|
|
17
|
+
exports.applyCube4Algorithm = applyCube4Algorithm;
|
|
18
|
+
exports.invertCube4Move = invertCube4Move;
|
|
19
|
+
exports.invertCube4Algorithm = invertCube4Algorithm;
|
|
20
|
+
exports.formatCube4Algorithm = formatCube4Algorithm;
|
|
21
|
+
exports.parseCube4Algorithm = parseCube4Algorithm;
|
|
22
|
+
exports.parseCube4Move = parseCube4Move;
|
|
23
|
+
const types_js_1 = require("./types.js");
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Identity arrays
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
const ID_CP = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
28
|
+
const ID_CO = [0, 0, 0, 0, 0, 0, 0, 0];
|
|
29
|
+
const ID_WP = Array.from({ length: 24 }, (_, i) => i);
|
|
30
|
+
const ID_CT = Array.from({ length: 24 }, (_, i) => i);
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Helper: apply cycles to an identity-initialized permutation array
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
function withCycles(base, ...cycles) {
|
|
35
|
+
const result = [...base];
|
|
36
|
+
for (const cycle of cycles) {
|
|
37
|
+
const last = result[cycle[cycle.length - 1]];
|
|
38
|
+
for (let i = cycle.length - 1; i > 0; i--) {
|
|
39
|
+
result[cycle[i]] = result[cycle[i - 1]];
|
|
40
|
+
}
|
|
41
|
+
result[cycle[0]] = last;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Outer face moves (single outer layer)
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
/*
|
|
49
|
+
* Corner numbering: 0=URF 1=UFL 2=ULB 3=UBR 4=DFR 5=DLF 6=DBL 7=DRB
|
|
50
|
+
*
|
|
51
|
+
* Wing numbering (24 wings):
|
|
52
|
+
* Pair 0 (UR): 0=URf, 1=URb Pair 6 (DL): 12=DLf, 13=DLb
|
|
53
|
+
* Pair 1 (UF): 2=UFr, 3=UFl Pair 7 (DB): 14=DBl, 15=DBr
|
|
54
|
+
* Pair 2 (UL): 4=ULf, 5=ULb Pair 8 (FR): 16=FRu, 17=FRd
|
|
55
|
+
* Pair 3 (UB): 6=UBl, 7=UBr Pair 9 (FL): 18=FLu, 19=FLd
|
|
56
|
+
* Pair 4 (DR): 8=DRf, 9=DRb Pair 10 (BL): 20=BLu, 21=BLd
|
|
57
|
+
* Pair 5 (DF): 10=DFr, 11=DFl Pair 11 (BR): 22=BRu, 23=BRd
|
|
58
|
+
*
|
|
59
|
+
* Center numbering (inner 2×2 per face, reading order):
|
|
60
|
+
* U: 0,1,2,3 R: 4,5,6,7 F: 8,9,10,11
|
|
61
|
+
* D: 12,13,14,15 L: 16,17,18,19 B: 20,21,22,23
|
|
62
|
+
*
|
|
63
|
+
* Within a face, positions are:
|
|
64
|
+
* 0=top-left 1=top-right
|
|
65
|
+
* 2=bot-left 3=bot-right
|
|
66
|
+
* (as seen looking at the face from the outside)
|
|
67
|
+
*/
|
|
68
|
+
const OUTER_U = {
|
|
69
|
+
cperm: [3, 0, 1, 2, 4, 5, 6, 7],
|
|
70
|
+
corient: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
71
|
+
wperm: [7, 6, 1, 0, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
72
|
+
ctperm: [2, 0, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
73
|
+
};
|
|
74
|
+
const OUTER_D = {
|
|
75
|
+
cperm: [0, 1, 2, 3, 5, 6, 7, 4],
|
|
76
|
+
corient: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
77
|
+
wperm: [0, 1, 2, 3, 4, 5, 6, 7, 11, 10, 12, 13, 14, 15, 9, 8, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
78
|
+
ctperm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 12, 15, 13, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
79
|
+
};
|
|
80
|
+
const OUTER_R = {
|
|
81
|
+
cperm: [4, 1, 2, 0, 7, 5, 6, 3],
|
|
82
|
+
corient: [2, 0, 0, 1, 1, 0, 0, 2],
|
|
83
|
+
wperm: [17, 16, 2, 3, 4, 5, 6, 7, 23, 22, 10, 11, 12, 13, 14, 15, 8, 9, 18, 19, 20, 21, 0, 1],
|
|
84
|
+
ctperm: [0, 1, 2, 3, 6, 4, 7, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
85
|
+
};
|
|
86
|
+
const OUTER_L = {
|
|
87
|
+
cperm: [0, 2, 6, 3, 4, 1, 5, 7],
|
|
88
|
+
corient: [0, 1, 2, 0, 0, 2, 1, 0],
|
|
89
|
+
wperm: [0, 1, 2, 3, 20, 21, 6, 7, 8, 9, 10, 11, 18, 19, 14, 15, 16, 17, 5, 4, 13, 12, 22, 23],
|
|
90
|
+
ctperm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 16, 19, 17, 20, 21, 22, 23],
|
|
91
|
+
};
|
|
92
|
+
const OUTER_F = {
|
|
93
|
+
cperm: [1, 5, 2, 3, 0, 4, 6, 7],
|
|
94
|
+
corient: [1, 2, 0, 0, 2, 1, 0, 0],
|
|
95
|
+
wperm: [0, 1, 18, 19, 4, 5, 6, 7, 8, 9, 16, 17, 12, 13, 14, 15, 3, 2, 11, 10, 20, 21, 22, 23],
|
|
96
|
+
ctperm: [0, 1, 2, 3, 4, 5, 6, 7, 10, 8, 11, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
97
|
+
};
|
|
98
|
+
const OUTER_B = {
|
|
99
|
+
cperm: [0, 1, 3, 7, 4, 5, 2, 6],
|
|
100
|
+
corient: [0, 0, 1, 2, 0, 0, 2, 1],
|
|
101
|
+
wperm: [0, 1, 2, 3, 4, 5, 22, 23, 8, 9, 10, 11, 12, 13, 20, 21, 16, 17, 18, 19, 7, 6, 15, 14],
|
|
102
|
+
ctperm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 20, 23, 21],
|
|
103
|
+
};
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Inner slices — derived from facelet simulation, verified x4=identity
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
const INNER_u = {
|
|
108
|
+
cperm: ID_CP, corient: ID_CO,
|
|
109
|
+
wperm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 22, 17, 16, 19, 18, 21, 20, 23],
|
|
110
|
+
ctperm: [0, 1, 2, 3, 20, 21, 6, 7, 4, 5, 10, 11, 12, 13, 14, 15, 8, 9, 18, 19, 16, 17, 22, 23],
|
|
111
|
+
};
|
|
112
|
+
const INNER_d = {
|
|
113
|
+
cperm: ID_CP, corient: ID_CO,
|
|
114
|
+
wperm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 18, 21, 20, 23, 22, 17],
|
|
115
|
+
ctperm: [0, 1, 2, 3, 4, 5, 10, 11, 8, 9, 18, 19, 12, 13, 14, 15, 16, 17, 22, 23, 20, 21, 6, 7],
|
|
116
|
+
};
|
|
117
|
+
const INNER_r = {
|
|
118
|
+
cperm: ID_CP, corient: ID_CO,
|
|
119
|
+
wperm: [0, 1, 10, 3, 4, 5, 6, 2, 8, 9, 15, 11, 12, 13, 14, 7, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
120
|
+
ctperm: [0, 9, 2, 11, 4, 5, 6, 7, 8, 13, 10, 15, 12, 22, 14, 20, 16, 17, 18, 19, 3, 21, 1, 23],
|
|
121
|
+
};
|
|
122
|
+
const INNER_l = {
|
|
123
|
+
cperm: ID_CP, corient: ID_CO,
|
|
124
|
+
wperm: [0, 1, 2, 6, 4, 5, 14, 7, 8, 9, 10, 3, 12, 13, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
125
|
+
ctperm: [23, 1, 21, 3, 4, 5, 6, 7, 0, 9, 2, 11, 8, 13, 10, 15, 16, 17, 18, 19, 20, 14, 22, 12],
|
|
126
|
+
};
|
|
127
|
+
const INNER_f = {
|
|
128
|
+
cperm: ID_CP, corient: ID_CO,
|
|
129
|
+
wperm: [4, 1, 2, 3, 12, 5, 6, 7, 0, 9, 10, 11, 8, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
130
|
+
ctperm: [0, 1, 19, 17, 2, 5, 3, 7, 8, 9, 10, 11, 6, 4, 14, 15, 16, 12, 18, 13, 20, 21, 22, 23],
|
|
131
|
+
};
|
|
132
|
+
const INNER_b = {
|
|
133
|
+
cperm: ID_CP, corient: ID_CO,
|
|
134
|
+
wperm: [0, 9, 2, 3, 4, 1, 6, 7, 8, 13, 10, 11, 12, 5, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
|
|
135
|
+
ctperm: [5, 7, 2, 3, 4, 15, 6, 14, 8, 9, 10, 11, 12, 13, 16, 18, 1, 17, 0, 19, 20, 21, 22, 23],
|
|
136
|
+
};
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Compose two effects to create wide moves: Xw = outer_X then inner_x
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
function composeEffects(a, b) {
|
|
141
|
+
const cp = new Array(types_js_1.CORNER_COUNT);
|
|
142
|
+
const co = new Array(types_js_1.CORNER_COUNT);
|
|
143
|
+
const wp = new Array(types_js_1.WING_COUNT);
|
|
144
|
+
const ct = new Array(types_js_1.CENTER_COUNT);
|
|
145
|
+
for (let i = 0; i < types_js_1.CORNER_COUNT; i++) {
|
|
146
|
+
cp[i] = a.cperm[b.cperm[i]];
|
|
147
|
+
co[i] = (a.corient[b.cperm[i]] + b.corient[i]) % 3;
|
|
148
|
+
}
|
|
149
|
+
for (let i = 0; i < types_js_1.WING_COUNT; i++) {
|
|
150
|
+
wp[i] = a.wperm[b.wperm[i]];
|
|
151
|
+
}
|
|
152
|
+
for (let i = 0; i < types_js_1.CENTER_COUNT; i++) {
|
|
153
|
+
ct[i] = a.ctperm[b.ctperm[i]];
|
|
154
|
+
}
|
|
155
|
+
return { cperm: cp, corient: co, wperm: wp, ctperm: ct };
|
|
156
|
+
}
|
|
157
|
+
// Wide moves = outer + inner
|
|
158
|
+
const WIDE_Uw = composeEffects(OUTER_U, INNER_u);
|
|
159
|
+
const WIDE_Dw = composeEffects(OUTER_D, INNER_d);
|
|
160
|
+
const WIDE_Rw = composeEffects(OUTER_R, INNER_r);
|
|
161
|
+
const WIDE_Lw = composeEffects(OUTER_L, INNER_l);
|
|
162
|
+
const WIDE_Fw = composeEffects(OUTER_F, INNER_f);
|
|
163
|
+
const WIDE_Bw = composeEffects(OUTER_B, INNER_b);
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Lookup table: face-move name → MoveEffect (CW quarter turn)
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
const FACE_MOVE_EFFECTS = {
|
|
168
|
+
U: OUTER_U, D: OUTER_D, R: OUTER_R, L: OUTER_L, F: OUTER_F, B: OUTER_B,
|
|
169
|
+
Uw: WIDE_Uw, Dw: WIDE_Dw, Rw: WIDE_Rw, Lw: WIDE_Lw, Fw: WIDE_Fw, Bw: WIDE_Bw
|
|
170
|
+
};
|
|
171
|
+
exports.FACE_MOVE_EFFECTS = FACE_MOVE_EFFECTS;
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// Apply a single move to a state
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
function applyEffect(state, effect) {
|
|
176
|
+
const cp = new Uint8Array(types_js_1.CORNER_COUNT);
|
|
177
|
+
const co = new Uint8Array(types_js_1.CORNER_COUNT);
|
|
178
|
+
const wp = new Uint8Array(types_js_1.WING_COUNT);
|
|
179
|
+
const centers = new Uint8Array(types_js_1.CENTER_COUNT);
|
|
180
|
+
for (let i = 0; i < types_js_1.CORNER_COUNT; i++) {
|
|
181
|
+
cp[i] = state.cp[effect.cperm[i]];
|
|
182
|
+
co[i] = (state.co[effect.cperm[i]] + effect.corient[i]) % 3;
|
|
183
|
+
}
|
|
184
|
+
for (let i = 0; i < types_js_1.WING_COUNT; i++) {
|
|
185
|
+
wp[i] = state.wp[effect.wperm[i]];
|
|
186
|
+
}
|
|
187
|
+
for (let i = 0; i < types_js_1.CENTER_COUNT; i++) {
|
|
188
|
+
centers[i] = state.centers[effect.ctperm[i]];
|
|
189
|
+
}
|
|
190
|
+
return { cp, co, wp, centers };
|
|
191
|
+
}
|
|
192
|
+
function parseMove(move) {
|
|
193
|
+
let face;
|
|
194
|
+
let suffix;
|
|
195
|
+
if (move.length >= 2 && move[1] === "w") {
|
|
196
|
+
face = move.slice(0, 2);
|
|
197
|
+
suffix = move.slice(2);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
face = move[0];
|
|
201
|
+
suffix = move.slice(1);
|
|
202
|
+
}
|
|
203
|
+
const turns = suffix === "2" ? 2 : suffix === "'" ? 3 : 1;
|
|
204
|
+
return { face: face, suffix, turns };
|
|
205
|
+
}
|
|
206
|
+
function applyCube4Move(state, move) {
|
|
207
|
+
const { face, turns } = parseMove(move);
|
|
208
|
+
const effect = FACE_MOVE_EFFECTS[face];
|
|
209
|
+
let current = state;
|
|
210
|
+
for (let i = 0; i < turns; i++) {
|
|
211
|
+
current = applyEffect(current, effect);
|
|
212
|
+
}
|
|
213
|
+
return current;
|
|
214
|
+
}
|
|
215
|
+
function applyCube4Algorithm(state, moves) {
|
|
216
|
+
let current = state;
|
|
217
|
+
for (const move of moves) {
|
|
218
|
+
current = applyCube4Move(current, move);
|
|
219
|
+
}
|
|
220
|
+
return current;
|
|
221
|
+
}
|
|
222
|
+
// ---------------------------------------------------------------------------
|
|
223
|
+
// Move inversion
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
function invertCube4Move(move) {
|
|
226
|
+
const { face, suffix } = parseMove(move);
|
|
227
|
+
if (suffix === "2")
|
|
228
|
+
return move;
|
|
229
|
+
return `${face}${suffix === "'" ? "" : "'"}`;
|
|
230
|
+
}
|
|
231
|
+
function invertCube4Algorithm(moves) {
|
|
232
|
+
return [...moves].reverse().map(invertCube4Move);
|
|
233
|
+
}
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
// Format / parse
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
function formatCube4Algorithm(moves) {
|
|
238
|
+
return moves.join(" ");
|
|
239
|
+
}
|
|
240
|
+
function parseCube4Algorithm(algorithm) {
|
|
241
|
+
const trimmed = algorithm.trim();
|
|
242
|
+
if (trimmed.length === 0)
|
|
243
|
+
return [];
|
|
244
|
+
return trimmed.split(/\s+/).map(parseCube4Move);
|
|
245
|
+
}
|
|
246
|
+
function parseCube4Move(value) {
|
|
247
|
+
if (types_js_1.CUBE4_ALL_MOVES.includes(value)) {
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
throw new Error(`Invalid 4x4 move: ${value}`);
|
|
251
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.cube4ScrambleGenerator = void 0;
|
|
37
|
+
exports.generateCube4Scramble = generateCube4Scramble;
|
|
38
|
+
const state_js_1 = require("./state.js");
|
|
39
|
+
const moves_js_1 = require("./moves.js");
|
|
40
|
+
const facelets_js_1 = require("./facelets.js");
|
|
41
|
+
const SCRAMBLE_LENGTH = 40;
|
|
42
|
+
exports.cube4ScrambleGenerator = {
|
|
43
|
+
info: {
|
|
44
|
+
eventId: "444",
|
|
45
|
+
name: "4x4x4 Cube",
|
|
46
|
+
puzzle: "cube-4x4",
|
|
47
|
+
quality: "random-move",
|
|
48
|
+
generator: "cube4-random-move",
|
|
49
|
+
description: "Random-move 4x4 scramble with 40 moves."
|
|
50
|
+
},
|
|
51
|
+
generate(options = {}) {
|
|
52
|
+
return generateCube4Scramble(options);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
async function generateCube4Scramble(options = {}) {
|
|
56
|
+
// Use cubing library for high-quality random-state 4x4 scrambles
|
|
57
|
+
const { randomScrambleForEvent } = await Promise.resolve().then(() => __importStar(require("cubing/scramble")));
|
|
58
|
+
const alg = await randomScrambleForEvent("444");
|
|
59
|
+
const scramble = alg.toString();
|
|
60
|
+
const moves = scramble.split(/\s+/);
|
|
61
|
+
const targetState = (0, moves_js_1.applyCube4Algorithm)((0, state_js_1.createSolvedCube4State)(), moves);
|
|
62
|
+
const faceletString = (0, facelets_js_1.formatCube4Facelets)((0, facelets_js_1.toCube4Facelets)(targetState));
|
|
63
|
+
const result = {
|
|
64
|
+
eventId: "444",
|
|
65
|
+
scramble,
|
|
66
|
+
moves,
|
|
67
|
+
quality: "random-state",
|
|
68
|
+
generator: "cubing-scramble",
|
|
69
|
+
metadata: {
|
|
70
|
+
totalMoves: moves.length,
|
|
71
|
+
distribution: "random-state",
|
|
72
|
+
state: targetState,
|
|
73
|
+
facelets: (0, facelets_js_1.toCube4Facelets)(targetState),
|
|
74
|
+
faceletString
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (options.seed !== undefined) {
|
|
78
|
+
result.seed = options.seed;
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
const MAX_AXIS_BLOCK = 3;
|
|
83
|
+
const ROTATION_PAIRS = {
|
|
84
|
+
"Uw": "Dw", "Dw": "Uw",
|
|
85
|
+
"Rw": "Lw", "Lw": "Rw",
|
|
86
|
+
"Fw": "Bw", "Bw": "Fw",
|
|
87
|
+
};
|
|
88
|
+
function getBaseMove(move) {
|
|
89
|
+
if (move.endsWith("2") || move.endsWith("'")) {
|
|
90
|
+
return move.slice(0, -1);
|
|
91
|
+
}
|
|
92
|
+
return move;
|
|
93
|
+
}
|
|
94
|
+
function getAxis(base) {
|
|
95
|
+
if (base.includes("R") || base.includes("L"))
|
|
96
|
+
return "X";
|
|
97
|
+
if (base.includes("U") || base.includes("D"))
|
|
98
|
+
return "Y";
|
|
99
|
+
if (base.includes("F") || base.includes("B"))
|
|
100
|
+
return "Z";
|
|
101
|
+
return "";
|
|
102
|
+
}
|
|
103
|
+
function isRedundant(moves, newMove) {
|
|
104
|
+
if (moves.length === 0)
|
|
105
|
+
return false;
|
|
106
|
+
const newBase = getBaseMove(newMove);
|
|
107
|
+
const newAxis = getAxis(newBase);
|
|
108
|
+
const lastBase = getBaseMove(moves[moves.length - 1]);
|
|
109
|
+
if (lastBase === newBase)
|
|
110
|
+
return true;
|
|
111
|
+
const lastAxis = getAxis(lastBase);
|
|
112
|
+
if (newAxis !== lastAxis)
|
|
113
|
+
return false;
|
|
114
|
+
const basesInBlock = new Set();
|
|
115
|
+
basesInBlock.add(lastBase);
|
|
116
|
+
let blockLength = 1;
|
|
117
|
+
for (let i = moves.length - 2; i >= 0; i--) {
|
|
118
|
+
const base = getBaseMove(moves[i]);
|
|
119
|
+
if (getAxis(base) === newAxis) {
|
|
120
|
+
basesInBlock.add(base);
|
|
121
|
+
blockLength++;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (basesInBlock.has(newBase))
|
|
128
|
+
return true;
|
|
129
|
+
const complement = ROTATION_PAIRS[newBase];
|
|
130
|
+
if (complement && basesInBlock.has(complement))
|
|
131
|
+
return true;
|
|
132
|
+
if (blockLength >= MAX_AXIS_BLOCK)
|
|
133
|
+
return true;
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSolvedCube4State = createSolvedCube4State;
|
|
4
|
+
exports.cloneCube4State = cloneCube4State;
|
|
5
|
+
exports.cube4StatesEqual = cube4StatesEqual;
|
|
6
|
+
exports.isSolvedCube4State = isSolvedCube4State;
|
|
7
|
+
exports.areCentersReduced = areCentersReduced;
|
|
8
|
+
exports.areWingsPaired = areWingsPaired;
|
|
9
|
+
const types_js_1 = require("./types.js");
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Factory
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
function createSolvedCube4State() {
|
|
14
|
+
const cp = new Uint8Array(types_js_1.CORNER_COUNT);
|
|
15
|
+
const co = new Uint8Array(types_js_1.CORNER_COUNT);
|
|
16
|
+
const wp = new Uint8Array(types_js_1.WING_COUNT);
|
|
17
|
+
const centers = new Uint8Array(types_js_1.CENTER_COUNT);
|
|
18
|
+
for (let i = 0; i < types_js_1.CORNER_COUNT; i++)
|
|
19
|
+
cp[i] = i;
|
|
20
|
+
for (let i = 0; i < types_js_1.WING_COUNT; i++)
|
|
21
|
+
wp[i] = i;
|
|
22
|
+
for (let i = 0; i < types_js_1.CENTER_COUNT; i++) {
|
|
23
|
+
centers[i] = Math.floor(i / types_js_1.CENTERS_PER_FACE);
|
|
24
|
+
}
|
|
25
|
+
return { cp, co, wp, centers };
|
|
26
|
+
}
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Clone
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
function cloneCube4State(s) {
|
|
31
|
+
return {
|
|
32
|
+
cp: new Uint8Array(s.cp),
|
|
33
|
+
co: new Uint8Array(s.co),
|
|
34
|
+
wp: new Uint8Array(s.wp),
|
|
35
|
+
centers: new Uint8Array(s.centers)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Equality
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
function cube4StatesEqual(a, b) {
|
|
42
|
+
return (typedArrayEqual(a.cp, b.cp) &&
|
|
43
|
+
typedArrayEqual(a.co, b.co) &&
|
|
44
|
+
typedArrayEqual(a.wp, b.wp) &&
|
|
45
|
+
typedArrayEqual(a.centers, b.centers));
|
|
46
|
+
}
|
|
47
|
+
function isSolvedCube4State(state) {
|
|
48
|
+
return cube4StatesEqual(state, createSolvedCube4State());
|
|
49
|
+
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Helpers
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
/**
|
|
54
|
+
* Check if centers are "reduced" — each face has exactly 4 centers of its color.
|
|
55
|
+
*/
|
|
56
|
+
function areCentersReduced(state) {
|
|
57
|
+
const counts = new Uint8Array(types_js_1.FACE_COUNT);
|
|
58
|
+
for (let i = 0; i < types_js_1.CENTER_COUNT; i++) {
|
|
59
|
+
counts[state.centers[i]] = counts[state.centers[i]] + 1;
|
|
60
|
+
}
|
|
61
|
+
for (let i = 0; i < types_js_1.FACE_COUNT; i++) {
|
|
62
|
+
if (counts[i] !== types_js_1.CENTERS_PER_FACE)
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if wings are paired — wings 2k and 2k+1 occupy the same
|
|
69
|
+
* 3x3-edge slot (i.e. ⌊wp[pos]/2⌋ matches for the two positions
|
|
70
|
+
* in each pair slot).
|
|
71
|
+
*/
|
|
72
|
+
function areWingsPaired(state) {
|
|
73
|
+
for (let pair = 0; pair < 12; pair++) {
|
|
74
|
+
const posA = pair * 2;
|
|
75
|
+
const posB = pair * 2 + 1;
|
|
76
|
+
const pieceA = state.wp[posA];
|
|
77
|
+
const pieceB = state.wp[posB];
|
|
78
|
+
// Both wings in this slot must belong to the same 3x3-edge
|
|
79
|
+
if (Math.floor(pieceA / 2) !== Math.floor(pieceB / 2))
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
function typedArrayEqual(a, b) {
|
|
85
|
+
if (a.length !== b.length)
|
|
86
|
+
return false;
|
|
87
|
+
for (let i = 0; i < a.length; i++) {
|
|
88
|
+
if (a[i] !== b[i])
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 4x4x4 Cube Types and Constants
|
|
4
|
+
*
|
|
5
|
+
* Piece counts:
|
|
6
|
+
* - 8 corners (same as 3x3, with permutation and orientation)
|
|
7
|
+
* - 24 wings (edge pieces without orientation)
|
|
8
|
+
* - 24 centers (4 per face, identified by color 0-5)
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.CUBE4_OUTER_MOVES = exports.CUBE4_ALL_MOVES = exports.CUBE4_FACE_MOVES = exports.B = exports.L = exports.D = exports.F = exports.R = exports.U = exports.CENTERS_PER_FACE = exports.FACE_COUNT = exports.CENTER_COUNT = exports.WING_COUNT = exports.CORNER_COUNT = void 0;
|
|
12
|
+
exports.CORNER_COUNT = 8;
|
|
13
|
+
exports.WING_COUNT = 24;
|
|
14
|
+
exports.CENTER_COUNT = 24;
|
|
15
|
+
exports.FACE_COUNT = 6;
|
|
16
|
+
exports.CENTERS_PER_FACE = 4;
|
|
17
|
+
// ---------- Faces ----------
|
|
18
|
+
// Face indices: U=0, R=1, F=2, D=3, L=4, B=5
|
|
19
|
+
exports.U = 0;
|
|
20
|
+
exports.R = 1;
|
|
21
|
+
exports.F = 2;
|
|
22
|
+
exports.D = 3;
|
|
23
|
+
exports.L = 4;
|
|
24
|
+
exports.B = 5;
|
|
25
|
+
exports.CUBE4_FACE_MOVES = [
|
|
26
|
+
"U", "D", "R", "L", "F", "B",
|
|
27
|
+
"Uw", "Dw", "Rw", "Lw", "Fw", "Bw"
|
|
28
|
+
];
|
|
29
|
+
exports.CUBE4_ALL_MOVES = exports.CUBE4_FACE_MOVES.flatMap((face) => [`${face}`, `${face}2`, `${face}'`]);
|
|
30
|
+
// Outer-only moves (used in certain reduction phases)
|
|
31
|
+
exports.CUBE4_OUTER_MOVES = [
|
|
32
|
+
"U", "U2", "U'", "D", "D2", "D'",
|
|
33
|
+
"R", "R2", "R'", "L", "L2", "L'",
|
|
34
|
+
"F", "F2", "F'", "B", "B2", "B'"
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Corner numbering (same as 3x3):
|
|
38
|
+
* 0=URF 1=UFL 2=ULB 3=UBR
|
|
39
|
+
* 4=DFR 5=DLF 6=DBL 7=DRB
|
|
40
|
+
*
|
|
41
|
+
* Wing numbering (24 wings, grouped by the 3x3-edge they belong to):
|
|
42
|
+
* The two wings of each 3x3 edge are numbered consecutively.
|
|
43
|
+
* Wing 2k and Wing 2k+1 form the pair for 3x3 edge k.
|
|
44
|
+
*
|
|
45
|
+
* Pair 0 (UR): wings 0, 1
|
|
46
|
+
* Pair 1 (UF): wings 2, 3
|
|
47
|
+
* Pair 2 (UL): wings 4, 5
|
|
48
|
+
* Pair 3 (UB): wings 6, 7
|
|
49
|
+
* Pair 4 (DR): wings 8, 9
|
|
50
|
+
* Pair 5 (DF): wings 10, 11
|
|
51
|
+
* Pair 6 (DL): wings 12, 13
|
|
52
|
+
* Pair 7 (DB): wings 14, 15
|
|
53
|
+
* Pair 8 (FR): wings 16, 17
|
|
54
|
+
* Pair 9 (FL): wings 18, 19
|
|
55
|
+
* Pair 10 (BL): wings 20, 21
|
|
56
|
+
* Pair 11 (BR): wings 22, 23
|
|
57
|
+
*
|
|
58
|
+
* Center numbering (4 centers per face, in reading order of inner 2x2):
|
|
59
|
+
* Face U: centers 0- 3
|
|
60
|
+
* Face R: centers 4- 7
|
|
61
|
+
* Face F: centers 8-11
|
|
62
|
+
* Face D: centers 12-15
|
|
63
|
+
* Face L: centers 16-19
|
|
64
|
+
* Face B: centers 20-23
|
|
65
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateCube5Scramble = exports.cube5ScrambleGenerator = exports.SCRAMBLE_LENGTH = exports.CUBE5_ALL_MOVES = void 0;
|
|
4
|
+
var types_js_1 = require("./types.js");
|
|
5
|
+
Object.defineProperty(exports, "CUBE5_ALL_MOVES", { enumerable: true, get: function () { return types_js_1.CUBE5_ALL_MOVES; } });
|
|
6
|
+
Object.defineProperty(exports, "SCRAMBLE_LENGTH", { enumerable: true, get: function () { return types_js_1.SCRAMBLE_LENGTH; } });
|
|
7
|
+
var scrambler_js_1 = require("./scrambler.js");
|
|
8
|
+
Object.defineProperty(exports, "cube5ScrambleGenerator", { enumerable: true, get: function () { return scrambler_js_1.cube5ScrambleGenerator; } });
|
|
9
|
+
Object.defineProperty(exports, "generateCube5Scramble", { enumerable: true, get: function () { return scrambler_js_1.generateCube5Scramble; } });
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cube5ScrambleGenerator = void 0;
|
|
4
|
+
exports.generateCube5Scramble = generateCube5Scramble;
|
|
5
|
+
const index_js_1 = require("../../random/index.js");
|
|
6
|
+
const types_js_1 = require("./types.js");
|
|
7
|
+
exports.cube5ScrambleGenerator = {
|
|
8
|
+
info: {
|
|
9
|
+
eventId: "555",
|
|
10
|
+
name: "5x5x5 Cube",
|
|
11
|
+
puzzle: "cube-5x5",
|
|
12
|
+
quality: "random-move",
|
|
13
|
+
generator: "cube5-random-move",
|
|
14
|
+
description: "Random-move 5x5 scramble with 60 moves."
|
|
15
|
+
},
|
|
16
|
+
generate(options = {}) {
|
|
17
|
+
return generateCube5Scramble(options);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function generateCube5Scramble(options = {}) {
|
|
21
|
+
const random = (0, index_js_1.createRandomSource)(options.seed);
|
|
22
|
+
const moves = [];
|
|
23
|
+
for (let i = 0; i < types_js_1.SCRAMBLE_LENGTH; i++) {
|
|
24
|
+
let move;
|
|
25
|
+
do {
|
|
26
|
+
move = random.choice(types_js_1.CUBE5_ALL_MOVES);
|
|
27
|
+
} while (isRedundant(moves, move));
|
|
28
|
+
moves.push(move);
|
|
29
|
+
}
|
|
30
|
+
const scramble = moves.join(" ");
|
|
31
|
+
const result = {
|
|
32
|
+
eventId: "555",
|
|
33
|
+
scramble,
|
|
34
|
+
moves,
|
|
35
|
+
quality: "random-move",
|
|
36
|
+
generator: "cube5-random-move",
|
|
37
|
+
metadata: {
|
|
38
|
+
totalMoves: moves.length,
|
|
39
|
+
distribution: "random-move-wca-format"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
if (options.seed !== undefined) {
|
|
43
|
+
result.seed = options.seed;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
const MAX_AXIS_BLOCK = 4;
|
|
48
|
+
function getBaseMove(move) {
|
|
49
|
+
if (move.endsWith("2") || move.endsWith("'")) {
|
|
50
|
+
return move.slice(0, -1);
|
|
51
|
+
}
|
|
52
|
+
return move;
|
|
53
|
+
}
|
|
54
|
+
function getAxis(base) {
|
|
55
|
+
if (base.includes("R") || base.includes("L"))
|
|
56
|
+
return "X";
|
|
57
|
+
if (base.includes("U") || base.includes("D"))
|
|
58
|
+
return "Y";
|
|
59
|
+
if (base.includes("F") || base.includes("B"))
|
|
60
|
+
return "Z";
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
function isRedundant(moves, newMove) {
|
|
64
|
+
if (moves.length === 0)
|
|
65
|
+
return false;
|
|
66
|
+
const newBase = getBaseMove(newMove);
|
|
67
|
+
const newAxis = getAxis(newBase);
|
|
68
|
+
const lastBase = getBaseMove(moves[moves.length - 1]);
|
|
69
|
+
// No same base move consecutively
|
|
70
|
+
if (lastBase === newBase)
|
|
71
|
+
return true;
|
|
72
|
+
const lastAxis = getAxis(lastBase);
|
|
73
|
+
// Different axis: always allowed
|
|
74
|
+
if (newAxis !== lastAxis)
|
|
75
|
+
return false;
|
|
76
|
+
// Same axis: scan the current block
|
|
77
|
+
const basesInBlock = new Set();
|
|
78
|
+
basesInBlock.add(lastBase);
|
|
79
|
+
let blockLength = 1;
|
|
80
|
+
for (let i = moves.length - 2; i >= 0; i--) {
|
|
81
|
+
const base = getBaseMove(moves[i]);
|
|
82
|
+
if (getAxis(base) === newAxis) {
|
|
83
|
+
basesInBlock.add(base);
|
|
84
|
+
blockLength++;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// No same base within the block
|
|
91
|
+
if (basesInBlock.has(newBase))
|
|
92
|
+
return true;
|
|
93
|
+
// Max block length
|
|
94
|
+
if (blockLength >= MAX_AXIS_BLOCK)
|
|
95
|
+
return true;
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SCRAMBLE_LENGTH = exports.CUBE5_ALL_MOVES = void 0;
|
|
4
|
+
const BASE_MOVES = ["U", "D", "R", "L", "F", "B", "Uw", "Dw", "Rw", "Lw", "Fw", "Bw"];
|
|
5
|
+
const SUFFIXES = ["", "2", "'"];
|
|
6
|
+
exports.CUBE5_ALL_MOVES = BASE_MOVES.flatMap((base) => SUFFIXES.map(suffix => `${base}${suffix}`));
|
|
7
|
+
exports.SCRAMBLE_LENGTH = 60;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateCube6Scramble = exports.cube6ScrambleGenerator = exports.SCRAMBLE_LENGTH = exports.CUBE6_ALL_MOVES = void 0;
|
|
4
|
+
var types_js_1 = require("./types.js");
|
|
5
|
+
Object.defineProperty(exports, "CUBE6_ALL_MOVES", { enumerable: true, get: function () { return types_js_1.CUBE6_ALL_MOVES; } });
|
|
6
|
+
Object.defineProperty(exports, "SCRAMBLE_LENGTH", { enumerable: true, get: function () { return types_js_1.SCRAMBLE_LENGTH; } });
|
|
7
|
+
var scrambler_js_1 = require("./scrambler.js");
|
|
8
|
+
Object.defineProperty(exports, "cube6ScrambleGenerator", { enumerable: true, get: function () { return scrambler_js_1.cube6ScrambleGenerator; } });
|
|
9
|
+
Object.defineProperty(exports, "generateCube6Scramble", { enumerable: true, get: function () { return scrambler_js_1.generateCube6Scramble; } });
|