@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,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSubsetCube3State = generateSubsetCube3State;
|
|
4
|
+
const state_js_1 = require("./state.js");
|
|
5
|
+
// The indices for the U layer pieces are 0, 1, 2, 3.
|
|
6
|
+
function generateSubsetCube3State(subset, random) {
|
|
7
|
+
const state = (0, state_js_1.createSolvedCube3State)();
|
|
8
|
+
if (subset === "pll") {
|
|
9
|
+
shuffleULayerPermutations(state, random);
|
|
10
|
+
}
|
|
11
|
+
else if (subset === "oll" || subset === "ll") {
|
|
12
|
+
shuffleULayerPermutations(state, random);
|
|
13
|
+
randomizeULayerOrientations(state, random, true, true);
|
|
14
|
+
}
|
|
15
|
+
else if (subset === "zbll") {
|
|
16
|
+
shuffleULayerPermutations(state, random);
|
|
17
|
+
randomizeULayerOrientations(state, random, true, false); // corners only
|
|
18
|
+
}
|
|
19
|
+
else if (subset === "lsll") {
|
|
20
|
+
shuffleLSLL(state, random);
|
|
21
|
+
}
|
|
22
|
+
else if (subset === "f2l") {
|
|
23
|
+
shuffleF2L(state, random);
|
|
24
|
+
}
|
|
25
|
+
else if (subset === "cross") {
|
|
26
|
+
shuffleFullCube(state, random);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error(`Subset "${subset}" is not supported yet.`);
|
|
30
|
+
}
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
function shuffleULayerPermutations(state, random) {
|
|
34
|
+
const cornerPerm = [0, 1, 2, 3];
|
|
35
|
+
const edgePerm = [0, 1, 2, 3];
|
|
36
|
+
shuffle(cornerPerm, random);
|
|
37
|
+
shuffle(edgePerm, random);
|
|
38
|
+
if (getParity(cornerPerm) !== getParity(edgePerm)) {
|
|
39
|
+
swap(edgePerm, 0, 1);
|
|
40
|
+
}
|
|
41
|
+
for (let i = 0; i < 4; i++) {
|
|
42
|
+
state.corners.permutation[i] = cornerPerm[i];
|
|
43
|
+
state.edges.permutation[i] = edgePerm[i];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function randomizeULayerOrientations(state, random, corners, edges) {
|
|
47
|
+
if (corners) {
|
|
48
|
+
let sum = 0;
|
|
49
|
+
for (let i = 0; i < 3; i++) {
|
|
50
|
+
const o = random.nextInt(3);
|
|
51
|
+
state.corners.orientation[i] = o;
|
|
52
|
+
sum += o;
|
|
53
|
+
}
|
|
54
|
+
state.corners.orientation[3] = (3 - (sum % 3)) % 3;
|
|
55
|
+
}
|
|
56
|
+
if (edges) {
|
|
57
|
+
let sum = 0;
|
|
58
|
+
for (let i = 0; i < 3; i++) {
|
|
59
|
+
const o = random.nextInt(2);
|
|
60
|
+
state.edges.orientation[i] = o;
|
|
61
|
+
sum += o;
|
|
62
|
+
}
|
|
63
|
+
state.edges.orientation[3] = (2 - (sum % 2)) % 2;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function shuffle(array, random) {
|
|
67
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
68
|
+
const j = random.nextInt(i + 1);
|
|
69
|
+
swap(array, i, j);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function swap(array, i, j) {
|
|
73
|
+
const temp = array[i];
|
|
74
|
+
array[i] = array[j];
|
|
75
|
+
array[j] = temp;
|
|
76
|
+
}
|
|
77
|
+
function getParity(array) {
|
|
78
|
+
let inversions = 0;
|
|
79
|
+
for (let i = 0; i < array.length; i++) {
|
|
80
|
+
for (let j = i + 1; j < array.length; j++) {
|
|
81
|
+
if (array[i] > array[j]) {
|
|
82
|
+
inversions++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return inversions % 2;
|
|
87
|
+
}
|
|
88
|
+
function shuffleLSLL(state, random) {
|
|
89
|
+
const cornerPerm = [0, 1, 2, 3, 4];
|
|
90
|
+
const edgePerm = [0, 1, 2, 3, 8];
|
|
91
|
+
shuffle(cornerPerm, random);
|
|
92
|
+
shuffle(edgePerm, random);
|
|
93
|
+
if (getParity(cornerPerm) !== getParity(edgePerm)) {
|
|
94
|
+
swap(edgePerm, 0, 1);
|
|
95
|
+
}
|
|
96
|
+
const cornerIndices = [0, 1, 2, 3, 4];
|
|
97
|
+
for (let i = 0; i < cornerIndices.length; i++) {
|
|
98
|
+
const idx = cornerIndices[i];
|
|
99
|
+
state.corners.permutation[idx] = cornerPerm[i];
|
|
100
|
+
state.corners.orientation[idx] = random.nextInt(3);
|
|
101
|
+
}
|
|
102
|
+
let cornerSum = 0;
|
|
103
|
+
for (let i = 0; i < 8; i++)
|
|
104
|
+
cornerSum += state.corners.orientation[i];
|
|
105
|
+
state.corners.orientation[4] = (state.corners.orientation[4] + (3 - (cornerSum % 3))) % 3;
|
|
106
|
+
const edgeIndices = [0, 1, 2, 3, 8];
|
|
107
|
+
for (let i = 0; i < edgeIndices.length; i++) {
|
|
108
|
+
const idx = edgeIndices[i];
|
|
109
|
+
state.edges.permutation[idx] = edgePerm[i];
|
|
110
|
+
state.edges.orientation[idx] = random.nextInt(2);
|
|
111
|
+
}
|
|
112
|
+
let edgeSum = 0;
|
|
113
|
+
for (let i = 0; i < 12; i++)
|
|
114
|
+
edgeSum += state.edges.orientation[i];
|
|
115
|
+
state.edges.orientation[8] = (state.edges.orientation[8] + (2 - (edgeSum % 2))) % 2;
|
|
116
|
+
}
|
|
117
|
+
function shuffleF2L(state, random) {
|
|
118
|
+
const cornerPerm = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
119
|
+
const edgePerm = [0, 1, 2, 3, 8, 9, 10, 11];
|
|
120
|
+
shuffle(cornerPerm, random);
|
|
121
|
+
shuffle(edgePerm, random);
|
|
122
|
+
if (getParity(cornerPerm) !== getParity(edgePerm)) {
|
|
123
|
+
swap(edgePerm, 0, 1);
|
|
124
|
+
}
|
|
125
|
+
const edgeIndices = [0, 1, 2, 3, 8, 9, 10, 11];
|
|
126
|
+
for (let i = 0; i < 8; i++) {
|
|
127
|
+
state.corners.permutation[i] = cornerPerm[i];
|
|
128
|
+
state.corners.orientation[i] = random.nextInt(3);
|
|
129
|
+
const idx = edgeIndices[i];
|
|
130
|
+
state.edges.permutation[idx] = edgePerm[i];
|
|
131
|
+
state.edges.orientation[idx] = random.nextInt(2);
|
|
132
|
+
}
|
|
133
|
+
let cornerSum = 0;
|
|
134
|
+
for (let i = 0; i < 8; i++)
|
|
135
|
+
cornerSum += state.corners.orientation[i];
|
|
136
|
+
state.corners.orientation[0] = (state.corners.orientation[0] + (3 - (cornerSum % 3))) % 3;
|
|
137
|
+
let edgeSum = 0;
|
|
138
|
+
for (let i = 0; i < 12; i++)
|
|
139
|
+
edgeSum += state.edges.orientation[i];
|
|
140
|
+
state.edges.orientation[0] = (state.edges.orientation[0] + (2 - (edgeSum % 2))) % 2;
|
|
141
|
+
}
|
|
142
|
+
function shuffleFullCube(state, random) {
|
|
143
|
+
const cornerPerm = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
144
|
+
const edgePerm = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
145
|
+
shuffle(cornerPerm, random);
|
|
146
|
+
shuffle(edgePerm, random);
|
|
147
|
+
if (getParity(cornerPerm) !== getParity(edgePerm)) {
|
|
148
|
+
swap(edgePerm, 0, 1);
|
|
149
|
+
}
|
|
150
|
+
for (let i = 0; i < 8; i++) {
|
|
151
|
+
state.corners.permutation[i] = cornerPerm[i];
|
|
152
|
+
state.corners.orientation[i] = random.nextInt(3);
|
|
153
|
+
}
|
|
154
|
+
for (let i = 0; i < 12; i++) {
|
|
155
|
+
state.edges.permutation[i] = edgePerm[i];
|
|
156
|
+
state.edges.orientation[i] = random.nextInt(2);
|
|
157
|
+
}
|
|
158
|
+
let cornerSum = 0;
|
|
159
|
+
for (let i = 0; i < 8; i++)
|
|
160
|
+
cornerSum += state.corners.orientation[i];
|
|
161
|
+
state.corners.orientation[0] = (state.corners.orientation[0] + (3 - (cornerSum % 3))) % 3;
|
|
162
|
+
let edgeSum = 0;
|
|
163
|
+
for (let i = 0; i < 12; i++)
|
|
164
|
+
edgeSum += state.edges.orientation[i];
|
|
165
|
+
state.edges.orientation[0] = (state.edges.orientation[0] + (2 - (edgeSum % 2))) % 2;
|
|
166
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CUBE3_MOVES = exports.EDGE_COUNT = exports.CORNER_COUNT = void 0;
|
|
4
|
+
exports.CORNER_COUNT = 8;
|
|
5
|
+
exports.EDGE_COUNT = 12;
|
|
6
|
+
exports.CUBE3_MOVES = [
|
|
7
|
+
"U",
|
|
8
|
+
"U2",
|
|
9
|
+
"U'",
|
|
10
|
+
"D",
|
|
11
|
+
"D2",
|
|
12
|
+
"D'",
|
|
13
|
+
"R",
|
|
14
|
+
"R2",
|
|
15
|
+
"R'",
|
|
16
|
+
"L",
|
|
17
|
+
"L2",
|
|
18
|
+
"L'",
|
|
19
|
+
"F",
|
|
20
|
+
"F2",
|
|
21
|
+
"F'",
|
|
22
|
+
"B",
|
|
23
|
+
"B2",
|
|
24
|
+
"B'"
|
|
25
|
+
];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateCube3State = validateCube3State;
|
|
4
|
+
exports.isOneMoveFromSolvedCube3State = isOneMoveFromSolvedCube3State;
|
|
5
|
+
exports.isAllowedRandomCube3State = isAllowedRandomCube3State;
|
|
6
|
+
exports.permutationParity = permutationParity;
|
|
7
|
+
const types_js_1 = require("./types.js");
|
|
8
|
+
const moves_js_1 = require("./moves.js");
|
|
9
|
+
const state_js_1 = require("./state.js");
|
|
10
|
+
function validateCube3State(state) {
|
|
11
|
+
const errors = [
|
|
12
|
+
...validatePermutation("corner", state.corners.permutation, types_js_1.CORNER_COUNT),
|
|
13
|
+
...validatePermutation("edge", state.edges.permutation, types_js_1.EDGE_COUNT),
|
|
14
|
+
...validateOrientations("corner", state.corners.orientation, types_js_1.CORNER_COUNT, 3),
|
|
15
|
+
...validateOrientations("edge", state.edges.orientation, types_js_1.EDGE_COUNT, 2)
|
|
16
|
+
];
|
|
17
|
+
if (errors.length === 0) {
|
|
18
|
+
const cornerOrientation = sum(state.corners.orientation) % 3;
|
|
19
|
+
const edgeOrientation = sum(state.edges.orientation) % 2;
|
|
20
|
+
const cornerParity = permutationParity(state.corners.permutation);
|
|
21
|
+
const edgeParity = permutationParity(state.edges.permutation);
|
|
22
|
+
if (cornerOrientation !== 0) {
|
|
23
|
+
errors.push("Corner orientation sum must be divisible by 3.");
|
|
24
|
+
}
|
|
25
|
+
if (edgeOrientation !== 0) {
|
|
26
|
+
errors.push("Edge orientation sum must be divisible by 2.");
|
|
27
|
+
}
|
|
28
|
+
if (cornerParity !== edgeParity) {
|
|
29
|
+
errors.push("Corner and edge permutation parity must match.");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
valid: errors.length === 0,
|
|
34
|
+
errors
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function isOneMoveFromSolvedCube3State(state) {
|
|
38
|
+
const solved = (0, state_js_1.createSolvedCube3State)();
|
|
39
|
+
return types_js_1.CUBE3_MOVES.some((move) => (0, state_js_1.cube3StatesEqual)((0, moves_js_1.applyCube3Move)(solved, move), state));
|
|
40
|
+
}
|
|
41
|
+
function isAllowedRandomCube3State(state) {
|
|
42
|
+
return validateCube3State(state).valid &&
|
|
43
|
+
!(0, state_js_1.isSolvedCube3State)(state) &&
|
|
44
|
+
!isOneMoveFromSolvedCube3State(state);
|
|
45
|
+
}
|
|
46
|
+
function permutationParity(permutation) {
|
|
47
|
+
let inversions = 0;
|
|
48
|
+
for (let left = 0; left < permutation.length; left += 1) {
|
|
49
|
+
for (let right = left + 1; right < permutation.length; right += 1) {
|
|
50
|
+
if (permutation[left] > permutation[right]) {
|
|
51
|
+
inversions += 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return (inversions % 2);
|
|
56
|
+
}
|
|
57
|
+
function validatePermutation(label, permutation, length) {
|
|
58
|
+
const errors = [];
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
if (permutation.length !== length) {
|
|
61
|
+
errors.push(`${label} permutation must contain ${length} values.`);
|
|
62
|
+
}
|
|
63
|
+
for (const value of permutation) {
|
|
64
|
+
if (!Number.isInteger(value) || value < 0 || value >= length) {
|
|
65
|
+
errors.push(`${label} permutation contains out-of-range value: ${value}.`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (seen.has(value)) {
|
|
69
|
+
errors.push(`${label} permutation contains duplicate value: ${value}.`);
|
|
70
|
+
}
|
|
71
|
+
seen.add(value);
|
|
72
|
+
}
|
|
73
|
+
return errors;
|
|
74
|
+
}
|
|
75
|
+
function validateOrientations(label, orientations, length, modulo) {
|
|
76
|
+
const errors = [];
|
|
77
|
+
if (orientations.length !== length) {
|
|
78
|
+
errors.push(`${label} orientation must contain ${length} values.`);
|
|
79
|
+
}
|
|
80
|
+
for (const value of orientations) {
|
|
81
|
+
if (!Number.isInteger(value) || value < 0 || value >= modulo) {
|
|
82
|
+
errors.push(`${label} orientation contains out-of-range value: ${value}.`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return errors;
|
|
86
|
+
}
|
|
87
|
+
function sum(values) {
|
|
88
|
+
return values.reduce((total, value) => total + value, 0);
|
|
89
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCube4Facelets = toCube4Facelets;
|
|
4
|
+
exports.formatCube4Facelets = formatCube4Facelets;
|
|
5
|
+
exports.getCube4FaceOrder = getCube4FaceOrder;
|
|
6
|
+
const types_js_1 = require("./types.js");
|
|
7
|
+
const FACE_ORDER = ["U", "R", "F", "D", "L", "B"];
|
|
8
|
+
const FACE_LETTERS = FACE_ORDER;
|
|
9
|
+
const CENTER_SLOTS = [5, 6, 9, 10];
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Corner piece sticker colors (by piece identity 0-7, same as 3x3)
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
const CORNER_PIECE_STICKERS = [
|
|
14
|
+
["U", "R", "F"], // 0 = URF
|
|
15
|
+
["U", "F", "L"], // 1 = UFL
|
|
16
|
+
["U", "L", "B"], // 2 = ULB
|
|
17
|
+
["U", "B", "R"], // 3 = UBR
|
|
18
|
+
["D", "F", "R"], // 4 = DFR
|
|
19
|
+
["D", "L", "F"], // 5 = DLF
|
|
20
|
+
["D", "B", "L"], // 6 = DBL
|
|
21
|
+
["D", "R", "B"], // 7 = DRB
|
|
22
|
+
];
|
|
23
|
+
const CORNER_POSITION_SLOTS = [
|
|
24
|
+
[["U", 15], ["R", 0], ["F", 3]], // 0 = URF
|
|
25
|
+
[["U", 12], ["F", 0], ["L", 3]], // 1 = UFL
|
|
26
|
+
[["U", 0], ["L", 0], ["B", 3]], // 2 = ULB
|
|
27
|
+
[["U", 3], ["B", 0], ["R", 3]], // 3 = UBR
|
|
28
|
+
[["D", 3], ["F", 15], ["R", 12]], // 4 = DFR
|
|
29
|
+
[["D", 0], ["L", 15], ["F", 12]], // 5 = DLF
|
|
30
|
+
[["D", 12], ["B", 15], ["L", 12]], // 6 = DBL
|
|
31
|
+
[["D", 15], ["R", 15], ["B", 12]], // 7 = DRB
|
|
32
|
+
];
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Wing piece color pairs (by wing identity 0-23)
|
|
35
|
+
// Wings 2k and 2k+1 share the same colors (they form a 3x3-edge pair).
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
const WING_PIECE_COLORS = [
|
|
38
|
+
["U", "R"], ["U", "R"], // 0, 1 UR pair
|
|
39
|
+
["U", "F"], ["U", "F"], // 2, 3 UF pair
|
|
40
|
+
["U", "L"], ["U", "L"], // 4, 5 UL pair
|
|
41
|
+
["U", "B"], ["U", "B"], // 6, 7 UB pair
|
|
42
|
+
["D", "R"], ["D", "R"], // 8, 9 DR pair
|
|
43
|
+
["D", "F"], ["D", "F"], // 10, 11 DF pair
|
|
44
|
+
["D", "L"], ["D", "L"], // 12, 13 DL pair
|
|
45
|
+
["D", "B"], ["D", "B"], // 14, 15 DB pair
|
|
46
|
+
["F", "R"], ["F", "R"], // 16, 17 FR pair
|
|
47
|
+
["F", "L"], ["F", "L"], // 18, 19 FL pair
|
|
48
|
+
["B", "L"], ["B", "L"], // 20, 21 BL pair
|
|
49
|
+
["B", "R"], ["B", "R"], // 22, 23 BR pair
|
|
50
|
+
];
|
|
51
|
+
const WING_POSITION_SLOTS = [
|
|
52
|
+
[["U", 11], ["R", 1]], // 0 URf
|
|
53
|
+
[["U", 7], ["R", 2]], // 1 URb
|
|
54
|
+
[["U", 14], ["F", 2]], // 2 UFr
|
|
55
|
+
[["U", 13], ["F", 1]], // 3 UFl
|
|
56
|
+
[["U", 8], ["L", 2]], // 4 ULf
|
|
57
|
+
[["U", 4], ["L", 1]], // 5 ULb
|
|
58
|
+
[["U", 1], ["B", 2]], // 6 UBl
|
|
59
|
+
[["U", 2], ["B", 1]], // 7 UBr
|
|
60
|
+
[["D", 7], ["R", 13]], // 8 DRf
|
|
61
|
+
[["D", 11], ["R", 14]], // 9 DRb
|
|
62
|
+
[["D", 2], ["F", 14]], // 10 DFr
|
|
63
|
+
[["D", 1], ["F", 13]], // 11 DFl
|
|
64
|
+
[["D", 4], ["L", 14]], // 12 DLf
|
|
65
|
+
[["D", 8], ["L", 13]], // 13 DLb
|
|
66
|
+
[["D", 13], ["B", 14]], // 14 DBl
|
|
67
|
+
[["D", 14], ["B", 13]], // 15 DBr
|
|
68
|
+
[["F", 7], ["R", 4]], // 16 FRu
|
|
69
|
+
[["F", 11], ["R", 8]], // 17 FRd
|
|
70
|
+
[["F", 4], ["L", 7]], // 18 FLu
|
|
71
|
+
[["F", 8], ["L", 11]], // 19 FLd
|
|
72
|
+
[["B", 7], ["L", 4]], // 20 BLu
|
|
73
|
+
[["B", 11], ["L", 8]], // 21 BLd
|
|
74
|
+
[["B", 4], ["R", 7]], // 22 BRu
|
|
75
|
+
[["B", 8], ["R", 11]], // 23 BRd
|
|
76
|
+
];
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// toCube4Facelets
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
function toCube4Facelets(state) {
|
|
81
|
+
const f = {
|
|
82
|
+
U: Array(16).fill("U"),
|
|
83
|
+
R: Array(16).fill("R"),
|
|
84
|
+
F: Array(16).fill("F"),
|
|
85
|
+
D: Array(16).fill("D"),
|
|
86
|
+
L: Array(16).fill("L"),
|
|
87
|
+
B: Array(16).fill("B"),
|
|
88
|
+
};
|
|
89
|
+
// Centers
|
|
90
|
+
for (let i = 0; i < types_js_1.CENTER_COUNT; i++) {
|
|
91
|
+
const face = FACE_LETTERS[Math.floor(i / 4)];
|
|
92
|
+
const slot = CENTER_SLOTS[i % 4];
|
|
93
|
+
f[face][slot] = FACE_LETTERS[state.centers[i]];
|
|
94
|
+
}
|
|
95
|
+
// Corners
|
|
96
|
+
for (let pos = 0; pos < types_js_1.CORNER_COUNT; pos++) {
|
|
97
|
+
const piece = state.cp[pos];
|
|
98
|
+
const ori = state.co[pos];
|
|
99
|
+
const slots = CORNER_POSITION_SLOTS[pos];
|
|
100
|
+
const stickers = CORNER_PIECE_STICKERS[piece];
|
|
101
|
+
for (let i = 0; i < slots.length; i++) {
|
|
102
|
+
const [face, idx] = slots[i];
|
|
103
|
+
f[face][idx] = stickers[(i - ori + stickers.length) % stickers.length];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Wings: Recover orientation mathematically using XOR orbit parity!
|
|
107
|
+
// A wing is physically flipped if its chiral group (Left/Right) differs from the slot's chiral group.
|
|
108
|
+
const RIGHT_GROUP = new Set([1, 2, 4, 6, 8, 11, 13, 15, 16, 19, 20, 23]);
|
|
109
|
+
for (let pos = 0; pos < types_js_1.WING_COUNT; pos++) {
|
|
110
|
+
const piece = state.wp[pos];
|
|
111
|
+
const slots = WING_POSITION_SLOTS[pos];
|
|
112
|
+
const colors = WING_PIECE_COLORS[piece];
|
|
113
|
+
const [f0, i0] = slots[0];
|
|
114
|
+
const [f1, i1] = slots[1];
|
|
115
|
+
const wingIsRight = RIGHT_GROUP.has(piece);
|
|
116
|
+
const slotIsRight = RIGHT_GROUP.has(pos);
|
|
117
|
+
const isFlipped = wingIsRight !== slotIsRight;
|
|
118
|
+
if (isFlipped) {
|
|
119
|
+
f[f0][i0] = colors[1]; // Secondary color to primary slot sticker
|
|
120
|
+
f[f1][i1] = colors[0]; // Primary color to secondary slot sticker
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
f[f0][i0] = colors[0]; // Primary color to primary slot sticker
|
|
124
|
+
f[f1][i1] = colors[1]; // Secondary color to secondary slot sticker
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return f;
|
|
128
|
+
}
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// formatCube4Facelets
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
function formatCube4Facelets(facelets) {
|
|
133
|
+
return FACE_ORDER.map((face) => facelets[face].join("")).join("");
|
|
134
|
+
}
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// getCube4FaceOrder
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
function getCube4FaceOrder() {
|
|
139
|
+
return FACE_ORDER;
|
|
140
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// cube4 barrel exports
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCube4FaceOrder = exports.formatCube4Facelets = exports.toCube4Facelets = exports.generateCube4Scramble = exports.cube4ScrambleGenerator = exports.FACE_MOVE_EFFECTS = exports.parseMove = exports.parseCube4Move = exports.parseCube4Algorithm = exports.formatCube4Algorithm = exports.invertCube4Algorithm = exports.invertCube4Move = exports.applyCube4Algorithm = exports.applyCube4Move = exports.areWingsPaired = exports.areCentersReduced = exports.isSolvedCube4State = exports.cube4StatesEqual = exports.cloneCube4State = exports.createSolvedCube4State = 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;
|
|
7
|
+
var types_js_1 = require("./types.js");
|
|
8
|
+
Object.defineProperty(exports, "CORNER_COUNT", { enumerable: true, get: function () { return types_js_1.CORNER_COUNT; } });
|
|
9
|
+
Object.defineProperty(exports, "WING_COUNT", { enumerable: true, get: function () { return types_js_1.WING_COUNT; } });
|
|
10
|
+
Object.defineProperty(exports, "CENTER_COUNT", { enumerable: true, get: function () { return types_js_1.CENTER_COUNT; } });
|
|
11
|
+
Object.defineProperty(exports, "FACE_COUNT", { enumerable: true, get: function () { return types_js_1.FACE_COUNT; } });
|
|
12
|
+
Object.defineProperty(exports, "CENTERS_PER_FACE", { enumerable: true, get: function () { return types_js_1.CENTERS_PER_FACE; } });
|
|
13
|
+
Object.defineProperty(exports, "U", { enumerable: true, get: function () { return types_js_1.U; } });
|
|
14
|
+
Object.defineProperty(exports, "R", { enumerable: true, get: function () { return types_js_1.R; } });
|
|
15
|
+
Object.defineProperty(exports, "F", { enumerable: true, get: function () { return types_js_1.F; } });
|
|
16
|
+
Object.defineProperty(exports, "D", { enumerable: true, get: function () { return types_js_1.D; } });
|
|
17
|
+
Object.defineProperty(exports, "L", { enumerable: true, get: function () { return types_js_1.L; } });
|
|
18
|
+
Object.defineProperty(exports, "B", { enumerable: true, get: function () { return types_js_1.B; } });
|
|
19
|
+
Object.defineProperty(exports, "CUBE4_FACE_MOVES", { enumerable: true, get: function () { return types_js_1.CUBE4_FACE_MOVES; } });
|
|
20
|
+
Object.defineProperty(exports, "CUBE4_ALL_MOVES", { enumerable: true, get: function () { return types_js_1.CUBE4_ALL_MOVES; } });
|
|
21
|
+
Object.defineProperty(exports, "CUBE4_OUTER_MOVES", { enumerable: true, get: function () { return types_js_1.CUBE4_OUTER_MOVES; } });
|
|
22
|
+
var state_js_1 = require("./state.js");
|
|
23
|
+
Object.defineProperty(exports, "createSolvedCube4State", { enumerable: true, get: function () { return state_js_1.createSolvedCube4State; } });
|
|
24
|
+
Object.defineProperty(exports, "cloneCube4State", { enumerable: true, get: function () { return state_js_1.cloneCube4State; } });
|
|
25
|
+
Object.defineProperty(exports, "cube4StatesEqual", { enumerable: true, get: function () { return state_js_1.cube4StatesEqual; } });
|
|
26
|
+
Object.defineProperty(exports, "isSolvedCube4State", { enumerable: true, get: function () { return state_js_1.isSolvedCube4State; } });
|
|
27
|
+
Object.defineProperty(exports, "areCentersReduced", { enumerable: true, get: function () { return state_js_1.areCentersReduced; } });
|
|
28
|
+
Object.defineProperty(exports, "areWingsPaired", { enumerable: true, get: function () { return state_js_1.areWingsPaired; } });
|
|
29
|
+
var moves_js_1 = require("./moves.js");
|
|
30
|
+
Object.defineProperty(exports, "applyCube4Move", { enumerable: true, get: function () { return moves_js_1.applyCube4Move; } });
|
|
31
|
+
Object.defineProperty(exports, "applyCube4Algorithm", { enumerable: true, get: function () { return moves_js_1.applyCube4Algorithm; } });
|
|
32
|
+
Object.defineProperty(exports, "invertCube4Move", { enumerable: true, get: function () { return moves_js_1.invertCube4Move; } });
|
|
33
|
+
Object.defineProperty(exports, "invertCube4Algorithm", { enumerable: true, get: function () { return moves_js_1.invertCube4Algorithm; } });
|
|
34
|
+
Object.defineProperty(exports, "formatCube4Algorithm", { enumerable: true, get: function () { return moves_js_1.formatCube4Algorithm; } });
|
|
35
|
+
Object.defineProperty(exports, "parseCube4Algorithm", { enumerable: true, get: function () { return moves_js_1.parseCube4Algorithm; } });
|
|
36
|
+
Object.defineProperty(exports, "parseCube4Move", { enumerable: true, get: function () { return moves_js_1.parseCube4Move; } });
|
|
37
|
+
Object.defineProperty(exports, "parseMove", { enumerable: true, get: function () { return moves_js_1.parseMove; } });
|
|
38
|
+
Object.defineProperty(exports, "FACE_MOVE_EFFECTS", { enumerable: true, get: function () { return moves_js_1.FACE_MOVE_EFFECTS; } });
|
|
39
|
+
var scrambler_js_1 = require("./scrambler.js");
|
|
40
|
+
Object.defineProperty(exports, "cube4ScrambleGenerator", { enumerable: true, get: function () { return scrambler_js_1.cube4ScrambleGenerator; } });
|
|
41
|
+
Object.defineProperty(exports, "generateCube4Scramble", { enumerable: true, get: function () { return scrambler_js_1.generateCube4Scramble; } });
|
|
42
|
+
var facelets_js_1 = require("./facelets.js");
|
|
43
|
+
Object.defineProperty(exports, "toCube4Facelets", { enumerable: true, get: function () { return facelets_js_1.toCube4Facelets; } });
|
|
44
|
+
Object.defineProperty(exports, "formatCube4Facelets", { enumerable: true, get: function () { return facelets_js_1.formatCube4Facelets; } });
|
|
45
|
+
Object.defineProperty(exports, "getCube4FaceOrder", { enumerable: true, get: function () { return facelets_js_1.getCube4FaceOrder; } });
|