cubing 0.22.0 → 0.24.0-pre2

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.
Files changed (1061) hide show
  1. package/README.md +5 -8
  2. package/alg/package.json +1 -3
  3. package/bluetooth/package.json +1 -3
  4. package/dist/esm/{2x2x2.kpuzzle.json-JOGUSQ4N.js → 2x2x2.kpuzzle.json-U5KOZCMU.js} +11 -11
  5. package/dist/esm/2x2x2.kpuzzle.json-U5KOZCMU.js.map +7 -0
  6. package/{src/cubing/search/inside/solve/puzzles/2x2x2.sgs.json.ts → dist/esm/2x2x2.sgs.json-UAYPCQVL.js} +21 -13
  7. package/dist/esm/2x2x2.sgs.json-UAYPCQVL.js.map +7 -0
  8. package/dist/esm/{3d-3WQVOHX5.js → 3d-NFF7OGTI.js} +4 -4
  9. package/dist/esm/{3d-3WQVOHX5.js.map → 3d-NFF7OGTI.js.map} +0 -0
  10. package/dist/esm/bluetooth/index.d.ts +1 -1
  11. package/dist/esm/bluetooth/index.js +46 -38
  12. package/dist/esm/bluetooth/index.js.map +3 -3
  13. package/dist/esm/chunk-27KJGD3S.js +84 -0
  14. package/dist/esm/chunk-27KJGD3S.js.map +7 -0
  15. package/dist/esm/chunk-37EHU3GZ.js +66 -0
  16. package/dist/esm/chunk-37EHU3GZ.js.map +7 -0
  17. package/dist/esm/chunk-7OPCF2OL.js +274 -0
  18. package/dist/esm/chunk-7OPCF2OL.js.map +7 -0
  19. package/dist/esm/chunk-BJIOROQC.js +18 -0
  20. package/dist/esm/chunk-BJIOROQC.js.map +7 -0
  21. package/dist/{bin/puzzle-geometry-bin.js → esm/chunk-J2U2GRS4.js} +104 -1488
  22. package/dist/esm/chunk-J2U2GRS4.js.map +7 -0
  23. package/dist/esm/chunk-KCRFOAR4.js +122 -0
  24. package/dist/esm/chunk-KCRFOAR4.js.map +7 -0
  25. package/{src/cubing/search/inside/solve/puzzles/pyraminx.sgs.json.ts → dist/esm/chunk-NPK6Z4AU.js} +22 -17
  26. package/dist/esm/chunk-NPK6Z4AU.js.map +7 -0
  27. package/dist/esm/chunk-NV5ESXTN.js +505 -0
  28. package/dist/esm/chunk-NV5ESXTN.js.map +7 -0
  29. package/dist/esm/{chunk-DLN5QS4V.js → chunk-REMJV2GO.js} +38 -51
  30. package/dist/esm/chunk-REMJV2GO.js.map +7 -0
  31. package/dist/esm/chunk-TB4D4E2W.js +226 -0
  32. package/dist/esm/chunk-TB4D4E2W.js.map +7 -0
  33. package/dist/esm/chunk-TNRZDNGH.js +822 -0
  34. package/dist/esm/chunk-TNRZDNGH.js.map +7 -0
  35. package/{src/cubing/search/inside/solve/puzzles/megaminx.sgs.json.ts → dist/esm/chunk-YN7E5RGM.js} +36 -24
  36. package/dist/esm/chunk-YN7E5RGM.js.map +7 -0
  37. package/dist/esm/{chunk-HXKINJ7U.js → chunk-ZLIK3DZT.js} +79 -57
  38. package/dist/esm/chunk-ZLIK3DZT.js.map +7 -0
  39. package/dist/esm/{clock.kpuzzle.json-EKWRMHJM.js → clock.kpuzzle.json-J3YBOI3G.js} +7 -45
  40. package/dist/esm/clock.kpuzzle.json-J3YBOI3G.js.map +7 -0
  41. package/dist/esm/entry-PHAJAE4E.js +536 -0
  42. package/dist/esm/entry-PHAJAE4E.js.map +7 -0
  43. package/dist/esm/esm-test-worker.js +3 -14
  44. package/dist/esm/esm-test-worker.js.map +3 -3
  45. package/dist/esm/fto.sgs.json-VO6HST2V.js +641 -0
  46. package/dist/esm/fto.sgs.json-VO6HST2V.js.map +7 -0
  47. package/{src/cubing/search/inside/solve/vendor/min2phase/gwt.js → dist/esm/gwt-B7CBESZR.js} +350 -1380
  48. package/dist/esm/gwt-B7CBESZR.js.map +7 -0
  49. package/dist/esm/kpuzzle/index.js +5 -35
  50. package/dist/esm/megaminx.sgs.json-R3MK4HXM.js +16 -0
  51. package/dist/esm/megaminx.sgs.json-R3MK4HXM.js.map +7 -0
  52. package/dist/esm/module-entry-UYTOFYBC.js +18 -0
  53. package/dist/esm/module-entry-UYTOFYBC.js.map +7 -0
  54. package/dist/esm/{node-BSAQKO3G.js → node-SP4L2AKI.js} +2 -2
  55. package/dist/esm/{node-BSAQKO3G.js.map → node-SP4L2AKI.js.map} +1 -1
  56. package/dist/esm/{node-WEHVBEKP.js → node-W3AD4HBK.js} +3 -2
  57. package/dist/esm/node-W3AD4HBK.js.map +7 -0
  58. package/dist/esm/protocol/index.js +2 -1
  59. package/dist/esm/puzzle-geometry/index.js +15 -4053
  60. package/dist/esm/puzzle-geometry/index.js.map +3 -3
  61. package/dist/esm/puzzles/index.js +4 -4
  62. package/dist/esm/pyraminx.sgs.json-R3J3JHMV.js +14 -0
  63. package/dist/esm/pyraminx.sgs.json-R3J3JHMV.js.map +7 -0
  64. package/dist/esm/scramble/index.js +5 -3
  65. package/{src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.ts → dist/esm/scramble_444-F3YANDPO.js} +367 -586
  66. package/dist/esm/scramble_444-F3YANDPO.js.map +7 -0
  67. package/{src/cubing/search/inside/solve/vendor/sq12phase/scramble_sq1.js → dist/esm/scramble_sq1-PQ2AYBFW.js} +143 -290
  68. package/dist/esm/scramble_sq1-PQ2AYBFW.js.map +7 -0
  69. package/dist/esm/search/index.js +7 -4
  70. package/dist/esm/skewb.sgs.json-T6CO36WU.js +16 -0
  71. package/dist/esm/skewb.sgs.json-T6CO36WU.js.map +7 -0
  72. package/dist/esm/{sq1-hyperorbit.kpuzzle.json-N3FGCPML.js → sq1-hyperorbit.kpuzzle.json-AWDGN4ZW.js} +6 -6
  73. package/dist/esm/sq1-hyperorbit.kpuzzle.json-AWDGN4ZW.js.map +7 -0
  74. package/dist/esm/twisty/index.js +342 -231
  75. package/dist/esm/twisty/index.js.map +3 -3
  76. package/dist/esm/worker-inside-generated-string-6YDSDSRJ.js +3447 -0
  77. package/dist/esm/worker-inside-generated-string-6YDSDSRJ.js.map +7 -0
  78. package/dist/{esm → types}/.DS_Store +0 -0
  79. package/dist/types/alg/Alg.d.ts +0 -1
  80. package/dist/types/alg/Alg.spec.d.ts +0 -1
  81. package/dist/types/alg/AlgBuilder.d.ts +0 -1
  82. package/dist/types/alg/Serializable.d.ts +0 -1
  83. package/dist/types/alg/common.d.ts +0 -1
  84. package/dist/types/alg/debug.d.ts +0 -1
  85. package/dist/types/alg/example.d.ts +0 -1
  86. package/dist/types/alg/index.d.ts +0 -1
  87. package/dist/types/alg/is.d.ts +0 -1
  88. package/dist/types/alg/iteration.d.ts +0 -1
  89. package/dist/types/alg/keyboard.d.ts +0 -1
  90. package/dist/types/alg/limits.d.ts +0 -1
  91. package/dist/types/alg/operation.d.ts +0 -1
  92. package/dist/types/alg/operation.spec.d.ts +0 -1
  93. package/dist/types/alg/parse.d.ts +0 -1
  94. package/dist/types/alg/parse.spec.d.ts +0 -1
  95. package/dist/types/alg/test/alg-comparison.d.ts +0 -1
  96. package/dist/types/alg/test/alg.spec.d.ts +0 -1
  97. package/dist/types/alg/traversal.d.ts +0 -1
  98. package/dist/types/alg/units/QuantumWithAmount.d.ts +0 -1
  99. package/dist/types/alg/units/Unit.d.ts +0 -1
  100. package/dist/types/alg/units/containers/Commutator.d.ts +0 -1
  101. package/dist/types/alg/units/containers/Conjugate.d.ts +0 -1
  102. package/dist/types/alg/units/containers/Grouping.d.ts +0 -1
  103. package/dist/types/alg/units/index.d.ts +0 -1
  104. package/dist/types/alg/units/leaves/LineComment.d.ts +0 -1
  105. package/dist/types/alg/units/leaves/LineComment.spec.d.ts +0 -1
  106. package/dist/types/alg/units/leaves/Move.d.ts +0 -1
  107. package/dist/types/alg/units/leaves/Move.spec.d.ts +0 -1
  108. package/dist/types/alg/units/leaves/Newline.d.ts +0 -1
  109. package/dist/types/alg/units/leaves/Pause.d.ts +0 -1
  110. package/dist/types/alg/url.d.ts +0 -1
  111. package/dist/types/alg/url.spec.d.ts +0 -1
  112. package/dist/types/alg/validation.d.ts +0 -1
  113. package/dist/types/alg/warnOnce.d.ts +0 -1
  114. package/dist/types/bluetooth/connect/index.d.ts +0 -1
  115. package/dist/types/bluetooth/debug.d.ts +0 -1
  116. package/dist/types/bluetooth/index.d.ts +0 -1
  117. package/dist/types/bluetooth/keyboard.d.ts +5 -5
  118. package/dist/types/bluetooth/smart-puzzle/Heykube.d.ts +3 -3
  119. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts +3 -5
  120. package/dist/types/bluetooth/smart-puzzle/connect.d.ts +0 -1
  121. package/dist/types/bluetooth/smart-puzzle/endianness.d.ts +0 -1
  122. package/dist/types/bluetooth/smart-puzzle/gan.d.ts +5 -4
  123. package/dist/types/bluetooth/smart-puzzle/giiker.d.ts +3 -3
  124. package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts +0 -1
  125. package/dist/types/bluetooth/smart-puzzle/gocube.d.ts +0 -1
  126. package/dist/types/bluetooth/smart-robot/GanRobot.d.ts +0 -1
  127. package/dist/types/bluetooth/smart-robot/index.d.ts +0 -1
  128. package/dist/types/bluetooth/smart-timer/GanTimer.d.ts +0 -1
  129. package/dist/types/bluetooth/smart-timer/index.d.ts +0 -1
  130. package/dist/types/bluetooth/transformer.d.ts +0 -1
  131. package/dist/types/cubing.bundle-global.d.ts +0 -1
  132. package/{src/cubing/cubing.bundle-global.ts → dist/types/cubing.bundle-global.exports.d.ts} +12 -19
  133. package/dist/types/esm-test-worker.d.ts +0 -1
  134. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts +2 -3
  135. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts +0 -1
  136. package/dist/types/kpuzzle/3x3x3/puzzle-orientation.d.ts +4 -0
  137. package/dist/types/kpuzzle/KPuzzle.d.ts +25 -0
  138. package/dist/types/kpuzzle/KPuzzleDefinition.d.ts +20 -0
  139. package/dist/types/kpuzzle/KState.d.ts +16 -0
  140. package/dist/types/kpuzzle/KTransformation.d.ts +20 -0
  141. package/dist/types/kpuzzle/calculate.d.ts +16 -0
  142. package/dist/types/kpuzzle/combine.d.ts +3 -0
  143. package/dist/types/kpuzzle/construct.d.ts +5 -0
  144. package/dist/types/kpuzzle/index.d.ts +6 -10
  145. package/dist/types/notation/CountAnimatedLeaves.d.ts +0 -1
  146. package/dist/types/notation/CountMoves.d.ts +0 -1
  147. package/dist/types/notation/index.d.ts +0 -1
  148. package/dist/types/protocol/binary/binary3x3x3.d.ts +5 -6
  149. package/dist/types/protocol/binary/binary3x3x3.spec.d.ts +0 -1
  150. package/dist/types/protocol/binary/hex.d.ts +0 -1
  151. package/dist/types/protocol/binary/hex.spec.d.ts +0 -1
  152. package/dist/types/protocol/binary/orbit-indexing.d.ts +0 -1
  153. package/dist/types/protocol/binary/orbit-indexing.spec.d.ts +0 -1
  154. package/dist/types/protocol/binary/puzzle-orientation.d.ts +4 -5
  155. package/dist/types/protocol/index.d.ts +0 -1
  156. package/dist/types/puzzle-geometry/FaceNameSwizzler.d.ts +0 -1
  157. package/dist/types/puzzle-geometry/Options.d.ts +0 -1
  158. package/dist/types/puzzle-geometry/PGPuzzles.d.ts +0 -1
  159. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +0 -1
  160. package/dist/types/puzzle-geometry/Perm.d.ts +0 -1
  161. package/dist/types/puzzle-geometry/PermOriSet.d.ts +4 -5
  162. package/dist/types/puzzle-geometry/PlatonicGenerator.d.ts +0 -1
  163. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +11 -5
  164. package/dist/types/puzzle-geometry/Quat.d.ts +0 -1
  165. package/dist/types/puzzle-geometry/Quat.spec.d.ts +0 -1
  166. package/dist/types/puzzle-geometry/SchreierSims.d.ts +0 -1
  167. package/dist/types/puzzle-geometry/index.d.ts +2 -2
  168. package/dist/types/puzzle-geometry/notation-mapping/FTONotationMapper.d.ts +0 -1
  169. package/dist/types/puzzle-geometry/notation-mapping/FaceRenamingMapper.d.ts +0 -1
  170. package/dist/types/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.d.ts +0 -1
  171. package/dist/types/puzzle-geometry/notation-mapping/NotationMapper.d.ts +3 -2
  172. package/dist/types/puzzle-geometry/notation-mapping/NullMapper.d.ts +0 -1
  173. package/dist/types/puzzle-geometry/notation-mapping/NxNxNCubeMapper.d.ts +0 -1
  174. package/dist/types/puzzle-geometry/notation-mapping/PyraminxNotationMapper.d.ts +0 -1
  175. package/dist/types/puzzle-geometry/notation-mapping/SkewbNotationMapper.d.ts +0 -1
  176. package/dist/types/puzzle-geometry/notation-mapping/index.d.ts +0 -1
  177. package/dist/types/puzzle-geometry/orientcenters.spec.d.ts +0 -1
  178. package/dist/types/puzzles/PuzzleLoader.d.ts +3 -3
  179. package/dist/types/puzzles/async/async-pg3d.d.ts +3 -3
  180. package/dist/types/puzzles/async/lazy-cached-kpuzzle.d.ts +2 -0
  181. package/dist/types/puzzles/customPGPuzzleLoader.d.ts +2 -3
  182. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.d.ts +1 -2
  183. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.svg.d.ts +0 -1
  184. package/dist/types/puzzles/implementations/2x2x2/index.d.ts +0 -1
  185. package/dist/types/puzzles/implementations/3x3x3/3x3x3-ll.kpuzzle.svg.d.ts +0 -1
  186. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.svg.d.ts +0 -1
  187. package/dist/types/puzzles/implementations/3x3x3/index.d.ts +0 -1
  188. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json.d.ts +1 -2
  189. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.svg.d.ts +0 -1
  190. package/dist/types/puzzles/implementations/clock/index.d.ts +0 -1
  191. package/dist/types/puzzles/implementations/fto/index.d.ts +0 -1
  192. package/dist/types/puzzles/implementations/megaminx/index.d.ts +0 -1
  193. package/dist/types/puzzles/implementations/pyraminx/index.d.ts +0 -1
  194. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.d.ts +0 -1
  195. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.svg.d.ts +0 -1
  196. package/dist/types/puzzles/implementations/square1/index.d.ts +0 -1
  197. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.d.ts +1 -2
  198. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.svg.d.ts +0 -1
  199. package/dist/types/puzzles/index.d.ts +1 -2
  200. package/dist/types/puzzles/stickerings/appearance.d.ts +6 -7
  201. package/dist/types/puzzles/stickerings/cube-stickerings.d.ts +0 -1
  202. package/dist/types/puzzles/stickerings/fto-stickerings.d.ts +0 -1
  203. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts +0 -1
  204. package/dist/types/puzzles/stickerings/megaminx-stickerings.d.ts +0 -1
  205. package/dist/types/scramble/index.d.ts +0 -1
  206. package/dist/types/search/esm-test-worker.d.ts +0 -1
  207. package/dist/types/search/index.d.ts +0 -1
  208. package/dist/types/search/inside/api.d.ts +6 -7
  209. package/dist/types/search/inside/api.spec.d.ts +0 -1
  210. package/dist/types/search/inside/entry.d.ts +0 -1
  211. package/dist/types/search/inside/inside-worker.d.ts +0 -1
  212. package/dist/types/search/inside/module-entry-path-getter.d.ts +1 -0
  213. package/dist/types/search/inside/module-entry.d.ts +1 -0
  214. package/dist/types/search/inside/solve/addOrientationSuffix.d.ts +0 -1
  215. package/dist/types/search/inside/solve/parseSGS.d.ts +3 -4
  216. package/dist/types/search/inside/solve/puzzles/2x2x2.d.ts +3 -4
  217. package/dist/types/search/inside/solve/puzzles/2x2x2.sgs.json.d.ts +0 -1
  218. package/dist/types/search/inside/solve/puzzles/3x3x3/convert.d.ts +2 -3
  219. package/dist/types/search/inside/solve/puzzles/3x3x3/filter.d.ts +4 -4
  220. package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts +3 -4
  221. package/dist/types/search/inside/solve/puzzles/3x3x3/legacy-sgs.d.ts +0 -1
  222. package/dist/types/search/inside/solve/puzzles/3x3x3-inefficient.sgs.json.d.ts +0 -1
  223. package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts +2 -2
  224. package/dist/types/search/inside/solve/puzzles/5x5x5.d.ts +0 -1
  225. package/dist/types/search/inside/solve/puzzles/big-cubes.d.ts +0 -1
  226. package/dist/types/search/inside/solve/puzzles/clock.d.ts +0 -1
  227. package/dist/types/search/inside/solve/puzzles/fto.d.ts +5 -0
  228. package/dist/types/search/inside/solve/puzzles/fto.sgs.json.d.ts +2 -0
  229. package/dist/types/search/inside/solve/puzzles/megaminx.d.ts +2 -3
  230. package/dist/types/search/inside/solve/puzzles/megaminx.sgs.json.d.ts +2 -3
  231. package/dist/types/search/inside/solve/puzzles/pyraminx.d.ts +3 -4
  232. package/dist/types/search/inside/solve/puzzles/pyraminx.sgs.json.d.ts +0 -1
  233. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts +0 -1
  234. package/dist/types/search/inside/solve/puzzles/skewb.d.ts +3 -4
  235. package/dist/types/search/inside/solve/puzzles/skewb.sgs.json.d.ts +2 -3
  236. package/dist/types/search/inside/solve/puzzles/sq1.d.ts +0 -1
  237. package/dist/types/search/inside/solve/puzzles/wca-minx.d.ts +0 -1
  238. package/dist/types/search/inside/solve/tremble.d.ts +6 -6
  239. package/dist/types/search/instantiator.d.ts +1 -3
  240. package/dist/types/search/outside.d.ts +6 -7
  241. package/dist/types/search/worker-inside-generated-string.d.ts +1 -2
  242. package/dist/types/stream/index.d.ts +0 -1
  243. package/dist/types/stream/process/ReorientedStream.d.ts +1 -3
  244. package/dist/types/stream/proxy-event.d.ts +0 -1
  245. package/dist/types/stream/twizzle/TwizzleStream.d.ts +0 -1
  246. package/dist/types/stream/twizzle/stream-types.d.ts +0 -1
  247. package/dist/types/stream/websocket-proxy.d.ts +0 -1
  248. package/dist/types/twisty/controllers/AnimationTypes.d.ts +2 -3
  249. package/dist/types/twisty/controllers/RenderScheduler.d.ts +0 -1
  250. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +0 -1
  251. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts +0 -1
  252. package/dist/types/twisty/controllers/easing.d.ts +0 -1
  253. package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts +0 -1
  254. package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts +6 -6
  255. package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts +7 -7
  256. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +8 -8
  257. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +9 -9
  258. package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts +0 -1
  259. package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts +36 -37
  260. package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts +7 -7
  261. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts +0 -1
  262. package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts +0 -1
  263. package/dist/types/twisty/heavy-code-imports/3d.d.ts +0 -1
  264. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +0 -1
  265. package/dist/types/twisty/index.d.ts +1 -2
  266. package/dist/types/twisty/model/PromiseFreshener.d.ts +0 -1
  267. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +6 -7
  268. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts +0 -1
  269. package/dist/types/twisty/model/helpers.d.ts +0 -1
  270. package/dist/types/twisty/model/props/TwistyProp.d.ts +0 -1
  271. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts +0 -1
  272. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +0 -1
  273. package/dist/types/twisty/model/props/general/URLProp.d.ts +0 -1
  274. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts +0 -1
  275. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +0 -1
  276. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts +0 -1
  277. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +2 -1
  278. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts +0 -1
  279. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +5 -8
  280. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +5 -7
  281. package/dist/types/twisty/model/props/puzzle/state/CatchUpMoveProp.d.ts +0 -1
  282. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +0 -1
  283. package/dist/types/twisty/model/props/puzzle/state/{CurrentLeavesProp.d.ts → CurrentMoveInfoProp.d.ts} +2 -3
  284. package/dist/types/twisty/model/props/puzzle/state/CurrentStateProp.d.ts +14 -0
  285. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +7 -8
  286. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts +0 -1
  287. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +5 -6
  288. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +2 -3
  289. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts +6 -2
  290. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts +0 -1
  291. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +4 -5
  292. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +0 -1
  293. package/dist/types/twisty/model/props/puzzle/structure/KPuzzleProp.d.ts +10 -0
  294. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts +0 -1
  295. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +0 -1
  296. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +0 -1
  297. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +0 -1
  298. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts +0 -1
  299. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +0 -1
  300. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +0 -1
  301. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts +0 -1
  302. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +0 -1
  303. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +0 -1
  304. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +0 -1
  305. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts +0 -1
  306. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +0 -1
  307. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts +0 -1
  308. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +0 -1
  309. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +0 -1
  310. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +2 -3
  311. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +0 -1
  312. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +0 -1
  313. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +0 -1
  314. package/dist/types/twisty/views/2D/KPuzzleSVGWrapper.d.ts +17 -0
  315. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts +0 -1
  316. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +4 -4
  317. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +0 -1
  318. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +0 -1
  319. package/dist/types/twisty/views/3D/DragTracker.d.ts +0 -1
  320. package/dist/types/twisty/views/3D/RendererPool.d.ts +0 -1
  321. package/dist/types/twisty/views/3D/TAU.d.ts +0 -1
  322. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +0 -1
  323. package/dist/types/twisty/views/3D/Twisty3DRenderTarget.d.ts +0 -1
  324. package/dist/types/twisty/views/3D/Twisty3DScene.d.ts +0 -1
  325. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +0 -1
  326. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts +0 -1
  327. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +0 -1
  328. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts +0 -1
  329. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts +0 -1
  330. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts +4 -5
  331. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +5 -6
  332. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts +0 -1
  333. package/dist/types/twisty/views/ClassListManager.d.ts +0 -1
  334. package/dist/types/twisty/views/ManagedCustomElement.d.ts +0 -1
  335. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +0 -1
  336. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +0 -1
  337. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +0 -1
  338. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts +0 -1
  339. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts +0 -1
  340. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +0 -1
  341. package/dist/types/twisty/views/TwistyAlgViewer.d.ts +0 -1
  342. package/dist/types/twisty/views/TwistyPlayer.css.d.ts +0 -1
  343. package/dist/types/twisty/views/TwistyPlayer.d.ts +0 -1
  344. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +0 -1
  345. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts +0 -1
  346. package/dist/types/twisty/views/canvas.d.ts +0 -1
  347. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts +0 -1
  348. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +0 -1
  349. package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts +0 -1
  350. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +0 -1
  351. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts +0 -1
  352. package/dist/types/twisty/views/document.d.ts +0 -1
  353. package/dist/types/twisty/views/node-custom-element-shims.d.ts +0 -1
  354. package/dist/types/twisty/views/screenshot.d.ts +0 -1
  355. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts +0 -1
  356. package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts +0 -1
  357. package/{src/cubing/search → dist/types}/vendor/comlink-everywhere/inside/index.d.ts +0 -0
  358. package/dist/types/{search/vendor → vendor}/comlink-everywhere/inside/node.d.ts +0 -1
  359. package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/index.d.ts +0 -1
  360. package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/node.d.ts +0 -1
  361. package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/lib/mathlib.d.ts +0 -1
  362. package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/scramble/scramble_444.d.ts +1 -2
  363. package/dist/types/{search/inside/solve/vendor → vendor}/min2phase/gwt.d.ts +0 -1
  364. package/dist/types/vendor/p-lazy/p-lazy.d.ts +0 -1
  365. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/get-random-values.d.ts +0 -1
  366. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/index.d.ts +1 -2
  367. package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/random-choice.d.ts +0 -1
  368. package/dist/types/{search/inside/solve/vendor/random-uint-below/random-int.d.ts → vendor/random-uint-below/random53BitValue.d.ts} +0 -1
  369. package/dist/types/{search/inside/solve/vendor → vendor}/sq12phase/scramble_sq1.d.ts +0 -1
  370. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts +0 -1
  371. package/dist/types/{bluetooth/smart-puzzle → vendor/unsafe-raw-aes}/unsafe-raw-aes.d.ts +0 -1
  372. package/kpuzzle/package.json +1 -3
  373. package/notation/package.json +1 -3
  374. package/package.json +11 -17
  375. package/protocol/package.json +1 -3
  376. package/puzzle-geometry/package.json +1 -3
  377. package/puzzles/package.json +1 -3
  378. package/scramble/package.json +1 -3
  379. package/search/package.json +1 -3
  380. package/stream/package.json +1 -3
  381. package/twisty/package.json +1 -3
  382. package/alg/index.d.ts +0 -1
  383. package/bluetooth/index.d.ts +0 -1
  384. package/dist/.DS_Store +0 -0
  385. package/dist/bin/puzzle-geometry-bin.js.map +0 -7
  386. package/dist/bundle-global/cubing.bundle-global.js +0 -7419
  387. package/dist/esm/2x2x2.kpuzzle.json-JOGUSQ4N.js.map +0 -7
  388. package/dist/esm/chunk-7KI3I3Y7.js +0 -1379
  389. package/dist/esm/chunk-7KI3I3Y7.js.map +0 -7
  390. package/dist/esm/chunk-DLN5QS4V.js.map +0 -7
  391. package/dist/esm/chunk-HXKINJ7U.js.map +0 -7
  392. package/dist/esm/chunk-X6JHXPDX.js +0 -2359
  393. package/dist/esm/chunk-X6JHXPDX.js.map +0 -7
  394. package/dist/esm/clock.kpuzzle.json-EKWRMHJM.js.map +0 -7
  395. package/dist/esm/index.d.ts +0 -1
  396. package/dist/esm/node-WEHVBEKP.js.map +0 -7
  397. package/dist/esm/sq1-hyperorbit.kpuzzle.json-N3FGCPML.js.map +0 -7
  398. package/dist/esm/worker-inside-generated-string-ZA6E6672.js +0 -2831
  399. package/dist/esm/worker-inside-generated-string-ZA6E6672.js.map +0 -7
  400. package/dist/types/alg/Alg.d.ts.map +0 -1
  401. package/dist/types/alg/Alg.spec.d.ts.map +0 -1
  402. package/dist/types/alg/AlgBuilder.d.ts.map +0 -1
  403. package/dist/types/alg/Serializable.d.ts.map +0 -1
  404. package/dist/types/alg/common.d.ts.map +0 -1
  405. package/dist/types/alg/debug.d.ts.map +0 -1
  406. package/dist/types/alg/example.d.ts.map +0 -1
  407. package/dist/types/alg/index.d.ts.map +0 -1
  408. package/dist/types/alg/is.d.ts.map +0 -1
  409. package/dist/types/alg/iteration.d.ts.map +0 -1
  410. package/dist/types/alg/keyboard.d.ts.map +0 -1
  411. package/dist/types/alg/limits.d.ts.map +0 -1
  412. package/dist/types/alg/operation.d.ts.map +0 -1
  413. package/dist/types/alg/operation.spec.d.ts.map +0 -1
  414. package/dist/types/alg/parse.d.ts.map +0 -1
  415. package/dist/types/alg/parse.spec.d.ts.map +0 -1
  416. package/dist/types/alg/test/alg-comparison.d.ts.map +0 -1
  417. package/dist/types/alg/test/alg.spec.d.ts.map +0 -1
  418. package/dist/types/alg/traversal.d.ts.map +0 -1
  419. package/dist/types/alg/units/QuantumWithAmount.d.ts.map +0 -1
  420. package/dist/types/alg/units/Unit.d.ts.map +0 -1
  421. package/dist/types/alg/units/containers/Commutator.d.ts.map +0 -1
  422. package/dist/types/alg/units/containers/Conjugate.d.ts.map +0 -1
  423. package/dist/types/alg/units/containers/Grouping.d.ts.map +0 -1
  424. package/dist/types/alg/units/index.d.ts.map +0 -1
  425. package/dist/types/alg/units/leaves/LineComment.d.ts.map +0 -1
  426. package/dist/types/alg/units/leaves/LineComment.spec.d.ts.map +0 -1
  427. package/dist/types/alg/units/leaves/Move.d.ts.map +0 -1
  428. package/dist/types/alg/units/leaves/Move.spec.d.ts.map +0 -1
  429. package/dist/types/alg/units/leaves/Newline.d.ts.map +0 -1
  430. package/dist/types/alg/units/leaves/Pause.d.ts.map +0 -1
  431. package/dist/types/alg/url.d.ts.map +0 -1
  432. package/dist/types/alg/url.spec.d.ts.map +0 -1
  433. package/dist/types/alg/validation.d.ts.map +0 -1
  434. package/dist/types/alg/warnOnce.d.ts.map +0 -1
  435. package/dist/types/bluetooth/connect/index.d.ts.map +0 -1
  436. package/dist/types/bluetooth/debug.d.ts.map +0 -1
  437. package/dist/types/bluetooth/index.d.ts.map +0 -1
  438. package/dist/types/bluetooth/keyboard.d.ts.map +0 -1
  439. package/dist/types/bluetooth/smart-puzzle/Heykube.d.ts.map +0 -1
  440. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts.map +0 -1
  441. package/dist/types/bluetooth/smart-puzzle/connect.d.ts.map +0 -1
  442. package/dist/types/bluetooth/smart-puzzle/endianness.d.ts.map +0 -1
  443. package/dist/types/bluetooth/smart-puzzle/gan.d.ts.map +0 -1
  444. package/dist/types/bluetooth/smart-puzzle/giiker.d.ts.map +0 -1
  445. package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts.map +0 -1
  446. package/dist/types/bluetooth/smart-puzzle/gocube.d.ts.map +0 -1
  447. package/dist/types/bluetooth/smart-puzzle/unsafe-raw-aes.d.ts.map +0 -1
  448. package/dist/types/bluetooth/smart-robot/GanRobot.d.ts.map +0 -1
  449. package/dist/types/bluetooth/smart-robot/index.d.ts.map +0 -1
  450. package/dist/types/bluetooth/smart-timer/GanTimer.d.ts.map +0 -1
  451. package/dist/types/bluetooth/smart-timer/index.d.ts.map +0 -1
  452. package/dist/types/bluetooth/transformer.d.ts.map +0 -1
  453. package/dist/types/cubing.bundle-global.d.ts.map +0 -1
  454. package/dist/types/esm-test-worker.d.ts.map +0 -1
  455. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts.map +0 -1
  456. package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts.map +0 -1
  457. package/dist/types/kpuzzle/canon.spec.d.ts +0 -2
  458. package/dist/types/kpuzzle/canon.spec.d.ts.map +0 -1
  459. package/dist/types/kpuzzle/canonicalize.d.ts +0 -55
  460. package/dist/types/kpuzzle/canonicalize.d.ts.map +0 -1
  461. package/dist/types/kpuzzle/definition_types.d.ts +0 -19
  462. package/dist/types/kpuzzle/definition_types.d.ts.map +0 -1
  463. package/dist/types/kpuzzle/index.d.ts.map +0 -1
  464. package/dist/types/kpuzzle/kpuzzle.d.ts +0 -17
  465. package/dist/types/kpuzzle/kpuzzle.d.ts.map +0 -1
  466. package/dist/types/kpuzzle/kpuzzle.spec.d.ts +0 -2
  467. package/dist/types/kpuzzle/kpuzzle.spec.d.ts.map +0 -1
  468. package/dist/types/kpuzzle/move_notation.d.ts +0 -6
  469. package/dist/types/kpuzzle/move_notation.d.ts.map +0 -1
  470. package/dist/types/kpuzzle/parser/index.d.ts +0 -2
  471. package/dist/types/kpuzzle/parser/index.d.ts.map +0 -1
  472. package/dist/types/kpuzzle/parser/parser-peggy.d.ts +0 -15
  473. package/dist/types/kpuzzle/parser/parser-peggy.d.ts.map +0 -1
  474. package/dist/types/kpuzzle/parser/parser-shim.d.ts +0 -4
  475. package/dist/types/kpuzzle/parser/parser-shim.d.ts.map +0 -1
  476. package/dist/types/kpuzzle/parser/parser.d.ts +0 -1
  477. package/dist/types/kpuzzle/parser/parser.d.ts.map +0 -1
  478. package/dist/types/kpuzzle/prunetable.spec.d.ts +0 -2
  479. package/dist/types/kpuzzle/prunetable.spec.d.ts.map +0 -1
  480. package/dist/types/kpuzzle/pruningtable.d.ts +0 -16
  481. package/dist/types/kpuzzle/pruningtable.d.ts.map +0 -1
  482. package/dist/types/kpuzzle/puzzle-orientation.d.ts +0 -5
  483. package/dist/types/kpuzzle/puzzle-orientation.d.ts.map +0 -1
  484. package/dist/types/kpuzzle/svg.d.ts +0 -18
  485. package/dist/types/kpuzzle/svg.d.ts.map +0 -1
  486. package/dist/types/kpuzzle/transformations.d.ts +0 -13
  487. package/dist/types/kpuzzle/transformations.d.ts.map +0 -1
  488. package/dist/types/kpuzzle/transformations.spec.d.ts +0 -2
  489. package/dist/types/kpuzzle/transformations.spec.d.ts.map +0 -1
  490. package/dist/types/notation/CountAnimatedLeaves.d.ts.map +0 -1
  491. package/dist/types/notation/CountMoves.d.ts.map +0 -1
  492. package/dist/types/notation/index.d.ts.map +0 -1
  493. package/dist/types/protocol/binary/binary3x3x3.d.ts.map +0 -1
  494. package/dist/types/protocol/binary/binary3x3x3.spec.d.ts.map +0 -1
  495. package/dist/types/protocol/binary/hex.d.ts.map +0 -1
  496. package/dist/types/protocol/binary/hex.spec.d.ts.map +0 -1
  497. package/dist/types/protocol/binary/orbit-indexing.d.ts.map +0 -1
  498. package/dist/types/protocol/binary/orbit-indexing.spec.d.ts.map +0 -1
  499. package/dist/types/protocol/binary/puzzle-orientation.d.ts.map +0 -1
  500. package/dist/types/protocol/index.d.ts.map +0 -1
  501. package/dist/types/puzzle-geometry/FaceNameSwizzler.d.ts.map +0 -1
  502. package/dist/types/puzzle-geometry/Options.d.ts.map +0 -1
  503. package/dist/types/puzzle-geometry/PGPuzzles.d.ts.map +0 -1
  504. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +0 -1
  505. package/dist/types/puzzle-geometry/Perm.d.ts.map +0 -1
  506. package/dist/types/puzzle-geometry/PermOriSet.d.ts.map +0 -1
  507. package/dist/types/puzzle-geometry/PlatonicGenerator.d.ts.map +0 -1
  508. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +0 -1
  509. package/dist/types/puzzle-geometry/Quat.d.ts.map +0 -1
  510. package/dist/types/puzzle-geometry/Quat.spec.d.ts.map +0 -1
  511. package/dist/types/puzzle-geometry/SchreierSims.d.ts.map +0 -1
  512. package/dist/types/puzzle-geometry/index.d.ts.map +0 -1
  513. package/dist/types/puzzle-geometry/interfaces.d.ts +0 -6
  514. package/dist/types/puzzle-geometry/interfaces.d.ts.map +0 -1
  515. package/dist/types/puzzle-geometry/notation-mapping/FTONotationMapper.d.ts.map +0 -1
  516. package/dist/types/puzzle-geometry/notation-mapping/FaceRenamingMapper.d.ts.map +0 -1
  517. package/dist/types/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.d.ts.map +0 -1
  518. package/dist/types/puzzle-geometry/notation-mapping/NotationMapper.d.ts.map +0 -1
  519. package/dist/types/puzzle-geometry/notation-mapping/NullMapper.d.ts.map +0 -1
  520. package/dist/types/puzzle-geometry/notation-mapping/NxNxNCubeMapper.d.ts.map +0 -1
  521. package/dist/types/puzzle-geometry/notation-mapping/PyraminxNotationMapper.d.ts.map +0 -1
  522. package/dist/types/puzzle-geometry/notation-mapping/SkewbNotationMapper.d.ts.map +0 -1
  523. package/dist/types/puzzle-geometry/notation-mapping/index.d.ts.map +0 -1
  524. package/dist/types/puzzle-geometry/orientcenters.spec.d.ts.map +0 -1
  525. package/dist/types/puzzles/PuzzleLoader.d.ts.map +0 -1
  526. package/dist/types/puzzles/async/async-pg3d.d.ts.map +0 -1
  527. package/dist/types/puzzles/customPGPuzzleLoader.d.ts.map +0 -1
  528. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.d.ts.map +0 -1
  529. package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.svg.d.ts.map +0 -1
  530. package/dist/types/puzzles/implementations/2x2x2/index.d.ts.map +0 -1
  531. package/dist/types/puzzles/implementations/3x3x3/3x3x3-ll.kpuzzle.svg.d.ts.map +0 -1
  532. package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.svg.d.ts.map +0 -1
  533. package/dist/types/puzzles/implementations/3x3x3/index.d.ts.map +0 -1
  534. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json.d.ts.map +0 -1
  535. package/dist/types/puzzles/implementations/clock/clock.kpuzzle.svg.d.ts.map +0 -1
  536. package/dist/types/puzzles/implementations/clock/index.d.ts.map +0 -1
  537. package/dist/types/puzzles/implementations/fto/index.d.ts.map +0 -1
  538. package/dist/types/puzzles/implementations/megaminx/index.d.ts.map +0 -1
  539. package/dist/types/puzzles/implementations/pyraminx/index.d.ts.map +0 -1
  540. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.d.ts.map +0 -1
  541. package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.svg.d.ts.map +0 -1
  542. package/dist/types/puzzles/implementations/square1/index.d.ts.map +0 -1
  543. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.d.ts.map +0 -1
  544. package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.svg.d.ts.map +0 -1
  545. package/dist/types/puzzles/index.d.ts.map +0 -1
  546. package/dist/types/puzzles/stickerings/appearance.d.ts.map +0 -1
  547. package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +0 -1
  548. package/dist/types/puzzles/stickerings/fto-stickerings.d.ts.map +0 -1
  549. package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts.map +0 -1
  550. package/dist/types/puzzles/stickerings/megaminx-stickerings.d.ts.map +0 -1
  551. package/dist/types/scramble/index.d.ts.map +0 -1
  552. package/dist/types/search/esm-test-worker.d.ts.map +0 -1
  553. package/dist/types/search/index.d.ts.map +0 -1
  554. package/dist/types/search/inside/api.d.ts.map +0 -1
  555. package/dist/types/search/inside/api.spec.d.ts.map +0 -1
  556. package/dist/types/search/inside/entry.d.ts.map +0 -1
  557. package/dist/types/search/inside/inside-worker.d.ts.map +0 -1
  558. package/dist/types/search/inside/solve/addOrientationSuffix.d.ts.map +0 -1
  559. package/dist/types/search/inside/solve/parseSGS.d.ts.map +0 -1
  560. package/dist/types/search/inside/solve/puzzles/2x2x2.d.ts.map +0 -1
  561. package/dist/types/search/inside/solve/puzzles/2x2x2.sgs.json.d.ts.map +0 -1
  562. package/dist/types/search/inside/solve/puzzles/3x3x3/convert.d.ts.map +0 -1
  563. package/dist/types/search/inside/solve/puzzles/3x3x3/filter.d.ts.map +0 -1
  564. package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts.map +0 -1
  565. package/dist/types/search/inside/solve/puzzles/3x3x3/legacy-sgs.d.ts.map +0 -1
  566. package/dist/types/search/inside/solve/puzzles/3x3x3-inefficient.sgs.json.d.ts.map +0 -1
  567. package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts.map +0 -1
  568. package/dist/types/search/inside/solve/puzzles/5x5x5.d.ts.map +0 -1
  569. package/dist/types/search/inside/solve/puzzles/big-cubes.d.ts.map +0 -1
  570. package/dist/types/search/inside/solve/puzzles/clock.d.ts.map +0 -1
  571. package/dist/types/search/inside/solve/puzzles/megaminx.d.ts.map +0 -1
  572. package/dist/types/search/inside/solve/puzzles/megaminx.sgs.json.d.ts.map +0 -1
  573. package/dist/types/search/inside/solve/puzzles/pyraminx.d.ts.map +0 -1
  574. package/dist/types/search/inside/solve/puzzles/pyraminx.sgs.json.d.ts.map +0 -1
  575. package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts.map +0 -1
  576. package/dist/types/search/inside/solve/puzzles/skewb.d.ts.map +0 -1
  577. package/dist/types/search/inside/solve/puzzles/skewb.sgs.json.d.ts.map +0 -1
  578. package/dist/types/search/inside/solve/puzzles/sq1.d.ts.map +0 -1
  579. package/dist/types/search/inside/solve/puzzles/wca-minx.d.ts.map +0 -1
  580. package/dist/types/search/inside/solve/tremble.d.ts.map +0 -1
  581. package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +0 -1
  582. package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +0 -1
  583. package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +0 -1
  584. package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +0 -1
  585. package/dist/types/search/inside/solve/vendor/random-uint-below/index.d.ts.map +0 -1
  586. package/dist/types/search/inside/solve/vendor/random-uint-below/random-choice.d.ts.map +0 -1
  587. package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +0 -1
  588. package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +0 -1
  589. package/dist/types/search/instantiator.d.ts.map +0 -1
  590. package/dist/types/search/outside.d.ts.map +0 -1
  591. package/dist/types/search/vendor/comlink-everywhere/inside/index.d.ts +0 -2
  592. package/dist/types/search/vendor/comlink-everywhere/inside/index.d.ts.map +0 -1
  593. package/dist/types/search/vendor/comlink-everywhere/inside/node.d.ts.map +0 -1
  594. package/dist/types/search/vendor/comlink-everywhere/outside/index.d.ts.map +0 -1
  595. package/dist/types/search/vendor/comlink-everywhere/outside/node.d.ts.map +0 -1
  596. package/dist/types/search/worker-inside-generated-string.d.ts.map +0 -1
  597. package/dist/types/stream/index.d.ts.map +0 -1
  598. package/dist/types/stream/process/ReorientedStream.d.ts.map +0 -1
  599. package/dist/types/stream/proxy-event.d.ts.map +0 -1
  600. package/dist/types/stream/twizzle/TwizzleStream.d.ts.map +0 -1
  601. package/dist/types/stream/twizzle/stream-types.d.ts.map +0 -1
  602. package/dist/types/stream/websocket-proxy.d.ts.map +0 -1
  603. package/dist/types/twisty/controllers/AnimationTypes.d.ts.map +0 -1
  604. package/dist/types/twisty/controllers/RenderScheduler.d.ts.map +0 -1
  605. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +0 -1
  606. package/dist/types/twisty/controllers/TwistyPlayerController.d.ts.map +0 -1
  607. package/dist/types/twisty/controllers/easing.d.ts.map +0 -1
  608. package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts.map +0 -1
  609. package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts.map +0 -1
  610. package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  611. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  612. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +0 -1
  613. package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  614. package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts.map +0 -1
  615. package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  616. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts.map +0 -1
  617. package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  618. package/dist/types/twisty/heavy-code-imports/3d.d.ts.map +0 -1
  619. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +0 -1
  620. package/dist/types/twisty/index.d.ts.map +0 -1
  621. package/dist/types/twisty/model/PromiseFreshener.d.ts.map +0 -1
  622. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +0 -1
  623. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts.map +0 -1
  624. package/dist/types/twisty/model/helpers.d.ts.map +0 -1
  625. package/dist/types/twisty/model/props/TwistyProp.d.ts.map +0 -1
  626. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts.map +0 -1
  627. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +0 -1
  628. package/dist/types/twisty/model/props/general/URLProp.d.ts.map +0 -1
  629. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts.map +0 -1
  630. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +0 -1
  631. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts.map +0 -1
  632. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +0 -1
  633. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts.map +0 -1
  634. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts.map +0 -1
  635. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +0 -1
  636. package/dist/types/twisty/model/props/puzzle/state/CatchUpMoveProp.d.ts.map +0 -1
  637. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +0 -1
  638. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +0 -1
  639. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +0 -15
  640. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +0 -1
  641. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +0 -1
  642. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts.map +0 -1
  643. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +0 -1
  644. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +0 -1
  645. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts.map +0 -1
  646. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts.map +0 -1
  647. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts.map +0 -1
  648. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +0 -1
  649. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts +0 -11
  650. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts.map +0 -1
  651. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts.map +0 -1
  652. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +0 -1
  653. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +0 -1
  654. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +0 -1
  655. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts.map +0 -1
  656. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +0 -1
  657. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +0 -1
  658. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts.map +0 -1
  659. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +0 -1
  660. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +0 -1
  661. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +0 -1
  662. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts.map +0 -1
  663. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +0 -1
  664. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts.map +0 -1
  665. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +0 -1
  666. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +0 -1
  667. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +0 -1
  668. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +0 -1
  669. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +0 -1
  670. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +0 -1
  671. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts.map +0 -1
  672. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +0 -1
  673. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +0 -1
  674. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +0 -1
  675. package/dist/types/twisty/views/3D/DragTracker.d.ts.map +0 -1
  676. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +0 -1
  677. package/dist/types/twisty/views/3D/TAU.d.ts.map +0 -1
  678. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +0 -1
  679. package/dist/types/twisty/views/3D/Twisty3DRenderTarget.d.ts.map +0 -1
  680. package/dist/types/twisty/views/3D/Twisty3DScene.d.ts.map +0 -1
  681. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +0 -1
  682. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts.map +0 -1
  683. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +0 -1
  684. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts.map +0 -1
  685. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts.map +0 -1
  686. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +0 -1
  687. package/dist/types/twisty/views/3D/puzzles/KPuzzleWrapper.d.ts +0 -48
  688. package/dist/types/twisty/views/3D/puzzles/KPuzzleWrapper.d.ts.map +0 -1
  689. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +0 -1
  690. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +0 -1
  691. package/dist/types/twisty/views/ClassListManager.d.ts.map +0 -1
  692. package/dist/types/twisty/views/ManagedCustomElement.d.ts.map +0 -1
  693. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +0 -1
  694. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +0 -1
  695. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +0 -1
  696. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts.map +0 -1
  697. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts.map +0 -1
  698. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +0 -1
  699. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +0 -1
  700. package/dist/types/twisty/views/TwistyPlayer.css.d.ts.map +0 -1
  701. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +0 -1
  702. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +0 -1
  703. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts.map +0 -1
  704. package/dist/types/twisty/views/canvas.d.ts.map +0 -1
  705. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts.map +0 -1
  706. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +0 -1
  707. package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts.map +0 -1
  708. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +0 -1
  709. package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts.map +0 -1
  710. package/dist/types/twisty/views/document.d.ts.map +0 -1
  711. package/dist/types/twisty/views/node-custom-element-shims.d.ts.map +0 -1
  712. package/dist/types/twisty/views/screenshot.d.ts.map +0 -1
  713. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts.map +0 -1
  714. package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts.map +0 -1
  715. package/dist/types/vendor/p-lazy/p-lazy.d.ts.map +0 -1
  716. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts.map +0 -1
  717. package/docs/.DS_Store +0 -0
  718. package/docs/CNAME +0 -1
  719. package/docs/cubing/.DS_Store +0 -0
  720. package/docs/cubing/alg/index.html +0 -174
  721. package/docs/cubing/api/index.html +0 -158
  722. package/docs/cubing/index.html +0 -151
  723. package/docs/cubing/scramble/index.html +0 -138
  724. package/docs/cubing/twisty/index.html +0 -329
  725. package/docs/favicon.ico +0 -0
  726. package/docs/index.html +0 -20
  727. package/docs/main.css +0 -192
  728. package/kpuzzle/index.d.ts +0 -1
  729. package/notation/index.d.ts +0 -1
  730. package/protocol/index.d.ts +0 -1
  731. package/puzzle-geometry/index.d.ts +0 -1
  732. package/puzzles/index.d.ts +0 -1
  733. package/scramble/index.d.ts +0 -1
  734. package/search/index.d.ts +0 -1
  735. package/src/cubing/.DS_Store +0 -0
  736. package/src/cubing/alg/Alg.spec.ts +0 -10
  737. package/src/cubing/alg/Alg.ts +0 -290
  738. package/src/cubing/alg/AlgBuilder.ts +0 -33
  739. package/src/cubing/alg/Serializable.ts +0 -29
  740. package/src/cubing/alg/common.ts +0 -59
  741. package/src/cubing/alg/debug.ts +0 -27
  742. package/src/cubing/alg/example.ts +0 -152
  743. package/src/cubing/alg/index.ts +0 -21
  744. package/src/cubing/alg/is.ts +0 -38
  745. package/src/cubing/alg/iteration.ts +0 -45
  746. package/src/cubing/alg/keyboard.ts +0 -48
  747. package/src/cubing/alg/limits.ts +0 -4
  748. package/src/cubing/alg/operation.spec.ts +0 -48
  749. package/src/cubing/alg/operation.ts +0 -36
  750. package/src/cubing/alg/parse.spec.ts +0 -75
  751. package/src/cubing/alg/parse.ts +0 -408
  752. package/src/cubing/alg/test/alg-comparison.ts +0 -23
  753. package/src/cubing/alg/test/alg.spec.ts +0 -348
  754. package/src/cubing/alg/traversal.ts +0 -284
  755. package/src/cubing/alg/units/QuantumWithAmount.ts +0 -55
  756. package/src/cubing/alg/units/Unit.ts +0 -11
  757. package/src/cubing/alg/units/containers/Commutator.ts +0 -85
  758. package/src/cubing/alg/units/containers/Conjugate.ts +0 -53
  759. package/src/cubing/alg/units/containers/Grouping.ts +0 -116
  760. package/src/cubing/alg/units/index.ts +0 -8
  761. package/src/cubing/alg/units/leaves/LineComment.spec.ts +0 -35
  762. package/src/cubing/alg/units/leaves/LineComment.ts +0 -48
  763. package/src/cubing/alg/units/leaves/Move.spec.ts +0 -15
  764. package/src/cubing/alg/units/leaves/Move.ts +0 -265
  765. package/src/cubing/alg/units/leaves/Newline.ts +0 -24
  766. package/src/cubing/alg/units/leaves/Pause.ts +0 -24
  767. package/src/cubing/alg/url.spec.ts +0 -10
  768. package/src/cubing/alg/url.ts +0 -133
  769. package/src/cubing/alg/validation.ts +0 -62
  770. package/src/cubing/alg/warnOnce.ts +0 -7
  771. package/src/cubing/bluetooth/connect/index.ts +0 -93
  772. package/src/cubing/bluetooth/debug.ts +0 -18
  773. package/src/cubing/bluetooth/docs/gan-robot.md +0 -60
  774. package/src/cubing/bluetooth/docs/gan356i.md +0 -309
  775. package/src/cubing/bluetooth/index.ts +0 -19
  776. package/src/cubing/bluetooth/keyboard.ts +0 -55
  777. package/src/cubing/bluetooth/smart-puzzle/Heykube.ts +0 -165
  778. package/src/cubing/bluetooth/smart-puzzle/bluetooth-puzzle.ts +0 -95
  779. package/src/cubing/bluetooth/smart-puzzle/connect.ts +0 -19
  780. package/src/cubing/bluetooth/smart-puzzle/endianness.ts +0 -15
  781. package/src/cubing/bluetooth/smart-puzzle/gan.ts +0 -481
  782. package/src/cubing/bluetooth/smart-puzzle/giiker.spec.ts +0 -28
  783. package/src/cubing/bluetooth/smart-puzzle/giiker.ts +0 -277
  784. package/src/cubing/bluetooth/smart-puzzle/gocube.ts +0 -167
  785. package/src/cubing/bluetooth/smart-puzzle/unsafe-raw-aes.ts +0 -66
  786. package/src/cubing/bluetooth/smart-robot/GanRobot.ts +0 -311
  787. package/src/cubing/bluetooth/smart-robot/index.ts +0 -13
  788. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +0 -141
  789. package/src/cubing/bluetooth/smart-timer/index.ts +0 -13
  790. package/src/cubing/bluetooth/transformer.ts +0 -74
  791. package/src/cubing/esm-test-worker.js +0 -5
  792. package/src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.ts +0 -40
  793. package/src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.ts +0 -339
  794. package/src/cubing/kpuzzle/canon.spec.ts +0 -48
  795. package/src/cubing/kpuzzle/canonicalize.ts +0 -325
  796. package/src/cubing/kpuzzle/definition_types.ts +0 -23
  797. package/src/cubing/kpuzzle/index.ts +0 -33
  798. package/src/cubing/kpuzzle/kpuzzle.spec.ts +0 -12
  799. package/src/cubing/kpuzzle/kpuzzle.ts +0 -124
  800. package/src/cubing/kpuzzle/move_notation.ts +0 -9
  801. package/src/cubing/kpuzzle/parser/index.ts +0 -1
  802. package/src/cubing/kpuzzle/parser/parser-peggy.js +0 -1221
  803. package/src/cubing/kpuzzle/parser/parser-peggy.peggy +0 -72
  804. package/src/cubing/kpuzzle/parser/parser-shim.ts +0 -11
  805. package/src/cubing/kpuzzle/parser/parser.js +0 -0
  806. package/src/cubing/kpuzzle/prunetable.spec.ts +0 -19
  807. package/src/cubing/kpuzzle/pruningtable.ts +0 -99
  808. package/src/cubing/kpuzzle/puzzle-orientation.ts +0 -34
  809. package/src/cubing/kpuzzle/svg.ts +0 -290
  810. package/src/cubing/kpuzzle/transformations.spec.ts +0 -75
  811. package/src/cubing/kpuzzle/transformations.ts +0 -258
  812. package/src/cubing/notation/CountAnimatedLeaves.ts +0 -56
  813. package/src/cubing/notation/CountMoves.ts +0 -89
  814. package/src/cubing/notation/index.ts +0 -4
  815. package/src/cubing/protocol/binary/binary3x3x3.spec.ts +0 -143
  816. package/src/cubing/protocol/binary/binary3x3x3.ts +0 -226
  817. package/src/cubing/protocol/binary/hex.spec.ts +0 -17
  818. package/src/cubing/protocol/binary/hex.ts +0 -12
  819. package/src/cubing/protocol/binary/orbit-indexing.spec.ts +0 -49
  820. package/src/cubing/protocol/binary/orbit-indexing.ts +0 -68
  821. package/src/cubing/protocol/binary/puzzle-orientation.ts +0 -69
  822. package/src/cubing/protocol/index.ts +0 -12
  823. package/src/cubing/puzzle-geometry/FaceNameSwizzler.ts +0 -148
  824. package/src/cubing/puzzle-geometry/Options.ts +0 -179
  825. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +0 -127
  826. package/src/cubing/puzzle-geometry/PGPuzzles.ts +0 -80
  827. package/src/cubing/puzzle-geometry/Perm.ts +0 -154
  828. package/src/cubing/puzzle-geometry/PermOriSet.ts +0 -765
  829. package/src/cubing/puzzle-geometry/PlatonicGenerator.ts +0 -146
  830. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +0 -3009
  831. package/src/cubing/puzzle-geometry/Quat.spec.ts +0 -10
  832. package/src/cubing/puzzle-geometry/Quat.ts +0 -325
  833. package/src/cubing/puzzle-geometry/SchreierSims.ts +0 -144
  834. package/src/cubing/puzzle-geometry/index.ts +0 -17
  835. package/src/cubing/puzzle-geometry/interfaces.ts +0 -6
  836. package/src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts +0 -38
  837. package/src/cubing/puzzle-geometry/notation-mapping/FaceRenamingMapper.ts +0 -59
  838. package/src/cubing/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.ts +0 -50
  839. package/src/cubing/puzzle-geometry/notation-mapping/NotationMapper.ts +0 -6
  840. package/src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts +0 -12
  841. package/src/cubing/puzzle-geometry/notation-mapping/NxNxNCubeMapper.ts +0 -77
  842. package/src/cubing/puzzle-geometry/notation-mapping/PyraminxNotationMapper.ts +0 -121
  843. package/src/cubing/puzzle-geometry/notation-mapping/SkewbNotationMapper.ts +0 -103
  844. package/src/cubing/puzzle-geometry/notation-mapping/index.ts +0 -13
  845. package/src/cubing/puzzle-geometry/orientcenters.spec.ts +0 -55
  846. package/src/cubing/puzzles/PuzzleLoader.ts +0 -20
  847. package/src/cubing/puzzles/async/async-pg3d.ts +0 -73
  848. package/src/cubing/puzzles/customPGPuzzleLoader.ts +0 -60
  849. package/src/cubing/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.ts +0 -92
  850. package/src/cubing/puzzles/implementations/2x2x2/2x2x2.kpuzzle.svg.ts +0 -45
  851. package/src/cubing/puzzles/implementations/2x2x2/index.ts +0 -25
  852. package/src/cubing/puzzles/implementations/2x2x2/svg/2x2x2.kpuzzle.svg +0 -45
  853. package/src/cubing/puzzles/implementations/3x3x3/3x3x3-ll.kpuzzle.svg.ts +0 -108
  854. package/src/cubing/puzzles/implementations/3x3x3/3x3x3.kpuzzle.svg.ts +0 -128
  855. package/src/cubing/puzzles/implementations/3x3x3/index.ts +0 -33
  856. package/src/cubing/puzzles/implementations/3x3x3/src/3x3x3-ll.kpuzzle.svg +0 -108
  857. package/src/cubing/puzzles/implementations/3x3x3/src/3x3x3.kpuzzle.svg +0 -128
  858. package/src/cubing/puzzles/implementations/TODO/svg/alg/3x3x3.kpuzzle.original.svg +0 -128
  859. package/src/cubing/puzzles/implementations/TODO/svg/alg/3x3x3.kpuzzle.outlined.svg +0 -486
  860. package/src/cubing/puzzles/implementations/TODO/svg/alg/3x3x3.kpuzzle.spaced.svg +0 -128
  861. package/src/cubing/puzzles/implementations/clock/clock.kpuzzle.json.ts +0 -241
  862. package/src/cubing/puzzles/implementations/clock/clock.kpuzzle.svg.ts +0 -369
  863. package/src/cubing/puzzles/implementations/clock/index.ts +0 -14
  864. package/src/cubing/puzzles/implementations/clock/src/clock.kpuzzle.svg +0 -369
  865. package/src/cubing/puzzles/implementations/fto/index.ts +0 -28
  866. package/src/cubing/puzzles/implementations/megaminx/index.ts +0 -20
  867. package/src/cubing/puzzles/implementations/pyraminx/index.ts +0 -18
  868. package/src/cubing/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.ts +0 -84
  869. package/src/cubing/puzzles/implementations/pyraminx/pyraminx.kpuzzle.svg.ts +0 -88
  870. package/src/cubing/puzzles/implementations/pyraminx/src/pyraminx.kpuzzle.svg +0 -87
  871. package/src/cubing/puzzles/implementations/square1/index.ts +0 -14
  872. package/src/cubing/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.ts +0 -62
  873. package/src/cubing/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.svg.ts +0 -295
  874. package/src/cubing/puzzles/implementations/square1/src/sq1-hyperorbit.kpuzzle.svg +0 -295
  875. package/src/cubing/puzzles/implementations/square1/src/sq1-simple.svg +0 -60
  876. package/src/cubing/puzzles/index.ts +0 -92
  877. package/src/cubing/puzzles/stickerings/appearance.ts +0 -292
  878. package/src/cubing/puzzles/stickerings/cube-stickerings.ts +0 -286
  879. package/src/cubing/puzzles/stickerings/fto-stickerings.ts +0 -105
  880. package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +0 -61
  881. package/src/cubing/puzzles/stickerings/megaminx-stickerings.ts +0 -26
  882. package/src/cubing/scramble/index.ts +0 -1
  883. package/src/cubing/search/.gitignore +0 -1
  884. package/src/cubing/search/esm-test-worker.js +0 -14
  885. package/src/cubing/search/index.ts +0 -12
  886. package/src/cubing/search/inside/api.spec.ts +0 -37
  887. package/src/cubing/search/inside/api.ts +0 -171
  888. package/src/cubing/search/inside/entry.js +0 -4
  889. package/src/cubing/search/inside/inside-worker.ts +0 -13
  890. package/src/cubing/search/inside/solve/addOrientationSuffix.ts +0 -17
  891. package/src/cubing/search/inside/solve/parseSGS.ts +0 -119
  892. package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +0 -92
  893. package/src/cubing/search/inside/solve/puzzles/3x3x3/convert.ts +0 -137
  894. package/src/cubing/search/inside/solve/puzzles/3x3x3/filter.ts +0 -60
  895. package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +0 -57
  896. package/src/cubing/search/inside/solve/puzzles/3x3x3/legacy-sgs.ts +0 -291
  897. package/src/cubing/search/inside/solve/puzzles/3x3x3-inefficient.sgs.json.ts +0 -272
  898. package/src/cubing/search/inside/solve/puzzles/4x4x4.ts +0 -16
  899. package/src/cubing/search/inside/solve/puzzles/5x5x5.ts +0 -12
  900. package/src/cubing/search/inside/solve/puzzles/FTO.sgs +0 -264
  901. package/src/cubing/search/inside/solve/puzzles/big-cubes.ts +0 -78
  902. package/src/cubing/search/inside/solve/puzzles/clock.ts +0 -48
  903. package/src/cubing/search/inside/solve/puzzles/megaminx.ts +0 -51
  904. package/src/cubing/search/inside/solve/puzzles/pyraminx.ts +0 -48
  905. package/src/cubing/search/inside/solve/puzzles/sgs-defs.spec.ts +0 -27
  906. package/src/cubing/search/inside/solve/puzzles/skewb.sgs.json.ts +0 -113
  907. package/src/cubing/search/inside/solve/puzzles/skewb.ts +0 -65
  908. package/src/cubing/search/inside/solve/puzzles/sq1.ts +0 -6
  909. package/src/cubing/search/inside/solve/puzzles/wca-minx.ts +0 -32
  910. package/src/cubing/search/inside/solve/tremble.ts +0 -212
  911. package/src/cubing/search/inside/solve/vendor/cstimer/LICENSE +0 -674
  912. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.ts +0 -54
  913. package/src/cubing/search/inside/solve/vendor/min2phase/gwt.d.ts +0 -2
  914. package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +0 -38
  915. package/src/cubing/search/inside/solve/vendor/random-uint-below/index.ts +0 -12
  916. package/src/cubing/search/inside/solve/vendor/random-uint-below/random-choice.ts +0 -9
  917. package/src/cubing/search/inside/solve/vendor/random-uint-below/random-int.ts +0 -64
  918. package/src/cubing/search/instantiator.ts +0 -60
  919. package/src/cubing/search/outside.ts +0 -110
  920. package/src/cubing/search/vendor/comlink-everywhere/comlink-everywhere.webloc +0 -8
  921. package/src/cubing/search/vendor/comlink-everywhere/inside/index.js +0 -16
  922. package/src/cubing/search/vendor/comlink-everywhere/inside/node.js +0 -6
  923. package/src/cubing/search/vendor/comlink-everywhere/outside/index.d.ts +0 -6
  924. package/src/cubing/search/vendor/comlink-everywhere/outside/index.js +0 -31
  925. package/src/cubing/search/vendor/comlink-everywhere/outside/node.js +0 -41
  926. package/src/cubing/search/worker-inside-generated-string.js +0 -1
  927. package/src/cubing/stream/index.ts +0 -12
  928. package/src/cubing/stream/process/ReorientedStream.ts +0 -93
  929. package/src/cubing/stream/proxy-event.ts +0 -16
  930. package/src/cubing/stream/twizzle/TwizzleStream.ts +0 -53
  931. package/src/cubing/stream/twizzle/stream-types.ts +0 -45
  932. package/src/cubing/stream/websocket-proxy.ts +0 -73
  933. package/src/cubing/twisty/.DS_Store +0 -0
  934. package/src/cubing/twisty/controllers/.DS_Store +0 -0
  935. package/src/cubing/twisty/controllers/AnimationTypes.ts +0 -50
  936. package/src/cubing/twisty/controllers/RenderScheduler.ts +0 -28
  937. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +0 -325
  938. package/src/cubing/twisty/controllers/TwistyPlayerController.ts +0 -38
  939. package/src/cubing/twisty/controllers/animation/.DS_Store +0 -0
  940. package/src/cubing/twisty/controllers/easing.ts +0 -3
  941. package/src/cubing/twisty/controllers/indexer/.DS_Store +0 -0
  942. package/src/cubing/twisty/controllers/indexer/AlgDuration.ts +0 -94
  943. package/src/cubing/twisty/controllers/indexer/AlgIndexer.ts +0 -87
  944. package/src/cubing/twisty/controllers/indexer/SimpleAlgIndexer.ts +0 -76
  945. package/src/cubing/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +0 -181
  946. package/src/cubing/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +0 -243
  947. package/src/cubing/twisty/controllers/indexer/simultaneous-moves/simul-moves.ts +0 -193
  948. package/src/cubing/twisty/controllers/indexer/tree/AlgWalker.ts +0 -439
  949. package/src/cubing/twisty/controllers/indexer/tree/TreeAlgIndexer.ts +0 -97
  950. package/src/cubing/twisty/controllers/indexer/tree/chunkAlgs.ts +0 -81
  951. package/src/cubing/twisty/controllers/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -59
  952. package/src/cubing/twisty/controllers/stream/timeline-move-calculation-draft.ts +0 -162
  953. package/src/cubing/twisty/heavy-code-imports/.DS_Store +0 -0
  954. package/src/cubing/twisty/heavy-code-imports/3d.ts +0 -18
  955. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +0 -31
  956. package/src/cubing/twisty/index.ts +0 -24
  957. package/src/cubing/twisty/model/.DS_Store +0 -0
  958. package/src/cubing/twisty/model/PromiseFreshener.ts +0 -49
  959. package/src/cubing/twisty/model/TwistyPlayerModel.ts +0 -254
  960. package/src/cubing/twisty/model/UserVisibleErrorTracker.ts +0 -22
  961. package/src/cubing/twisty/model/helpers.ts +0 -47
  962. package/src/cubing/twisty/model/props/.DS_Store +0 -0
  963. package/src/cubing/twisty/model/props/TwistyProp.spec.ts +0 -38
  964. package/src/cubing/twisty/model/props/TwistyProp.ts +0 -366
  965. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +0 -370
  966. package/src/cubing/twisty/model/props/general/URLProp.ts +0 -14
  967. package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
  968. package/src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts +0 -9
  969. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +0 -15
  970. package/src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts +0 -43
  971. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +0 -54
  972. package/src/cubing/twisty/model/props/puzzle/state/AlgProp.ts +0 -91
  973. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +0 -28
  974. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +0 -44
  975. package/src/cubing/twisty/model/props/puzzle/state/CatchUpMoveProp.ts +0 -17
  976. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +0 -109
  977. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +0 -48
  978. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +0 -46
  979. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +0 -53
  980. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts +0 -15
  981. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +0 -24
  982. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +0 -22
  983. package/src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts +0 -9
  984. package/src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts +0 -20
  985. package/src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts +0 -28
  986. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +0 -14
  987. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDefProp.ts +0 -14
  988. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts +0 -14
  989. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +0 -12
  990. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +0 -36
  991. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +0 -38
  992. package/src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts +0 -45
  993. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +0 -78
  994. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +0 -48
  995. package/src/cubing/twisty/model/props/timeline/TempoScaleProp.ts +0 -13
  996. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +0 -38
  997. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +0 -16
  998. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +0 -15
  999. package/src/cubing/twisty/model/props/viewer/ButtonAppearanceProp.ts +0 -86
  1000. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +0 -14
  1001. package/src/cubing/twisty/model/props/viewer/LatitudeLimit.ts +0 -11
  1002. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +0 -127
  1003. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +0 -69
  1004. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +0 -15
  1005. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +0 -14
  1006. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +0 -17
  1007. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +0 -45
  1008. package/src/cubing/twisty/old/.DS_Store +0 -0
  1009. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  1010. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  1011. package/src/cubing/twisty/views/.DS_Store +0 -0
  1012. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.css.ts +0 -26
  1013. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +0 -146
  1014. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +0 -52
  1015. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +0 -77
  1016. package/src/cubing/twisty/views/3D/.DS_Store +0 -0
  1017. package/src/cubing/twisty/views/3D/DragTracker.ts +0 -184
  1018. package/src/cubing/twisty/views/3D/RendererPool.ts +0 -54
  1019. package/src/cubing/twisty/views/3D/TAU.ts +0 -2
  1020. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +0 -214
  1021. package/src/cubing/twisty/views/3D/Twisty3DRenderTarget.ts +0 -5
  1022. package/src/cubing/twisty/views/3D/Twisty3DScene.ts +0 -42
  1023. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +0 -189
  1024. package/src/cubing/twisty/views/3D/Twisty3DVantage.css.ts +0 -32
  1025. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +0 -312
  1026. package/src/cubing/twisty/views/3D/TwistyOrbitControls.spec.ts +0 -213
  1027. package/src/cubing/twisty/views/3D/TwistyOrbitControls.ts +0 -176
  1028. package/src/cubing/twisty/views/3D/puzzles/Cube3D.ts +0 -966
  1029. package/src/cubing/twisty/views/3D/puzzles/KPuzzleWrapper.ts +0 -142
  1030. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +0 -1078
  1031. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +0 -6
  1032. package/src/cubing/twisty/views/ClassListManager.ts +0 -34
  1033. package/src/cubing/twisty/views/ManagedCustomElement.ts +0 -76
  1034. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +0 -116
  1035. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts +0 -72
  1036. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.ts +0 -57
  1037. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +0 -368
  1038. package/src/cubing/twisty/views/TwistyAlgEditor/model.ts +0 -179
  1039. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +0 -25
  1040. package/src/cubing/twisty/views/TwistyAlgViewer.ts +0 -502
  1041. package/src/cubing/twisty/views/TwistyPlayer.css.ts +0 -73
  1042. package/src/cubing/twisty/views/TwistyPlayer.ts +0 -362
  1043. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +0 -115
  1044. package/src/cubing/twisty/views/TwistyViewerWrapper.css.ts +0 -41
  1045. package/src/cubing/twisty/views/canvas.ts +0 -9
  1046. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.css.ts +0 -127
  1047. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +0 -156
  1048. package/src/cubing/twisty/views/control-panel/TwistyScrubber.css.ts +0 -48
  1049. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +0 -145
  1050. package/src/cubing/twisty/views/control-panel/webkit-fullscreen.ts +0 -44
  1051. package/src/cubing/twisty/views/document.ts +0 -4
  1052. package/src/cubing/twisty/views/node-custom-element-shims.ts +0 -30
  1053. package/src/cubing/twisty/views/screenshot.ts +0 -90
  1054. package/src/cubing/twisty/views/stream/TwistyStreamSource.css.ts +0 -17
  1055. package/src/cubing/twisty/views/stream/TwistyStreamSource.ts +0 -155
  1056. package/src/cubing/vendor/p-lazy/license +0 -9
  1057. package/src/cubing/vendor/p-lazy/p-lazy.ts +0 -52
  1058. package/src/cubing/vendor/p-lazy/readme.md +0 -54
  1059. package/src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts +0 -179
  1060. package/stream/index.d.ts +0 -1
  1061. package/twisty/index.d.ts +0 -1
@@ -1,4063 +1,25 @@
1
1
  import {
2
- Move,
3
- QuantumMove
4
- } from "../chunk-EWRBHQFX.js";
2
+ PGNotation,
3
+ PuzzleGeometry,
4
+ Quat,
5
+ getPG3DNamedPuzzles,
6
+ getPuzzleDescriptionString,
7
+ getPuzzleGeometryByDesc,
8
+ getPuzzleGeometryByName,
9
+ parseOptions,
10
+ parsePuzzleDescription,
11
+ schreierSims
12
+ } from "../chunk-J2U2GRS4.js";
13
+ import "../chunk-EWRBHQFX.js";
5
14
  import "../chunk-WO2AXYFE.js";
6
-
7
- // src/cubing/puzzle-geometry/FaceNameSwizzler.ts
8
- var FaceNameSwizzler = class {
9
- constructor(facenames, gripnames_arg) {
10
- this.facenames = facenames;
11
- this.prefixFree = true;
12
- this.gripnames = [];
13
- if (gripnames_arg) {
14
- this.gripnames = gripnames_arg;
15
- }
16
- for (let i = 0; this.prefixFree && i < facenames.length; i++) {
17
- for (let j = 0; this.prefixFree && j < facenames.length; j++) {
18
- if (i !== j && facenames[i].startsWith(facenames[j])) {
19
- this.prefixFree = false;
20
- }
21
- }
22
- }
23
- }
24
- setGripNames(names) {
25
- this.gripnames = names;
26
- }
27
- splitByFaceNames(s) {
28
- const r = [];
29
- let at = 0;
30
- while (at < s.length) {
31
- if (at > 0 && at < s.length && s[at] === "_") {
32
- at++;
33
- }
34
- let currentMatch = -1;
35
- for (let i = 0; i < this.facenames.length; i++) {
36
- if (s.substr(at).startsWith(this.facenames[i]) && (currentMatch < 0 || this.facenames[i].length > this.facenames[currentMatch].length)) {
37
- currentMatch = i;
38
- }
39
- }
40
- if (currentMatch >= 0) {
41
- r.push(currentMatch);
42
- at += this.facenames[currentMatch].length;
43
- } else {
44
- throw new Error("Could not split " + s + " into face names.");
45
- }
46
- }
47
- return r;
48
- }
49
- joinByFaceIndices(list) {
50
- let sep = "";
51
- const r = [];
52
- for (let i = 0; i < list.length; i++) {
53
- r.push(sep);
54
- r.push(this.facenames[list[i]]);
55
- if (!this.prefixFree) {
56
- sep = "_";
57
- }
58
- }
59
- return r.join("");
60
- }
61
- spinmatch(userinput, longname) {
62
- if (userinput === longname) {
63
- return true;
64
- }
65
- try {
66
- const e1 = this.splitByFaceNames(userinput);
67
- const e2 = this.splitByFaceNames(longname);
68
- if (e1.length !== e2.length && e1.length < 3) {
69
- return false;
70
- }
71
- for (let i = 0; i < e1.length; i++) {
72
- for (let j = 0; j < i; j++) {
73
- if (e1[i] === e1[j]) {
74
- return false;
75
- }
76
- }
77
- let found = false;
78
- for (let j = 0; j < e2.length; j++) {
79
- if (e1[i] === e2[j]) {
80
- found = true;
81
- break;
82
- }
83
- }
84
- if (!found) {
85
- return false;
86
- }
87
- }
88
- return true;
89
- } catch (e) {
90
- return false;
91
- }
92
- }
93
- unswizzle(s) {
94
- if ((s.endsWith("v") || s.endsWith("w")) && s[0] <= "Z") {
95
- s = s.slice(0, s.length - 1);
96
- }
97
- const upperCaseGrip = s.toUpperCase();
98
- for (let i = 0; i < this.gripnames.length; i++) {
99
- const g = this.gripnames[i];
100
- if (this.spinmatch(upperCaseGrip, g)) {
101
- return g;
102
- }
103
- }
104
- return s;
105
- }
106
- };
107
-
108
- // src/cubing/puzzle-geometry/notation-mapping/NullMapper.ts
109
- var NullMapper = class {
110
- notationToInternal(move) {
111
- return move;
112
- }
113
- notationToExternal(move) {
114
- return move;
115
- }
116
- };
117
-
118
- // src/cubing/puzzle-geometry/notation-mapping/FTONotationMapper.ts
119
- var FTONotationMapper = class {
120
- constructor(child, sw) {
121
- this.child = child;
122
- this.sw = sw;
123
- }
124
- notationToInternal(move) {
125
- if (move.family === "T" && move.innerLayer === void 0 && move.outerLayer === void 0) {
126
- return new Move(new QuantumMove("FLRv", move.innerLayer, move.outerLayer), move.amount);
127
- } else {
128
- const r = this.child.notationToInternal(move);
129
- return r;
130
- }
131
- }
132
- notationToExternal(move) {
133
- let fam = move.family;
134
- if (fam.length > 0 && fam[fam.length - 1] === "v") {
135
- fam = fam.substring(0, fam.length - 1);
136
- }
137
- if (this.sw.spinmatch(fam, "FLUR")) {
138
- return new Move(new QuantumMove("T", move.innerLayer, move.outerLayer), move.amount);
139
- }
140
- return this.child.notationToExternal(move);
141
- }
142
- };
143
-
144
- // src/cubing/puzzle-geometry/notation-mapping/FaceRenamingMapper.ts
145
- var FaceRenamingMapper = class {
146
- constructor(internalNames, externalNames) {
147
- this.internalNames = internalNames;
148
- this.externalNames = externalNames;
149
- }
150
- convertString(grip, a, b) {
151
- let suffix = "";
152
- if ((grip.endsWith("v") || grip.endsWith("v")) && grip <= "_") {
153
- suffix = grip.slice(grip.length - 1);
154
- grip = grip.slice(0, grip.length - 1);
155
- }
156
- const upper = grip.toUpperCase();
157
- let isLowerCase = false;
158
- if (grip !== upper) {
159
- isLowerCase = true;
160
- grip = upper;
161
- }
162
- grip = b.joinByFaceIndices(a.splitByFaceNames(grip));
163
- if (isLowerCase) {
164
- grip = grip.toLowerCase();
165
- }
166
- return grip + suffix;
167
- }
168
- convert(move, a, b) {
169
- const grip = move.family;
170
- const ngrip = this.convertString(grip, a, b);
171
- if (grip === ngrip) {
172
- return move;
173
- } else {
174
- return new Move(new QuantumMove(ngrip, move.innerLayer, move.outerLayer), move.amount);
175
- }
176
- }
177
- notationToInternal(move) {
178
- const r = this.convert(move, this.externalNames, this.internalNames);
179
- return r;
180
- }
181
- notationToExternal(move) {
182
- return this.convert(move, this.internalNames, this.externalNames);
183
- }
184
- };
185
-
186
- // src/cubing/puzzle-geometry/notation-mapping/MegaminxScramblingNotationMapper.ts
187
- var MegaminxScramblingNotationMapper = class {
188
- constructor(child) {
189
- this.child = child;
190
- }
191
- notationToInternal(move) {
192
- if (move.innerLayer === void 0 && move.outerLayer === void 0) {
193
- if (Math.abs(move.amount) === 1) {
194
- if (move.family === "R++") {
195
- return new Move(new QuantumMove("L", 3, 2), -2 * move.amount);
196
- } else if (move.family === "R--") {
197
- return new Move(new QuantumMove("L", 3, 2), 2 * move.amount);
198
- } else if (move.family === "D++") {
199
- return new Move(new QuantumMove("U", 3, 2), -2 * move.amount);
200
- } else if (move.family === "D--") {
201
- return new Move(new QuantumMove("U", 3, 2), 2 * move.amount);
202
- }
203
- if (move.family === "R_PLUSPLUS_") {
204
- return new Move(new QuantumMove("L", 3, 2), -2 * move.amount);
205
- } else if (move.family === "D_PLUSPLUS_") {
206
- return new Move(new QuantumMove("U", 3, 2), -2 * move.amount);
207
- }
208
- }
209
- if (move.family === "y") {
210
- return new Move("Uv", move.amount);
211
- }
212
- }
213
- return this.child.notationToInternal(move);
214
- }
215
- notationToExternal(move) {
216
- if (move.family === "Uv") {
217
- return new Move(new QuantumMove("y", move.innerLayer, move.outerLayer), move.amount);
218
- }
219
- if (move.family === "Dv") {
220
- return new Move("y", -move.amount);
221
- }
222
- return this.child.notationToExternal(move);
223
- }
224
- };
225
-
226
- // src/cubing/puzzle-geometry/notation-mapping/NxNxNCubeMapper.ts
227
- var NxNxNCubeMapper = class {
228
- constructor(slices) {
229
- this.slices = slices;
230
- }
231
- notationToInternal(move) {
232
- const grip = move.family;
233
- if (!move.innerLayer && !move.outerLayer) {
234
- if (grip === "x") {
235
- move = new Move("Rv", move.amount);
236
- } else if (grip === "y") {
237
- move = new Move("Uv", move.amount);
238
- } else if (grip === "z") {
239
- move = new Move("Fv", move.amount);
240
- }
241
- if ((this.slices & 1) === 1) {
242
- if (grip === "E") {
243
- move = new Move(new QuantumMove("D", (this.slices + 1) / 2), move.amount);
244
- } else if (grip === "M") {
245
- move = new Move(new QuantumMove("L", (this.slices + 1) / 2), move.amount);
246
- } else if (grip === "S") {
247
- move = new Move(new QuantumMove("F", (this.slices + 1) / 2), move.amount);
248
- }
249
- }
250
- if (this.slices > 2) {
251
- if (grip === "e") {
252
- move = new Move(new QuantumMove("D", this.slices - 1, 2), move.amount);
253
- } else if (grip === "m") {
254
- move = new Move(new QuantumMove("L", this.slices - 1, 2), move.amount);
255
- } else if (grip === "s") {
256
- move = new Move(new QuantumMove("F", this.slices - 1, 2), move.amount);
257
- }
258
- }
259
- }
260
- return move;
261
- }
262
- notationToExternal(move) {
263
- const grip = move.family;
264
- if (!move.innerLayer && !move.outerLayer) {
265
- if (grip === "Rv") {
266
- return new Move("x", move.amount);
267
- } else if (grip === "Uv") {
268
- return new Move("y", move.amount);
269
- } else if (grip === "Fv") {
270
- return new Move("z", move.amount);
271
- } else if (grip === "Lv") {
272
- return new Move("x", -move.amount);
273
- } else if (grip === "Dv") {
274
- return new Move("y", -move.amount);
275
- } else if (grip === "Bv") {
276
- return new Move("z", -move.amount);
277
- }
278
- }
279
- return move;
280
- }
281
- };
282
-
283
- // src/cubing/puzzle-geometry/notation-mapping/PyraminxNotationMapper.ts
284
- var pyraminxFamilyMap = {
285
- U: "frl",
286
- L: "fld",
287
- R: "fdr",
288
- B: "dlr",
289
- u: "FRL",
290
- l: "FLD",
291
- r: "FDR",
292
- b: "DLR",
293
- Uv: "FRLv",
294
- Lv: "FLDv",
295
- Rv: "FDRv",
296
- Bv: "DLRv",
297
- D: "D",
298
- F: "F",
299
- BL: "L",
300
- BR: "R"
301
- };
302
- var tetraminxFamilyMap = {
303
- U: "FRL",
304
- L: "FLD",
305
- R: "FDR",
306
- B: "DLR",
307
- u: "frl",
308
- l: "fld",
309
- r: "fdr",
310
- b: "dlr",
311
- Uv: "FRLv",
312
- Lv: "FLDv",
313
- Rv: "FDRv",
314
- Bv: "DLRv",
315
- D: "D",
316
- F: "F",
317
- BL: "L",
318
- BR: "R",
319
- d: "d",
320
- f: "f",
321
- bl: "l",
322
- br: "r"
323
- };
324
- var pyraminxFamilyMapWCA = {
325
- U: "FRL",
326
- L: "FLD",
327
- R: "FDR",
328
- B: "DLR"
329
- };
330
- var pyraminxExternalQuantumY = new QuantumMove("y");
331
- var pyraminxInternalQuantumY = new QuantumMove("Dv");
332
- var PyraminxNotationMapper = class {
333
- constructor(child) {
334
- this.child = child;
335
- this.wcaHack = false;
336
- this.map = pyraminxFamilyMap;
337
- }
338
- notationToInternal(move) {
339
- if (this.wcaHack && move.innerLayer === 2 && move.outerLayer === null) {
340
- const newFamilyWCA = pyraminxFamilyMapWCA[move.family];
341
- if (newFamilyWCA) {
342
- return new Move(new QuantumMove(newFamilyWCA, move.innerLayer, move.outerLayer), move.amount);
343
- }
344
- }
345
- const newFamily = this.map[move.family];
346
- if (newFamily) {
347
- return new Move(new QuantumMove(newFamily, move.innerLayer, move.outerLayer), move.amount);
348
- } else if (pyraminxExternalQuantumY.isIdentical(move.quantum)) {
349
- return new Move(pyraminxInternalQuantumY, -move.amount);
350
- } else {
351
- return null;
352
- }
353
- }
354
- notationToExternal(move) {
355
- if (this.wcaHack && move.innerLayer === 2 && move.outerLayer === null) {
356
- for (const [external, internal] of Object.entries(pyraminxFamilyMapWCA)) {
357
- if (this.child.spinmatch(move.family, internal)) {
358
- return new Move(new QuantumMove(external, move.innerLayer, move.outerLayer), move.amount);
359
- }
360
- }
361
- }
362
- for (const [external, internal] of Object.entries(this.map)) {
363
- if (this.child.spinmatch(move.family, internal)) {
364
- return new Move(new QuantumMove(external, move.innerLayer, move.outerLayer), move.amount);
365
- }
366
- }
367
- if (pyraminxInternalQuantumY.isIdentical(move.quantum)) {
368
- return new Move(pyraminxExternalQuantumY, -move.amount);
369
- } else {
370
- return null;
371
- }
372
- }
373
- };
374
- var TetraminxNotationMapper = class extends PyraminxNotationMapper {
375
- constructor(child) {
376
- super(child);
377
- this.map = tetraminxFamilyMap;
378
- }
379
- };
380
-
381
- // src/cubing/puzzle-geometry/notation-mapping/SkewbNotationMapper.ts
382
- var skewbFamilyMap = {
383
- U: "UBL",
384
- UL: "ULF",
385
- F: "UFR",
386
- UR: "URB",
387
- B: "DBL",
388
- D: "DFR",
389
- L: "DLF",
390
- R: "DRB",
391
- Uv: "UBLv",
392
- ULv: "ULFv",
393
- Fv: "UFRv",
394
- URv: "URBv",
395
- Bv: "DBLv",
396
- Dv: "DFRv",
397
- Lv: "DLFv",
398
- Rv: "DRBv"
399
- };
400
- var skewbExternalQuantumX = new QuantumMove("x");
401
- var skewbInternalQuantumX = new QuantumMove("Rv");
402
- var skewbExternalQuantumY = new QuantumMove("y");
403
- var skewbInternalQuantumY = new QuantumMove("Uv");
404
- var skewbExternalQuantumZ = new QuantumMove("z");
405
- var skewbInternalQuantumZ = new QuantumMove("Fv");
406
- var SkewbNotationMapper = class {
407
- constructor(child) {
408
- this.child = child;
409
- }
410
- notationToInternal(move) {
411
- if (move.innerLayer || move.outerLayer) {
412
- return null;
413
- }
414
- const newFamily = skewbFamilyMap[move.family];
415
- if (newFamily) {
416
- return new Move(new QuantumMove(newFamily, move.outerLayer, move.innerLayer), move.amount);
417
- }
418
- if (skewbExternalQuantumX.isIdentical(move.quantum)) {
419
- return new Move(skewbInternalQuantumX, move.amount);
420
- }
421
- if (skewbExternalQuantumY.isIdentical(move.quantum)) {
422
- return new Move(skewbInternalQuantumY, move.amount);
423
- }
424
- if (skewbExternalQuantumZ.isIdentical(move.quantum)) {
425
- return new Move(skewbInternalQuantumZ, move.amount);
426
- }
427
- return null;
428
- }
429
- notationToExternal(move) {
430
- for (const [external, internal] of Object.entries(skewbFamilyMap)) {
431
- if (this.child.spinmatch(move.family, internal)) {
432
- return new Move(new QuantumMove(external, move.innerLayer, move.outerLayer), move.amount);
433
- }
434
- }
435
- if (skewbInternalQuantumX.isIdentical(move.quantum)) {
436
- return new Move(skewbExternalQuantumX, move.amount);
437
- }
438
- if (skewbInternalQuantumY.isIdentical(move.quantum)) {
439
- return new Move(skewbExternalQuantumY, move.amount);
440
- }
441
- if (skewbInternalQuantumZ.isIdentical(move.quantum)) {
442
- return new Move(skewbExternalQuantumZ, move.amount);
443
- }
444
- return null;
445
- }
446
- };
447
-
448
- // src/cubing/puzzle-geometry/Options.ts
449
- function parseOptions(argv) {
450
- let argp = 0;
451
- const options = {};
452
- while (argp < argv.length && argv[argp][0] === "-") {
453
- const option = argv[argp++];
454
- if (option === "--rotations") {
455
- options.addRotations = true;
456
- } else if (option === "--allmoves") {
457
- options.allMoves = true;
458
- } else if (option === "--outerblockmoves") {
459
- options.outerBlockMoves = true;
460
- } else if (option === "--vertexmoves") {
461
- options.vertexMoves = true;
462
- } else if (option === "--nocorners") {
463
- options.includeCornerOrbits = false;
464
- } else if (option === "--noedges") {
465
- options.includeEdgeOrbits = false;
466
- } else if (option === "--noorientation") {
467
- options.fixedOrientation = true;
468
- } else if (option === "--nocenters") {
469
- options.includeCenterOrbits = false;
470
- } else if (option === "--omit") {
471
- options.excludeOrbits = argv[argp].split(",");
472
- argp++;
473
- } else if (option === "--moves") {
474
- options.moveList = argv[argp].split(",");
475
- argp++;
476
- } else if (option === "--optimize") {
477
- options.optimizeOrbits = true;
478
- } else if (option === "--scramble") {
479
- options.scrambleAmount = 100;
480
- } else if (option === "--fixcorner") {
481
- options.fixedPieceType = "v";
482
- } else if (option === "--fixedge") {
483
- options.fixedPieceType = "e";
484
- } else if (option === "--fixcenter") {
485
- options.fixedPieceType = "f";
486
- } else if (option === "--orientcenters") {
487
- options.orientCenters = true;
488
- } else if (option === "--puzzleorientation") {
489
- options.puzzleOrientation = JSON.parse(argv[argp]);
490
- argp++;
491
- } else {
492
- throw new Error("Bad option: " + option);
493
- }
494
- }
495
- const puzzleDescription = parsePuzzleDescription(argv.slice(argp).join(" "));
496
- return { puzzleDescription, options };
497
- }
498
- var PuzzleGeometryFullOptions = class {
499
- constructor(options = {}) {
500
- this.verbosity = 0;
501
- this.allMoves = false;
502
- this.vertexMoves = false;
503
- this.addRotations = false;
504
- this.moveList = null;
505
- this.fixedOrientation = false;
506
- this.fixedPieceType = null;
507
- this.orientCenters = false;
508
- this.includeCornerOrbits = true;
509
- this.includeCenterOrbits = true;
510
- this.includeEdgeOrbits = true;
511
- this.excludeOrbits = [];
512
- this.optimizeOrbits = false;
513
- this.grayCorners = false;
514
- this.grayCenters = false;
515
- this.grayEdges = false;
516
- this.puzzleOrientation = null;
517
- this.puzzleOrientations = null;
518
- this.scrambleAmount = 0;
519
- Object.assign(this, options);
520
- }
521
- };
522
-
523
- // src/cubing/puzzle-geometry/Perm.ts
524
- var zeroCache = [];
525
- var iotaCache = [];
526
- function zeros(n) {
527
- if (!zeroCache[n]) {
528
- const c = Array(n);
529
- for (let i = 0; i < n; i++) {
530
- c[i] = 0;
531
- }
532
- zeroCache[n] = c;
533
- }
534
- return zeroCache[n];
535
- }
536
- function iota(n) {
537
- if (!iotaCache[n]) {
538
- const c = Array(n);
539
- for (let i = 0; i < n; i++) {
540
- c[i] = i;
541
- }
542
- iotaCache[n] = c;
543
- }
544
- return iotaCache[n];
545
- }
546
- function identity(n) {
547
- return new Perm(iota(n));
548
- }
549
- function factorial(a) {
550
- let r = 1;
551
- while (a > 1) {
552
- r *= a;
553
- a--;
554
- }
555
- return r;
556
- }
557
- function gcd(a, b) {
558
- if (a > b) {
559
- const t = a;
560
- a = b;
561
- b = t;
562
- }
563
- while (a > 0) {
564
- const m = b % a;
565
- b = a;
566
- a = m;
567
- }
568
- return b;
569
- }
570
- function lcm(a, b) {
571
- return a / gcd(a, b) * b;
572
- }
573
- var Perm = class {
574
- constructor(a) {
575
- this.n = a.length;
576
- this.p = a;
577
- }
578
- toString() {
579
- return "Perm[" + this.p.join(" ") + "]";
580
- }
581
- mul(p2) {
582
- const c = Array(this.n);
583
- for (let i = 0; i < this.n; i++) {
584
- c[i] = p2.p[this.p[i]];
585
- }
586
- return new Perm(c);
587
- }
588
- rmul(p2) {
589
- const c = Array(this.n);
590
- for (let i = 0; i < this.n; i++) {
591
- c[i] = this.p[p2.p[i]];
592
- }
593
- return new Perm(c);
594
- }
595
- inv() {
596
- const c = Array(this.n);
597
- for (let i = 0; i < this.n; i++) {
598
- c[this.p[i]] = i;
599
- }
600
- return new Perm(c);
601
- }
602
- compareTo(p2) {
603
- for (let i = 0; i < this.n; i++) {
604
- if (this.p[i] !== p2.p[i]) {
605
- return this.p[i] - p2.p[i];
606
- }
607
- }
608
- return 0;
609
- }
610
- toGap() {
611
- const cyc = new Array();
612
- const seen = new Array(this.n);
613
- for (let i = 0; i < this.p.length; i++) {
614
- if (seen[i] || this.p[i] === i) {
615
- continue;
616
- }
617
- const incyc = new Array();
618
- for (let j = i; !seen[j]; j = this.p[j]) {
619
- incyc.push(1 + j);
620
- seen[j] = true;
621
- }
622
- cyc.push("(" + incyc.join(",") + ")");
623
- }
624
- return cyc.join("");
625
- }
626
- order() {
627
- let r = 1;
628
- const seen = new Array(this.n);
629
- for (let i = 0; i < this.p.length; i++) {
630
- if (seen[i] || this.p[i] === i) {
631
- continue;
632
- }
633
- let cs = 0;
634
- for (let j = i; !seen[j]; j = this.p[j]) {
635
- cs++;
636
- seen[j] = true;
637
- }
638
- r = lcm(r, cs);
639
- }
640
- return r;
641
- }
642
- };
643
-
644
- // src/cubing/puzzle-geometry/PermOriSet.ts
645
- var PGOrbitDef = class {
646
- constructor(size, mod) {
647
- this.size = size;
648
- this.mod = mod;
649
- }
650
- reassemblySize() {
651
- return factorial(this.size) * Math.pow(this.mod, this.size);
652
- }
653
- };
654
- function externalName(mapper, moveString) {
655
- const mv = Move.fromString(moveString);
656
- const mv2 = mapper.notationToExternal(mv);
657
- if (mv2 === null || mv === mv2) {
658
- return moveString;
659
- }
660
- return mv2.toString();
661
- }
662
- var PGOrbitsDef = class {
663
- constructor(orbitnames, orbitdefs, solved, movenames, moveops) {
664
- this.orbitnames = orbitnames;
665
- this.orbitdefs = orbitdefs;
666
- this.solved = solved;
667
- this.movenames = movenames;
668
- this.moveops = moveops;
669
- }
670
- transformToKPuzzle(t) {
671
- const mp = {};
672
- for (let j = 0; j < this.orbitnames.length; j++) {
673
- mp[this.orbitnames[j]] = t.orbits[j].toKPuzzle();
674
- }
675
- return mp;
676
- }
677
- static transformToKPuzzle(orbitnames, t) {
678
- const mp = {};
679
- for (let j = 0; j < orbitnames.length; j++) {
680
- mp[orbitnames[j]] = t.orbits[j].toKPuzzle();
681
- }
682
- return mp;
683
- }
684
- toKsolve(name, mapper = new NullMapper()) {
685
- const result = [];
686
- result.push("Name " + name);
687
- result.push("");
688
- for (let i = 0; i < this.orbitnames.length; i++) {
689
- result.push(`Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`);
690
- }
691
- result.push("");
692
- result.push("Solved");
693
- for (let i = 0; i < this.orbitnames.length; i++) {
694
- this.solved.orbits[i].appendDefinition(result, this.orbitnames[i], false, false);
695
- }
696
- result.push("End");
697
- for (let i = 0; i < this.movenames.length; i++) {
698
- result.push("");
699
- let name2 = externalName(mapper, this.movenames[i]);
700
- let doinv = false;
701
- if (name2[name2.length - 1] === "'") {
702
- doinv = true;
703
- name2 = name2.substring(0, name2.length - 1);
704
- }
705
- result.push("Move " + name2);
706
- for (let j = 0; j < this.orbitnames.length; j++) {
707
- if (doinv) {
708
- this.moveops[i].orbits[j].inv().appendDefinition(result, this.orbitnames[j], true);
709
- } else {
710
- this.moveops[i].orbits[j].appendDefinition(result, this.orbitnames[j], true);
711
- }
712
- }
713
- result.push("End");
714
- }
715
- return result;
716
- }
717
- toKPuzzle(includemoves) {
718
- const orbits = {};
719
- const start = {};
720
- for (let i = 0; i < this.orbitnames.length; i++) {
721
- orbits[this.orbitnames[i]] = {
722
- numPieces: this.orbitdefs[i].size,
723
- orientations: this.orbitdefs[i].mod
724
- };
725
- start[this.orbitnames[i]] = this.solved.orbits[i].toKPuzzle();
726
- }
727
- const moves = {};
728
- if (includemoves) {
729
- for (let i = 0; i < this.movenames.length; i++) {
730
- moves[this.movenames[i]] = this.transformToKPuzzle(this.moveops[i]);
731
- }
732
- }
733
- return { name: "PG3D", orbits, startPieces: start, moves };
734
- }
735
- optimize() {
736
- const neworbitnames = [];
737
- const neworbitdefs = [];
738
- const newsolved = [];
739
- const newmoveops = [];
740
- for (let j = 0; j < this.moveops.length; j++) {
741
- newmoveops.push([]);
742
- }
743
- for (let i = 0; i < this.orbitdefs.length; i++) {
744
- const om = this.orbitdefs[i].mod;
745
- const n = this.orbitdefs[i].size;
746
- const du = new DisjointUnion(n);
747
- const changed = new Array(this.orbitdefs[i].size);
748
- for (let k = 0; k < n; k++) {
749
- changed[k] = false;
750
- }
751
- for (let j = 0; j < this.moveops.length; j++) {
752
- for (let k = 0; k < n; k++) {
753
- if (this.moveops[j].orbits[i].perm[k] !== k || this.moveops[j].orbits[i].ori[k] !== 0) {
754
- changed[k] = true;
755
- du.union(k, this.moveops[j].orbits[i].perm[k]);
756
- }
757
- }
758
- }
759
- let keepori = true;
760
- if (om > 1) {
761
- keepori = false;
762
- const duo = new DisjointUnion(this.orbitdefs[i].size * om);
763
- for (let j = 0; j < this.moveops.length; j++) {
764
- for (let k = 0; k < n; k++) {
765
- if (this.moveops[j].orbits[i].perm[k] !== k || this.moveops[j].orbits[i].ori[k] !== 0) {
766
- for (let o = 0; o < om; o++) {
767
- duo.union(k * om + o, this.moveops[j].orbits[i].perm[k] * om + (o + this.moveops[j].orbits[i].ori[k]) % om);
768
- }
769
- }
770
- }
771
- }
772
- for (let j = 0; !keepori && j < n; j++) {
773
- for (let o = 1; o < om; o++) {
774
- if (duo.find(j * om) === duo.find(j * om + o)) {
775
- keepori = true;
776
- }
777
- }
778
- }
779
- for (let j = 0; !keepori && j < n; j++) {
780
- for (let k = 0; k < j; k++) {
781
- if (this.solved.orbits[i].perm[j] === this.solved.orbits[i].perm[k]) {
782
- keepori = true;
783
- }
784
- }
785
- }
786
- }
787
- let nontriv = -1;
788
- let multiple = false;
789
- for (let j = 0; j < this.orbitdefs[i].size; j++) {
790
- if (changed[j]) {
791
- const h = du.find(j);
792
- if (nontriv < 0) {
793
- nontriv = h;
794
- } else if (nontriv !== h) {
795
- multiple = true;
796
- }
797
- }
798
- }
799
- for (let j = 0; j < this.orbitdefs[i].size; j++) {
800
- if (!changed[j]) {
801
- continue;
802
- }
803
- const h = du.find(j);
804
- if (h !== j) {
805
- continue;
806
- }
807
- const no = [];
808
- const on = [];
809
- let nv = 0;
810
- for (let k = 0; k < this.orbitdefs[i].size; k++) {
811
- if (du.find(k) === j) {
812
- no[nv] = k;
813
- on[k] = nv;
814
- nv++;
815
- }
816
- }
817
- if (multiple) {
818
- neworbitnames.push(`${this.orbitnames[i]}_p${j}`);
819
- } else {
820
- neworbitnames.push(this.orbitnames[i]);
821
- }
822
- if (keepori) {
823
- neworbitdefs.push(new PGOrbitDef(nv, this.orbitdefs[i].mod));
824
- newsolved.push(this.solved.orbits[i].remapVS(no, nv));
825
- for (let k = 0; k < this.moveops.length; k++) {
826
- newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv));
827
- }
828
- } else {
829
- neworbitdefs.push(new PGOrbitDef(nv, 1));
830
- newsolved.push(this.solved.orbits[i].remapVS(no, nv).killOri());
831
- for (let k = 0; k < this.moveops.length; k++) {
832
- newmoveops[k].push(this.moveops[k].orbits[i].remap(no, on, nv).killOri());
833
- }
834
- }
835
- }
836
- }
837
- return new PGOrbitsDef(neworbitnames, neworbitdefs, new VisibleState(newsolved), this.movenames, newmoveops.map((_) => new PGTransform(_)));
838
- }
839
- scramble(n) {
840
- const pool = [];
841
- for (let i = 0; i < this.moveops.length; i++) {
842
- pool[i] = this.moveops[i];
843
- }
844
- for (let i = 0; i < pool.length; i++) {
845
- const j = Math.floor(Math.random() * pool.length);
846
- const t = pool[i];
847
- pool[i] = pool[j];
848
- pool[j] = t;
849
- }
850
- if (n < pool.length) {
851
- n = pool.length;
852
- }
853
- for (let i = 0; i < n; i++) {
854
- const ri = Math.floor(Math.random() * pool.length);
855
- const rj = Math.floor(Math.random() * pool.length);
856
- const rm = Math.floor(Math.random() * this.moveops.length);
857
- pool[ri] = pool[ri].mul(pool[rj]).mul(this.moveops[rm]);
858
- if (Math.random() < 0.1) {
859
- pool[ri] = pool[ri].mul(this.moveops[rm]);
860
- }
861
- }
862
- let s = pool[0];
863
- for (let i = 1; i < pool.length; i++) {
864
- s = s.mul(pool[i]);
865
- }
866
- this.solved = this.solved.mul(s);
867
- }
868
- reassemblySize() {
869
- let n = 1;
870
- for (let i = 0; i < this.orbitdefs.length; i++) {
871
- n *= this.orbitdefs[i].reassemblySize();
872
- }
873
- return n;
874
- }
875
- };
876
- var _PGOrbit = class {
877
- constructor(perm, ori, orimod) {
878
- this.perm = perm;
879
- this.ori = ori;
880
- this.orimod = orimod;
881
- }
882
- static e(n, mod) {
883
- return new _PGOrbit(iota(n), zeros(n), mod);
884
- }
885
- mul(b) {
886
- const n = this.perm.length;
887
- const newPerm = new Array(n);
888
- if (this.orimod === 1) {
889
- for (let i = 0; i < n; i++) {
890
- newPerm[i] = this.perm[b.perm[i]];
891
- }
892
- return new _PGOrbit(newPerm, this.ori, this.orimod);
893
- } else {
894
- const newOri = new Array(n);
895
- for (let i = 0; i < n; i++) {
896
- newPerm[i] = this.perm[b.perm[i]];
897
- newOri[i] = (this.ori[b.perm[i]] + b.ori[i]) % this.orimod;
898
- }
899
- return new _PGOrbit(newPerm, newOri, this.orimod);
900
- }
901
- }
902
- inv() {
903
- const n = this.perm.length;
904
- const newPerm = new Array(n);
905
- const newOri = new Array(n);
906
- for (let i = 0; i < n; i++) {
907
- newPerm[this.perm[i]] = i;
908
- newOri[this.perm[i]] = (this.orimod - this.ori[i]) % this.orimod;
909
- }
910
- return new _PGOrbit(newPerm, newOri, this.orimod);
911
- }
912
- equal(b) {
913
- const n = this.perm.length;
914
- for (let i = 0; i < n; i++) {
915
- if (this.perm[i] !== b.perm[i] || this.ori[i] !== b.ori[i]) {
916
- return false;
917
- }
918
- }
919
- return true;
920
- }
921
- killOri() {
922
- const n = this.perm.length;
923
- for (let i = 0; i < n; i++) {
924
- this.ori[i] = 0;
925
- }
926
- this.orimod = 1;
927
- return this;
928
- }
929
- toPerm() {
930
- const o = this.orimod;
931
- if (o === 1) {
932
- return new Perm(this.perm);
933
- }
934
- const n = this.perm.length;
935
- const newPerm = new Array(n * o);
936
- for (let i = 0; i < n; i++) {
937
- for (let j = 0; j < o; j++) {
938
- newPerm[i * o + j] = o * this.perm[i] + (this.ori[i] + j) % o;
939
- }
940
- }
941
- return new Perm(newPerm);
942
- }
943
- identicalPieces() {
944
- const done = [];
945
- const n = this.perm.length;
946
- const r = [];
947
- for (let i = 0; i < n; i++) {
948
- const v = this.perm[i];
949
- if (done[v] === void 0) {
950
- const s = [i];
951
- done[v] = true;
952
- for (let j = i + 1; j < n; j++) {
953
- if (this.perm[j] === v) {
954
- s.push(j);
955
- }
956
- }
957
- r.push(s);
958
- }
959
- }
960
- return r;
961
- }
962
- order() {
963
- return this.toPerm().order();
964
- }
965
- isIdentity() {
966
- const n = this.perm.length;
967
- if (this.perm === iota(n) && this.ori === zeros(n)) {
968
- return true;
969
- }
970
- for (let i = 0; i < n; i++) {
971
- if (this.perm[i] !== i || this.ori[i] !== 0) {
972
- return false;
973
- }
974
- }
975
- return true;
976
- }
977
- zeroOris() {
978
- const n = this.perm.length;
979
- if (this.ori === zeros(n)) {
980
- return true;
981
- }
982
- for (let i = 0; i < n; i++) {
983
- if (this.ori[i] !== 0) {
984
- return false;
985
- }
986
- }
987
- return true;
988
- }
989
- remap(no, on, nv) {
990
- const newPerm = new Array(nv);
991
- const newOri = new Array(nv);
992
- for (let i = 0; i < nv; i++) {
993
- newPerm[i] = on[this.perm[no[i]]];
994
- newOri[i] = this.ori[no[i]];
995
- }
996
- return new _PGOrbit(newPerm, newOri, this.orimod);
997
- }
998
- remapVS(no, nv) {
999
- const newPerm = new Array(nv);
1000
- const newOri = new Array(nv);
1001
- let nextNew = 0;
1002
- const reassign = [];
1003
- for (let i = 0; i < nv; i++) {
1004
- const ov = this.perm[no[i]];
1005
- if (reassign[ov] === void 0) {
1006
- reassign[ov] = nextNew++;
1007
- }
1008
- newPerm[i] = reassign[ov];
1009
- newOri[i] = this.ori[no[i]];
1010
- }
1011
- return new _PGOrbit(newPerm, newOri, this.orimod);
1012
- }
1013
- appendDefinition(result, name, useVS, concise = true) {
1014
- if (concise && this.isIdentity()) {
1015
- return;
1016
- }
1017
- result.push(name);
1018
- result.push(this.perm.map((_) => _ + 1).join(" "));
1019
- if (!this.zeroOris()) {
1020
- if (useVS) {
1021
- const newori = new Array(this.ori.length);
1022
- for (let i = 0; i < newori.length; i++) {
1023
- newori[this.perm[i]] = this.ori[i];
1024
- }
1025
- result.push(newori.join(" "));
1026
- } else {
1027
- result.push(this.ori.join(" "));
1028
- }
1029
- }
1030
- }
1031
- toKPuzzle() {
1032
- const n = this.perm.length;
1033
- if (this.isIdentity()) {
1034
- if (!_PGOrbit.kcache[n]) {
1035
- _PGOrbit.kcache[n] = { permutation: iota(n), orientation: zeros(n) };
1036
- }
1037
- return _PGOrbit.kcache[n];
1038
- } else {
1039
- return { permutation: this.perm, orientation: this.ori };
1040
- }
1041
- }
1042
- };
1043
- var PGOrbit = _PGOrbit;
1044
- PGOrbit.kcache = [];
1045
- var PGTransformBase = class {
1046
- constructor(orbits) {
1047
- this.orbits = orbits;
1048
- }
1049
- internalMul(b) {
1050
- const newOrbits = [];
1051
- for (let i = 0; i < this.orbits.length; i++) {
1052
- newOrbits.push(this.orbits[i].mul(b.orbits[i]));
1053
- }
1054
- return newOrbits;
1055
- }
1056
- internalInv() {
1057
- const newOrbits = [];
1058
- for (const orbit of this.orbits) {
1059
- newOrbits.push(orbit.inv());
1060
- }
1061
- return newOrbits;
1062
- }
1063
- equal(b) {
1064
- for (let i = 0; i < this.orbits.length; i++) {
1065
- if (!this.orbits[i].equal(b.orbits[i])) {
1066
- return false;
1067
- }
1068
- }
1069
- return true;
1070
- }
1071
- killOri() {
1072
- for (const orbit of this.orbits) {
1073
- orbit.killOri();
1074
- }
1075
- return this;
1076
- }
1077
- toPerm() {
1078
- const perms = new Array();
1079
- let n = 0;
1080
- for (const orbit of this.orbits) {
1081
- const p = orbit.toPerm();
1082
- perms.push(p);
1083
- n += p.n;
1084
- }
1085
- const newPerm = new Array(n);
1086
- n = 0;
1087
- for (const p of perms) {
1088
- for (let j = 0; j < p.n; j++) {
1089
- newPerm[n + j] = n + p.p[j];
1090
- }
1091
- n += p.n;
1092
- }
1093
- return new Perm(newPerm);
1094
- }
1095
- identicalPieces() {
1096
- const r = [];
1097
- let n = 0;
1098
- for (const orbit of this.orbits) {
1099
- const o = orbit.orimod;
1100
- const s = orbit.identicalPieces();
1101
- for (let j = 0; j < s.length; j++) {
1102
- r.push(s[j].map((_) => _ * o + n));
1103
- }
1104
- n += o * orbit.perm.length;
1105
- }
1106
- return r;
1107
- }
1108
- order() {
1109
- let r = 1;
1110
- for (const orbit of this.orbits) {
1111
- r = lcm(r, orbit.order());
1112
- }
1113
- return r;
1114
- }
1115
- };
1116
- var PGTransform = class extends PGTransformBase {
1117
- constructor(orbits) {
1118
- super(orbits);
1119
- }
1120
- mul(b) {
1121
- return new PGTransform(this.internalMul(b));
1122
- }
1123
- mulScalar(n) {
1124
- if (n === 0) {
1125
- return this.e();
1126
- }
1127
- let t = this;
1128
- if (n < 0) {
1129
- t = t.inv();
1130
- n = -n;
1131
- }
1132
- while ((n & 1) === 0) {
1133
- t = t.mul(t);
1134
- n >>= 1;
1135
- }
1136
- if (n === 1) {
1137
- return t;
1138
- }
1139
- let s = t;
1140
- let r = this.e();
1141
- while (n > 0) {
1142
- if (n & 1) {
1143
- r = r.mul(s);
1144
- }
1145
- if (n > 1) {
1146
- s = s.mul(s);
1147
- }
1148
- n >>= 1;
1149
- }
1150
- return r;
1151
- }
1152
- inv() {
1153
- return new PGTransform(this.internalInv());
1154
- }
1155
- e() {
1156
- return new PGTransform(this.orbits.map((_) => PGOrbit.e(_.perm.length, _.orimod)));
1157
- }
1158
- };
1159
- var VisibleState = class extends PGTransformBase {
1160
- constructor(orbits) {
1161
- super(orbits);
1162
- }
1163
- mul(b) {
1164
- return new VisibleState(this.internalMul(b));
1165
- }
1166
- };
1167
- var DisjointUnion = class {
1168
- constructor(n) {
1169
- this.n = n;
1170
- this.heads = new Array(n);
1171
- for (let i = 0; i < n; i++) {
1172
- this.heads[i] = i;
1173
- }
1174
- }
1175
- find(v) {
1176
- let h = this.heads[v];
1177
- if (this.heads[h] === h) {
1178
- return h;
1179
- }
1180
- h = this.find(this.heads[h]);
1181
- this.heads[v] = h;
1182
- return h;
1183
- }
1184
- union(a, b) {
1185
- const ah = this.find(a);
1186
- const bh = this.find(b);
1187
- if (ah < bh) {
1188
- this.heads[bh] = ah;
1189
- } else if (ah > bh) {
1190
- this.heads[ah] = bh;
1191
- }
1192
- }
1193
- };
1194
- function showcanon(g, disp) {
1195
- const n = g.moveops.length;
1196
- if (n > 30) {
1197
- throw new Error("Canon info too big for bitmask");
1198
- }
1199
- const orders = [];
1200
- const commutes = [];
1201
- for (let i = 0; i < n; i++) {
1202
- const permA = g.moveops[i];
1203
- orders.push(permA.order());
1204
- let bits = 0;
1205
- for (let j = 0; j < n; j++) {
1206
- if (j === i) {
1207
- continue;
1208
- }
1209
- const permB = g.moveops[j];
1210
- if (permA.mul(permB).equal(permB.mul(permA))) {
1211
- bits |= 1 << j;
1212
- }
1213
- }
1214
- commutes.push(bits);
1215
- }
1216
- let curlev = {};
1217
- curlev[0] = 1;
1218
- for (let d = 0; d < 100; d++) {
1219
- let sum = 0;
1220
- const nextlev = {};
1221
- let uniq = 0;
1222
- for (const sti in curlev) {
1223
- const st = +sti;
1224
- const cnt = curlev[st];
1225
- sum += cnt;
1226
- uniq++;
1227
- for (let mv = 0; mv < orders.length; mv++) {
1228
- if ((st >> mv & 1) === 0 && (st & commutes[mv] & (1 << mv) - 1) === 0) {
1229
- const nst = st & commutes[mv] | 1 << mv;
1230
- if (nextlev[nst] === void 0) {
1231
- nextlev[nst] = 0;
1232
- }
1233
- nextlev[nst] += (orders[mv] - 1) * cnt;
1234
- }
1235
- }
1236
- }
1237
- disp(`${d}: canonseq ${sum} states ${uniq}`);
1238
- curlev = nextlev;
1239
- }
1240
- }
1241
-
1242
- // src/cubing/puzzle-geometry/PGPuzzles.ts
1243
- var PGPuzzles = {
1244
- "2x2x2": "c f 0",
1245
- "3x3x3": "c f 0.333333333333333",
1246
- "4x4x4": "c f 0.5 f 0",
1247
- "5x5x5": "c f 0.6 f 0.2",
1248
- "6x6x6": "c f 0.666666666666667 f 0.333333333333333 f 0",
1249
- "7x7x7": "c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143",
1250
- "8x8x8": "c f 0.75 f 0.5 f 0.25 f 0",
1251
- "9x9x9": "c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111",
1252
- "10x10x10": "c f 0.8 f 0.6 f 0.4 f 0.2 f 0",
1253
- "11x11x11": "c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909",
1254
- "12x12x12": "c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0",
1255
- "13x13x13": "c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769",
1256
- "20x20x20": "c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9",
1257
- "30x30x30": "c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333",
1258
- "40x40x40": "c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95",
1259
- "skewb": "c v 0",
1260
- "master skewb": "c v 0.275",
1261
- "professor skewb": "c v 0 v 0.38",
1262
- "compy cube": "c v 0.915641442663986",
1263
- "helicopter": "c e 0.707106781186547",
1264
- "curvy copter": "c e 0.83",
1265
- "dino": "c v 0.577350269189626",
1266
- "little chop": "c e 0",
1267
- "pyramorphix": "t e 0",
1268
- "mastermorphix": "t e 0.346184634065199",
1269
- "pyraminx": "t v 0.333333333333333 v 1.66666666666667",
1270
- "tetraminx": "t v 0.333333333333333",
1271
- "master pyraminx": "t v 0 v 1 v 2",
1272
- "master tetraminx": "t v 0 v 1",
1273
- "professor pyraminx": "t v -0.2 v 0.6 v 1.4 v 2.2",
1274
- "professor tetraminx": "t v -0.2 v 0.6 v 1.4",
1275
- "Jing pyraminx": "t f 0",
1276
- "master pyramorphix": "t e 0.866025403784437",
1277
- "megaminx": "d f 0.7",
1278
- "gigaminx": "d f 0.64 f 0.82",
1279
- "teraminx": "d f 0.64 f 0.76 f 0.88",
1280
- "petaminx": "d f 0.64 f 0.73 f 0.82 f 0.91",
1281
- "examinx": "d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928",
1282
- "zetaminx": "d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94",
1283
- "yottaminx": "d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486",
1284
- "pentultimate": "d f 0",
1285
- "master pentultimate": "d f 0.1",
1286
- "elite pentultimate": "d f 0 f 0.145905",
1287
- "starminx": "d v 0.937962370425399",
1288
- "starminx 2": "d f 0.23606797749979",
1289
- "pyraminx crystal": "d f 0.447213595499989",
1290
- "chopasaurus": "d v 0",
1291
- "big chop": "d e 0",
1292
- "skewb diamond": "o f 0",
1293
- "FTO": "o f 0.333333333333333",
1294
- "master FTO": "o f 0.5 f 0",
1295
- "Christopher's jewel": "o v 0.577350269189626",
1296
- "octastar": "o e 0",
1297
- "Trajber's octahedron": "o v 0.433012701892219",
1298
- "radio chop": "i f 0",
1299
- "icosamate": "i v 0",
1300
- "icosahedron 2": "i v 0.18759247376021",
1301
- "icosahedron 3": "i v 0.18759247376021 e 0",
1302
- "icosahedron static faces": "i v 0.84",
1303
- "icosahedron moving faces": "i v 0.73",
1304
- "Eitan's star": "i f 0.61803398874989",
1305
- "2x2x2 + dino": "c f 0 v 0.577350269189626",
1306
- "2x2x2 + little chop": "c f 0 e 0",
1307
- "dino + little chop": "c v 0.577350269189626 e 0",
1308
- "2x2x2 + dino + little chop": "c f 0 v 0.577350269189626 e 0",
1309
- "megaminx + chopasaurus": "d f 0.61803398875 v 0",
1310
- "starminx combo": "d f 0.23606797749979 v 0.937962370425399"
1311
- };
1312
-
1313
- // src/cubing/puzzle-geometry/Quat.ts
1314
- var eps = 1e-9;
1315
- function centermassface(face) {
1316
- let s = new Quat(0, 0, 0, 0);
1317
- for (let i = 0; i < face.length; i++) {
1318
- s = s.sum(face[i]);
1319
- }
1320
- return s.smul(1 / face.length);
1321
- }
1322
- function solvethreeplanes(p1, p2, p3, planes) {
1323
- const p = planes[p1].intersect3(planes[p2], planes[p3]);
1324
- if (!p) {
1325
- return p;
1326
- }
1327
- for (let i = 0; i < planes.length; i++) {
1328
- if (i !== p1 && i !== p2 && i !== p3) {
1329
- const dt = planes[i].b * p.b + planes[i].c * p.c + planes[i].d * p.d;
1330
- if (planes[i].a > 0 && dt > planes[i].a || planes[i].a < 0 && dt < planes[i].a) {
1331
- return false;
1332
- }
1333
- }
1334
- }
1335
- return p;
1336
- }
1337
- var Quat = class {
1338
- constructor(a, b, c, d) {
1339
- this.a = a;
1340
- this.b = b;
1341
- this.c = c;
1342
- this.d = d;
1343
- }
1344
- mul(q) {
1345
- return new Quat(this.a * q.a - this.b * q.b - this.c * q.c - this.d * q.d, this.a * q.b + this.b * q.a + this.c * q.d - this.d * q.c, this.a * q.c - this.b * q.d + this.c * q.a + this.d * q.b, this.a * q.d + this.b * q.c - this.c * q.b + this.d * q.a);
1346
- }
1347
- toString() {
1348
- return `Q[${this.a},${this.b},${this.c},${this.d}]`;
1349
- }
1350
- dist(q) {
1351
- return Math.hypot(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);
1352
- }
1353
- len() {
1354
- return Math.hypot(this.a, this.b, this.c, this.d);
1355
- }
1356
- cross(q) {
1357
- return new Quat(0, this.c * q.d - this.d * q.c, this.d * q.b - this.b * q.d, this.b * q.c - this.c * q.b);
1358
- }
1359
- dot(q) {
1360
- return this.b * q.b + this.c * q.c + this.d * q.d;
1361
- }
1362
- normalize() {
1363
- const d = Math.sqrt(this.dot(this));
1364
- return new Quat(this.a / d, this.b / d, this.c / d, this.d / d);
1365
- }
1366
- makenormal() {
1367
- return new Quat(0, this.b, this.c, this.d).normalize();
1368
- }
1369
- normalizeplane() {
1370
- const d = Math.hypot(this.b, this.c, this.d);
1371
- return new Quat(this.a / d, this.b / d, this.c / d, this.d / d);
1372
- }
1373
- smul(m) {
1374
- return new Quat(this.a * m, this.b * m, this.c * m, this.d * m);
1375
- }
1376
- sum(q) {
1377
- return new Quat(this.a + q.a, this.b + q.b, this.c + q.c, this.d + q.d);
1378
- }
1379
- sub(q) {
1380
- return new Quat(this.a - q.a, this.b - q.b, this.c - q.c, this.d - q.d);
1381
- }
1382
- angle() {
1383
- return 2 * Math.acos(this.a);
1384
- }
1385
- invrot() {
1386
- return new Quat(this.a, -this.b, -this.c, -this.d);
1387
- }
1388
- det3x3(a00, a01, a02, a10, a11, a12, a20, a21, a22) {
1389
- return a00 * (a11 * a22 - a12 * a21) + a01 * (a12 * a20 - a10 * a22) + a02 * (a10 * a21 - a11 * a20);
1390
- }
1391
- rotateplane(q) {
1392
- const t = q.mul(new Quat(0, this.b, this.c, this.d)).mul(q.invrot());
1393
- t.a = this.a;
1394
- return t;
1395
- }
1396
- orthogonal() {
1397
- const ab = Math.abs(this.b);
1398
- const ac = Math.abs(this.c);
1399
- const ad = Math.abs(this.d);
1400
- if (ab < ac && ab < ad) {
1401
- return this.cross(new Quat(0, 1, 0, 0)).normalize();
1402
- } else if (ac < ab && ac < ad) {
1403
- return this.cross(new Quat(0, 0, 1, 0)).normalize();
1404
- } else {
1405
- return this.cross(new Quat(0, 0, 0, 1)).normalize();
1406
- }
1407
- }
1408
- pointrotation(b) {
1409
- const a = this.normalize();
1410
- b = b.normalize();
1411
- if (a.sub(b).len() < eps) {
1412
- return new Quat(1, 0, 0, 0);
1413
- }
1414
- let h = a.sum(b);
1415
- if (h.len() < eps) {
1416
- h = h.orthogonal();
1417
- } else {
1418
- h = h.normalize();
1419
- }
1420
- const r = a.cross(h);
1421
- r.a = a.dot(h);
1422
- return r;
1423
- }
1424
- unproject(b) {
1425
- return this.sum(b.smul(-this.dot(b) / (this.len() * b.len())));
1426
- }
1427
- rotatepoint(q) {
1428
- return q.mul(this).mul(q.invrot());
1429
- }
1430
- rotateface(face) {
1431
- return face.map((_) => _.rotatepoint(this));
1432
- }
1433
- intersect3(p2, p3) {
1434
- const det = this.det3x3(this.b, this.c, this.d, p2.b, p2.c, p2.d, p3.b, p3.c, p3.d);
1435
- if (Math.abs(det) < eps) {
1436
- return false;
1437
- }
1438
- return new Quat(0, this.det3x3(this.a, this.c, this.d, p2.a, p2.c, p2.d, p3.a, p3.c, p3.d) / det, this.det3x3(this.b, this.a, this.d, p2.b, p2.a, p2.d, p3.b, p3.a, p3.d) / det, this.det3x3(this.b, this.c, this.a, p2.b, p2.c, p2.a, p3.b, p3.c, p3.a) / det);
1439
- }
1440
- side(x) {
1441
- if (x > eps) {
1442
- return 1;
1443
- }
1444
- if (x < -eps) {
1445
- return -1;
1446
- }
1447
- return 0;
1448
- }
1449
- cutface(face) {
1450
- const d = this.a;
1451
- let seen = 0;
1452
- let r = null;
1453
- for (let i = 0; i < face.length; i++) {
1454
- seen |= 1 << this.side(face[i].dot(this) - d) + 1;
1455
- }
1456
- if ((seen & 5) === 5) {
1457
- r = [];
1458
- const inout = face.map((_) => this.side(_.dot(this) - d));
1459
- for (let s = -1; s <= 1; s += 2) {
1460
- const nface = [];
1461
- for (let k = 0; k < face.length; k++) {
1462
- if (inout[k] === s || inout[k] === 0) {
1463
- nface.push(face[k]);
1464
- }
1465
- const kk = (k + 1) % face.length;
1466
- if (inout[k] + inout[kk] === 0 && inout[k] !== 0) {
1467
- const vk = face[k].dot(this) - d;
1468
- const vkk = face[kk].dot(this) - d;
1469
- const r2 = vk / (vk - vkk);
1470
- const pt = face[k].smul(1 - r2).sum(face[kk].smul(r2));
1471
- nface.push(pt);
1472
- }
1473
- }
1474
- r.push(nface);
1475
- }
1476
- }
1477
- return r;
1478
- }
1479
- cutfaces(faces) {
1480
- const nfaces = [];
1481
- for (let j = 0; j < faces.length; j++) {
1482
- const face = faces[j];
1483
- const t = this.cutface(face);
1484
- if (t) {
1485
- nfaces.push(t[0]);
1486
- nfaces.push(t[1]);
1487
- } else {
1488
- nfaces.push(face);
1489
- }
1490
- }
1491
- return nfaces;
1492
- }
1493
- faceside(face) {
1494
- const d = this.a;
1495
- for (let i = 0; i < face.length; i++) {
1496
- const s = this.side(face[i].dot(this) - d);
1497
- if (s !== 0) {
1498
- return s;
1499
- }
1500
- }
1501
- throw new Error("Could not determine side of plane in faceside");
1502
- }
1503
- sameplane(p) {
1504
- const a = this.normalize();
1505
- const b = p.normalize();
1506
- return a.dist(b) < eps || a.dist(b.smul(-1)) < eps;
1507
- }
1508
- makecut(r) {
1509
- return new Quat(r, this.b, this.c, this.d);
1510
- }
1511
- };
1512
-
1513
- // src/cubing/puzzle-geometry/PlatonicGenerator.ts
1514
- var eps2 = 1e-9;
1515
- function cube() {
1516
- const s5 = Math.sqrt(0.5);
1517
- return [new Quat(s5, s5, 0, 0), new Quat(s5, 0, s5, 0)];
1518
- }
1519
- function tetrahedron() {
1520
- return [new Quat(0.5, 0.5, 0.5, 0.5), new Quat(0.5, 0.5, 0.5, -0.5)];
1521
- }
1522
- function dodecahedron() {
1523
- const d36 = 2 * Math.PI / 10;
1524
- let dx = 0.5 + 0.3 * Math.sqrt(5);
1525
- let dy = 0.5 + 0.1 * Math.sqrt(5);
1526
- const dd = Math.sqrt(dx * dx + dy * dy);
1527
- dx /= dd;
1528
- dy /= dd;
1529
- return [
1530
- new Quat(Math.cos(d36), dx * Math.sin(d36), dy * Math.sin(d36), 0),
1531
- new Quat(0.5, 0.5, 0.5, 0.5)
1532
- ];
1533
- }
1534
- function icosahedron() {
1535
- let dx = 1 / 6 + Math.sqrt(5) / 6;
1536
- let dy = 2 / 3 + Math.sqrt(5) / 3;
1537
- const dd = Math.sqrt(dx * dx + dy * dy);
1538
- dx /= dd;
1539
- dy /= dd;
1540
- const ang = 2 * Math.PI / 6;
1541
- return [
1542
- new Quat(Math.cos(ang), dx * Math.sin(ang), dy * Math.sin(ang), 0),
1543
- new Quat(Math.cos(ang), -dx * Math.sin(ang), dy * Math.sin(ang), 0)
1544
- ];
1545
- }
1546
- function octahedron() {
1547
- const s5 = Math.sqrt(0.5);
1548
- return [new Quat(0.5, 0.5, 0.5, 0.5), new Quat(s5, 0, 0, s5)];
1549
- }
1550
- function closure(g) {
1551
- const q = [new Quat(1, 0, 0, 0)];
1552
- for (let i = 0; i < q.length; i++) {
1553
- for (let j = 0; j < g.length; j++) {
1554
- const ns = g[j].mul(q[i]);
1555
- const negns = ns.smul(-1);
1556
- let wasseen = false;
1557
- for (let k = 0; k < q.length; k++) {
1558
- if (ns.dist(q[k]) < eps2 || negns.dist(q[k]) < eps2) {
1559
- wasseen = true;
1560
- break;
1561
- }
1562
- }
1563
- if (!wasseen) {
1564
- q.push(ns);
1565
- }
1566
- }
1567
- }
1568
- return q;
1569
- }
1570
- function uniqueplanes(p, g) {
1571
- const planes = [];
1572
- const planerot = [];
1573
- for (let i = 0; i < g.length; i++) {
1574
- const p2 = p.rotateplane(g[i]);
1575
- let wasseen = false;
1576
- for (let j = 0; j < planes.length; j++) {
1577
- if (p2.dist(planes[j]) < eps2) {
1578
- wasseen = true;
1579
- break;
1580
- }
1581
- }
1582
- if (!wasseen) {
1583
- planes.push(p2);
1584
- planerot.push(g[i]);
1585
- }
1586
- }
1587
- return planerot;
1588
- }
1589
- function getface(planes) {
1590
- const face = [];
1591
- for (let i = 1; i < planes.length; i++) {
1592
- for (let j = i + 1; j < planes.length; j++) {
1593
- const p = solvethreeplanes(0, i, j, planes);
1594
- if (p) {
1595
- let wasseen = false;
1596
- for (let k = 0; k < face.length; k++) {
1597
- if (p.dist(face[k]) < eps2) {
1598
- wasseen = true;
1599
- break;
1600
- }
1601
- }
1602
- if (!wasseen) {
1603
- face.push(p);
1604
- }
1605
- }
1606
- }
1607
- }
1608
- for (; ; ) {
1609
- let changed = false;
1610
- for (let i = 0; i < face.length; i++) {
1611
- const j = (i + 1) % face.length;
1612
- if (planes[0].dot(face[i].cross(face[j])) < 0) {
1613
- const t = face[i];
1614
- face[i] = face[j];
1615
- face[j] = t;
1616
- changed = true;
1617
- }
1618
- }
1619
- if (!changed) {
1620
- break;
1621
- }
1622
- }
1623
- return face;
1624
- }
1625
-
1626
- // src/cubing/puzzle-geometry/SchreierSims.ts
1627
- var FactoredNumber = class {
1628
- constructor() {
1629
- this.mult = [];
1630
- }
1631
- multiply(n) {
1632
- for (let f = 2; f * f <= n; f++) {
1633
- while (n % f === 0) {
1634
- if (this.mult[f] !== void 0) {
1635
- this.mult[f]++;
1636
- } else {
1637
- this.mult[f] = 1;
1638
- }
1639
- n /= f;
1640
- }
1641
- }
1642
- if (n > 1) {
1643
- if (this.mult[n] !== void 0) {
1644
- this.mult[n]++;
1645
- } else {
1646
- this.mult[n] = 1;
1647
- }
1648
- }
1649
- }
1650
- toString() {
1651
- let r = "";
1652
- for (let i = 0; i < this.mult.length; i++) {
1653
- if (this.mult[i] !== void 0) {
1654
- if (r !== "") {
1655
- r += "*";
1656
- }
1657
- r += i;
1658
- if (this.mult[i] > 1) {
1659
- r += `^${this.mult[i]}`;
1660
- }
1661
- }
1662
- }
1663
- return r;
1664
- }
1665
- };
1666
- function schreierSims(g, disp) {
1667
- const n = g[0].p.length;
1668
- const e = identity(n);
1669
- let sgs = [];
1670
- let sgsi = [];
1671
- let sgslen = [];
1672
- let Tk = [];
1673
- let Tklen = [];
1674
- function resolve(p) {
1675
- for (let i = p.p.length - 1; i >= 0; i--) {
1676
- const j = p.p[i];
1677
- if (j !== i) {
1678
- if (!sgs[i][j]) {
1679
- return false;
1680
- }
1681
- p = p.mul(sgsi[i][j]);
1682
- }
1683
- }
1684
- return true;
1685
- }
1686
- function knutha(k, p, len) {
1687
- Tk[k].push(p);
1688
- Tklen[k].push(len);
1689
- for (let i = 0; i < sgs[k].length; i++) {
1690
- if (sgs[k][i]) {
1691
- knuthb(k, sgs[k][i].mul(p), len + sgslen[k][i]);
1692
- }
1693
- }
1694
- }
1695
- function knuthb(k, p, len) {
1696
- const j = p.p[k];
1697
- if (!sgs[k][j]) {
1698
- sgs[k][j] = p;
1699
- sgsi[k][j] = p.inv();
1700
- sgslen[k][j] = len;
1701
- for (let i = 0; i < Tk[k].length; i++) {
1702
- knuthb(k, p.mul(Tk[k][i]), len + Tklen[k][i]);
1703
- }
1704
- return;
1705
- }
1706
- const p2 = p.mul(sgsi[k][j]);
1707
- if (!resolve(p2)) {
1708
- knutha(k - 1, p2, len + sgslen[k][j]);
1709
- }
1710
- }
1711
- function getsgs() {
1712
- sgs = [];
1713
- sgsi = [];
1714
- Tk = [];
1715
- sgslen = [];
1716
- Tklen = [];
1717
- for (let i = 0; i < n; i++) {
1718
- sgs.push([]);
1719
- sgsi.push([]);
1720
- sgslen.push([]);
1721
- Tk.push([]);
1722
- Tklen.push([]);
1723
- sgs[i][i] = e;
1724
- sgsi[i][i] = e;
1725
- sgslen[i][i] = 0;
1726
- }
1727
- let none = 0;
1728
- let sz = 1;
1729
- for (let i = 0; i < g.length; i++) {
1730
- knutha(n - 1, g[i], 1);
1731
- sz = 1;
1732
- let tks = 0;
1733
- let sollen = 0;
1734
- const avgs = [];
1735
- const mults = new FactoredNumber();
1736
- for (let j = 0; j < n; j++) {
1737
- let cnt = 0;
1738
- let lensum = 0;
1739
- for (let k = 0; k < n; k++) {
1740
- if (sgs[j][k]) {
1741
- cnt++;
1742
- lensum += sgslen[j][k];
1743
- if (j !== k) {
1744
- none++;
1745
- }
1746
- }
1747
- }
1748
- tks += Tk[j].length;
1749
- sz *= cnt;
1750
- if (cnt > 1) {
1751
- mults.multiply(cnt);
1752
- }
1753
- const avg = lensum / cnt;
1754
- avgs.push(avg);
1755
- sollen += avg;
1756
- }
1757
- disp(`${i}: sz ${sz} T ${tks} sol ${sollen} none ${none} mults ${mults.toString()}`);
1758
- }
1759
- return sz;
1760
- }
1761
- return getsgs();
1762
- }
1763
-
1764
- // src/cubing/puzzle-geometry/PuzzleGeometry.ts
1765
- function tstart(s) {
1766
- return s;
1767
- }
1768
- function tend(_) {
1769
- }
1770
- var Face = class {
1771
- constructor(q) {
1772
- this.coords = new Array(q.length * 3);
1773
- for (let i = 0; i < q.length; i++) {
1774
- this.coords[3 * i] = q[i].b;
1775
- this.coords[3 * i + 1] = q[i].c;
1776
- this.coords[3 * i + 2] = q[i].d;
1777
- }
1778
- this.length = q.length;
1779
- }
1780
- get(off) {
1781
- return new Quat(0, this.coords[3 * off], this.coords[3 * off + 1], this.coords[3 * off + 2]);
1782
- }
1783
- centermass() {
1784
- let sx = 0;
1785
- let sy = 0;
1786
- let sz = 0;
1787
- for (let i = 0; i < this.length; i++) {
1788
- sx += this.coords[3 * i];
1789
- sy += this.coords[3 * i + 1];
1790
- sz += this.coords[3 * i + 2];
1791
- }
1792
- return new Quat(0, sx / this.length, sy / this.length, sz / this.length);
1793
- }
1794
- rotate(q) {
1795
- const a = [];
1796
- for (let i = 0; i < this.length; i++) {
1797
- a.push(this.get(i).rotatepoint(q));
1798
- }
1799
- return new Face(a);
1800
- }
1801
- rotateforward() {
1802
- const a = [];
1803
- for (let i = 1; i < this.length; i++) {
1804
- a.push(this.get(i));
1805
- }
1806
- a.push(this.get(0));
1807
- return new Face(a);
1808
- }
1809
- };
1810
- var FaceTree = class {
1811
- constructor(face, left, right) {
1812
- this.face = face;
1813
- this.left = left;
1814
- this.right = right;
1815
- }
1816
- split(q) {
1817
- const t = q.cutface(this.face);
1818
- if (t !== null) {
1819
- if (this.left === void 0) {
1820
- this.left = new FaceTree(t[0]);
1821
- this.right = new FaceTree(t[1]);
1822
- } else {
1823
- this.left = this.left?.split(q);
1824
- this.right = this.right?.split(q);
1825
- }
1826
- }
1827
- return this;
1828
- }
1829
- collect(arr, leftfirst) {
1830
- if (this.left === void 0) {
1831
- arr.push(new Face(this.face));
1832
- } else if (leftfirst) {
1833
- this.left?.collect(arr, false);
1834
- this.right?.collect(arr, true);
1835
- } else {
1836
- this.right?.collect(arr, false);
1837
- this.left?.collect(arr, true);
1838
- }
1839
- return arr;
1840
- }
1841
- };
1842
- function expandfaces(rots, faces) {
1843
- const nfaces = [];
1844
- for (const rot of rots) {
1845
- for (const face of faces) {
1846
- nfaces.push(face.rotate(rot));
1847
- }
1848
- }
1849
- return nfaces;
1850
- }
1851
- var eps3 = 1e-9;
1852
- var copyright = "PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.";
1853
- var permissivieMoveParsing = false;
1854
- function defaultnets() {
1855
- return {
1856
- 4: [["F", "D", "L", "R"]],
1857
- 6: [
1858
- ["F", "D", "L", "U", "R"],
1859
- ["R", "F", "", "B", ""]
1860
- ],
1861
- 8: [
1862
- ["F", "D", "L", "R"],
1863
- ["D", "F", "BR", ""],
1864
- ["BR", "D", "", "BB"],
1865
- ["BB", "BR", "U", "BL"]
1866
- ],
1867
- 12: [
1868
- ["U", "F", "", "", "", ""],
1869
- ["F", "U", "R", "C", "A", "L"],
1870
- ["R", "F", "", "", "E", ""],
1871
- ["E", "R", "", "BF", "", ""],
1872
- ["BF", "E", "BR", "BL", "I", "D"]
1873
- ],
1874
- 20: [
1875
- ["R", "C", "F", "E"],
1876
- ["F", "R", "L", "U"],
1877
- ["L", "F", "A", ""],
1878
- ["E", "R", "G", "I"],
1879
- ["I", "E", "S", "H"],
1880
- ["S", "I", "J", "B"],
1881
- ["B", "S", "K", "D"],
1882
- ["K", "B", "M", "O"],
1883
- ["O", "K", "P", "N"],
1884
- ["P", "O", "Q", ""]
1885
- ]
1886
- };
1887
- }
1888
- function defaultcolors() {
1889
- return {
1890
- 4: { F: "#00ff00", D: "#ffff00", L: "#ff0000", R: "#0000ff" },
1891
- 6: {
1892
- U: "#ffffff",
1893
- F: "#00ff00",
1894
- R: "#ff0000",
1895
- D: "#ffff00",
1896
- B: "#0000ff",
1897
- L: "#ff8000"
1898
- },
1899
- 8: {
1900
- U: "#ffffff",
1901
- F: "#ff0000",
1902
- R: "#00bb00",
1903
- D: "#ffff00",
1904
- BB: "#1122ff",
1905
- L: "#9524c5",
1906
- BL: "#ff8800",
1907
- BR: "#aaaaaa"
1908
- },
1909
- 12: {
1910
- U: "#ffffff",
1911
- F: "#006633",
1912
- R: "#ff0000",
1913
- C: "#ffffd0",
1914
- A: "#3399ff",
1915
- L: "#660099",
1916
- E: "#ff66cc",
1917
- BF: "#99ff00",
1918
- BR: "#0000ff",
1919
- BL: "#ffff00",
1920
- I: "#ff6633",
1921
- D: "#999999"
1922
- },
1923
- 20: {
1924
- R: "#db69f0",
1925
- C: "#178fde",
1926
- F: "#23238b",
1927
- E: "#9cc726",
1928
- L: "#2c212d",
1929
- U: "#177fa7",
1930
- A: "#e0de7f",
1931
- G: "#2b57c0",
1932
- I: "#41126b",
1933
- S: "#4b8c28",
1934
- H: "#7c098d",
1935
- J: "#7fe7b4",
1936
- B: "#85fb74",
1937
- K: "#3f4bc3",
1938
- D: "#0ff555",
1939
- M: "#f1c2c8",
1940
- O: "#58d340",
1941
- P: "#c514f2",
1942
- N: "#14494e",
1943
- Q: "#8b1be1"
1944
- }
1945
- };
1946
- }
1947
- function defaultfaceorders() {
1948
- return {
1949
- 4: ["F", "D", "L", "R"],
1950
- 6: ["U", "D", "F", "B", "L", "R"],
1951
- 8: ["F", "BB", "D", "U", "BR", "L", "R", "BL"],
1952
- 12: ["L", "E", "F", "BF", "R", "I", "U", "D", "BR", "A", "BL", "C"],
1953
- 20: [
1954
- "L",
1955
- "S",
1956
- "E",
1957
- "O",
1958
- "F",
1959
- "B",
1960
- "I",
1961
- "P",
1962
- "R",
1963
- "K",
1964
- "U",
1965
- "D",
1966
- "J",
1967
- "A",
1968
- "Q",
1969
- "H",
1970
- "G",
1971
- "N",
1972
- "M",
1973
- "C"
1974
- ]
1975
- };
1976
- }
1977
- function defaultOrientations() {
1978
- return {
1979
- 4: [
1980
- ["FLR", [0, 1, 0]],
1981
- ["F", [0, 0, 1]]
1982
- ],
1983
- 6: [
1984
- ["U", [0, 1, 0]],
1985
- ["F", [0, 0, 1]]
1986
- ],
1987
- 8: [
1988
- ["U", [0, 1, 0]],
1989
- ["F", [0, 0, 1]]
1990
- ],
1991
- 12: [
1992
- ["U", [0, 1, 0]],
1993
- ["F", [0, 0, 1]]
1994
- ],
1995
- 20: [
1996
- ["GUQMJ", [0, 1, 0]],
1997
- ["F", [0, 0, 1]]
1998
- ]
1999
- };
2000
- }
2001
- function findelement(a, p) {
2002
- for (let i = 0; i < a.length; i++) {
2003
- if (a[i][0].dist(p) < eps3) {
2004
- return i;
2005
- }
2006
- }
2007
- throw new Error("Element not found");
2008
- }
2009
- function getpuzzles() {
2010
- return PGPuzzles;
2011
- }
2012
- function getpuzzle(puzzleName) {
2013
- return PGPuzzles[puzzleName];
2014
- }
2015
- function parsePuzzleDescription(s) {
2016
- const a = s.split(/ /).filter(Boolean);
2017
- if (a.length % 2 === 0) {
2018
- return null;
2019
- }
2020
- const shape = a[0];
2021
- if (shape !== "o" && shape !== "c" && shape !== "i" && shape !== "d" && shape !== "t") {
2022
- return null;
2023
- }
2024
- const cuts = [];
2025
- for (let i = 1; i < a.length; i += 2) {
2026
- if (a[i] !== "f" && a[i] !== "v" && a[i] !== "e") {
2027
- return null;
2028
- }
2029
- cuts.push({ cutType: a[i], distance: parseFloat(a[i + 1]) });
2030
- }
2031
- return { shape, cuts };
2032
- }
2033
- function getPuzzleGeometryByDesc(desc, options = {}) {
2034
- const parsed = parsePuzzleDescription(desc);
2035
- if (parsed === null) {
2036
- throw new Error("Could not parse the puzzle description");
2037
- }
2038
- const pg = new PuzzleGeometry(parsed, Object.assign({}, { allMoves: true }, options));
2039
- pg.allstickers();
2040
- pg.genperms();
2041
- return pg;
2042
- }
2043
- function getPuzzleGeometryByName(puzzleName, options) {
2044
- return getPuzzleGeometryByDesc(PGPuzzles[puzzleName], options);
2045
- }
2046
- function getmovename(geo, bits, slices) {
2047
- let inverted = false;
2048
- if (slices - bits[1] < bits[0]) {
2049
- geo = [geo[2], geo[3], geo[0], geo[1]];
2050
- bits = [slices - bits[1], slices - bits[0]];
2051
- inverted = true;
2052
- }
2053
- let movenameFamily = geo[0];
2054
- let movenamePrefix = "";
2055
- if (bits[0] === 0 && bits[1] === slices) {
2056
- movenameFamily = movenameFamily + "v";
2057
- } else if (bits[0] === bits[1]) {
2058
- if (bits[1] > 0) {
2059
- movenamePrefix = String(bits[1] + 1);
2060
- }
2061
- } else if (bits[0] === 0) {
2062
- movenameFamily = movenameFamily.toLowerCase();
2063
- if (bits[1] > 1) {
2064
- movenamePrefix = String(bits[1] + 1);
2065
- }
2066
- } else {
2067
- throw `We only support slice and outer block moves right now. ${bits}`;
2068
- }
2069
- return [movenamePrefix + movenameFamily, inverted];
2070
- }
2071
- function splitByFaceNames(s, facenames) {
2072
- const r = [];
2073
- let at = 0;
2074
- while (at < s.length) {
2075
- if (at > 0 && at < s.length && s[at] === "_") {
2076
- at++;
2077
- }
2078
- let currentMatch = "";
2079
- for (const facename of facenames) {
2080
- if (s.substr(at).startsWith(facename[1]) && facename[1].length > currentMatch.length) {
2081
- currentMatch = facename[1];
2082
- }
2083
- }
2084
- if (currentMatch !== "") {
2085
- r.push(currentMatch);
2086
- at += currentMatch.length;
2087
- } else {
2088
- throw new Error("Could not split " + s + " into face names.");
2089
- }
2090
- }
2091
- return r;
2092
- }
2093
- function toCoords(q, maxdist) {
2094
- return [q.b / maxdist, -q.c / maxdist, q.d / maxdist];
2095
- }
2096
- function toFaceCoords(q, maxdist) {
2097
- const r = [];
2098
- const n = q.length;
2099
- for (let i = 0; i < n; i++) {
2100
- const pt = toCoords(q.get(n - i - 1), maxdist);
2101
- r[3 * i] = pt[0];
2102
- r[3 * i + 1] = pt[1];
2103
- r[3 * i + 2] = pt[2];
2104
- }
2105
- return r;
2106
- }
2107
- var PuzzleGeometry = class {
2108
- constructor(puzzleDescription, options) {
2109
- this.cmovesbyslice = [];
2110
- this.duplicatedFaces = [];
2111
- this.duplicatedCubies = [];
2112
- this.fixedCubie = -1;
2113
- this.net = [];
2114
- this.colors = [];
2115
- this.faceorder = [];
2116
- this.faceprecedence = [];
2117
- this.notationMapper = new NullMapper();
2118
- this.addNotationMapper = "";
2119
- this.setReidOrder = false;
2120
- const t1 = tstart("genperms");
2121
- this.options = new PuzzleGeometryFullOptions(options);
2122
- if (this.options.verbosity > 0) {
2123
- console.log(this.header("# "));
2124
- }
2125
- this.create(puzzleDescription);
2126
- tend(t1);
2127
- }
2128
- create(puzzleDescription) {
2129
- const { shape, cuts } = puzzleDescription;
2130
- this.moveplanes = [];
2131
- this.moveplanes2 = [];
2132
- this.faces = [];
2133
- this.cubies = [];
2134
- let g = null;
2135
- switch (shape) {
2136
- case "c":
2137
- g = cube();
2138
- break;
2139
- case "o":
2140
- g = octahedron();
2141
- break;
2142
- case "i":
2143
- g = icosahedron();
2144
- break;
2145
- case "t":
2146
- g = tetrahedron();
2147
- break;
2148
- case "d":
2149
- g = dodecahedron();
2150
- break;
2151
- default:
2152
- throw new Error("Bad shape argument: " + shape);
2153
- }
2154
- this.rotations = closure(g);
2155
- if (this.options.verbosity) {
2156
- console.log("# Rotations: " + this.rotations.length);
2157
- }
2158
- const baseplane = g[0];
2159
- this.baseplanerot = uniqueplanes(baseplane, this.rotations);
2160
- const baseplanes = this.baseplanerot.map((_) => baseplane.rotateplane(_));
2161
- this.baseplanes = baseplanes;
2162
- this.baseFaceCount = baseplanes.length;
2163
- const net = defaultnets()[baseplanes.length];
2164
- this.net = net;
2165
- this.colors = defaultcolors()[baseplanes.length];
2166
- this.faceorder = defaultfaceorders()[baseplanes.length];
2167
- if (this.options.verbosity > 0) {
2168
- console.log("# Base planes: " + baseplanes.length);
2169
- }
2170
- const baseface = getface(baseplanes);
2171
- const zero = new Quat(0, 0, 0, 0);
2172
- if (this.options.verbosity > 0) {
2173
- console.log("# Face vertices: " + baseface.length);
2174
- }
2175
- const facenormal = baseplanes[0].makenormal();
2176
- const edgenormal = baseface[0].sum(baseface[1]).makenormal();
2177
- const vertexnormal = baseface[0].makenormal();
2178
- const boundary = new Quat(1, facenormal.b, facenormal.c, facenormal.d);
2179
- if (this.options.verbosity > 0) {
2180
- console.log("# Boundary is " + boundary);
2181
- }
2182
- const planerot = uniqueplanes(boundary, this.rotations);
2183
- const planes = planerot.map((_) => boundary.rotateplane(_));
2184
- const firstface = getface(planes);
2185
- this.edgedistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);
2186
- this.vertexdistance = firstface[0].dist(zero);
2187
- const cutplanes = [];
2188
- const intersects = [];
2189
- let sawface = false;
2190
- let sawedge = false;
2191
- let sawvertex = false;
2192
- for (const cut of cuts) {
2193
- let normal = null;
2194
- let distance = 0;
2195
- switch (cut.cutType) {
2196
- case "f":
2197
- normal = facenormal;
2198
- distance = 1;
2199
- sawface = true;
2200
- break;
2201
- case "v":
2202
- normal = vertexnormal;
2203
- distance = this.vertexdistance;
2204
- sawvertex = true;
2205
- break;
2206
- case "e":
2207
- normal = edgenormal;
2208
- distance = this.edgedistance;
2209
- sawedge = true;
2210
- break;
2211
- default:
2212
- throw new Error("Bad cut argument: " + cut.cutType);
2213
- }
2214
- cutplanes.push(normal.makecut(cut.distance));
2215
- intersects.push(cut.distance < distance);
2216
- }
2217
- if (this.options.addRotations) {
2218
- if (!sawface) {
2219
- cutplanes.push(facenormal.makecut(10));
2220
- }
2221
- if (!sawvertex) {
2222
- cutplanes.push(vertexnormal.makecut(10));
2223
- }
2224
- if (!sawedge) {
2225
- cutplanes.push(edgenormal.makecut(10));
2226
- }
2227
- }
2228
- this.basefaces = [];
2229
- for (const baseplanerot of this.baseplanerot) {
2230
- const face = baseplanerot.rotateface(firstface);
2231
- this.basefaces.push(new Face(face));
2232
- }
2233
- const facenames = [];
2234
- const faceplanes = [];
2235
- const vertexnames = [];
2236
- const edgenames = [];
2237
- const edgesperface = firstface.length;
2238
- function searchaddelement(a, p, name) {
2239
- for (const el of a) {
2240
- if (el[0].dist(p) < eps3) {
2241
- el.push(name);
2242
- return;
2243
- }
2244
- }
2245
- a.push([p, name]);
2246
- }
2247
- for (let i = 0; i < this.baseplanerot.length; i++) {
2248
- const face = this.baseplanerot[i].rotateface(firstface);
2249
- for (let j = 0; j < face.length; j++) {
2250
- const jj = (j + 1) % face.length;
2251
- const midpoint = face[j].sum(face[jj]).smul(0.5);
2252
- searchaddelement(edgenames, midpoint, i);
2253
- }
2254
- }
2255
- const otherfaces = [];
2256
- for (let i = 0; i < this.baseplanerot.length; i++) {
2257
- const face = this.baseplanerot[i].rotateface(firstface);
2258
- const facelist = [];
2259
- for (let j = 0; j < face.length; j++) {
2260
- const jj = (j + 1) % face.length;
2261
- const midpoint = face[j].sum(face[jj]).smul(0.5);
2262
- const el = edgenames[findelement(edgenames, midpoint)];
2263
- if (i === el[1]) {
2264
- facelist.push(el[2]);
2265
- } else if (i === el[2]) {
2266
- facelist.push(el[1]);
2267
- } else {
2268
- throw new Error("Could not find edge");
2269
- }
2270
- }
2271
- otherfaces.push(facelist);
2272
- }
2273
- const facenametoindex = {};
2274
- const faceindextoname = [];
2275
- faceindextoname.push(net[0][0]);
2276
- facenametoindex[net[0][0]] = 0;
2277
- faceindextoname[otherfaces[0][0]] = net[0][1];
2278
- facenametoindex[net[0][1]] = otherfaces[0][0];
2279
- for (const neti of net) {
2280
- const f0 = neti[0];
2281
- const fi = facenametoindex[f0];
2282
- if (fi === void 0) {
2283
- throw new Error("Bad edge description; first edge not connected");
2284
- }
2285
- let ii = -1;
2286
- for (let j = 0; j < otherfaces[fi].length; j++) {
2287
- const fn2 = faceindextoname[otherfaces[fi][j]];
2288
- if (fn2 !== void 0 && fn2 === neti[1]) {
2289
- ii = j;
2290
- break;
2291
- }
2292
- }
2293
- if (ii < 0) {
2294
- throw new Error("First element of a net not known");
2295
- }
2296
- for (let j = 2; j < neti.length; j++) {
2297
- if (neti[j] === "") {
2298
- continue;
2299
- }
2300
- const of = otherfaces[fi][(j + ii - 1) % edgesperface];
2301
- const fn2 = faceindextoname[of];
2302
- if (fn2 !== void 0 && fn2 !== neti[j]) {
2303
- throw new Error("Face mismatch in net");
2304
- }
2305
- faceindextoname[of] = neti[j];
2306
- facenametoindex[neti[j]] = of;
2307
- }
2308
- }
2309
- for (let i = 0; i < faceindextoname.length; i++) {
2310
- let found = false;
2311
- for (let j = 0; j < this.faceorder.length; j++) {
2312
- if (faceindextoname[i] === this.faceorder[j]) {
2313
- this.faceprecedence[i] = j;
2314
- found = true;
2315
- break;
2316
- }
2317
- }
2318
- if (!found) {
2319
- throw new Error("Could not find face " + faceindextoname[i] + " in face order list " + this.faceorder);
2320
- }
2321
- }
2322
- for (let i = 0; i < this.baseplanerot.length; i++) {
2323
- const face = this.baseplanerot[i].rotateface(firstface);
2324
- const faceplane = boundary.rotateplane(this.baseplanerot[i]);
2325
- const facename = faceindextoname[i];
2326
- facenames.push([face, facename]);
2327
- faceplanes.push([faceplane, facename]);
2328
- }
2329
- for (let i = 0; i < this.baseplanerot.length; i++) {
2330
- const face = this.baseplanerot[i].rotateface(firstface);
2331
- const facename = faceindextoname[i];
2332
- for (let j = 0; j < face.length; j++) {
2333
- const jj = (j + 1) % face.length;
2334
- const midpoint = face[j].sum(face[jj]).smul(0.5);
2335
- const jjj = (j + 2) % face.length;
2336
- const midpoint2 = face[jj].sum(face[jjj]).smul(0.5);
2337
- const e1 = findelement(edgenames, midpoint);
2338
- const e2 = findelement(edgenames, midpoint2);
2339
- searchaddelement(vertexnames, face[jj], [facename, e2, e1]);
2340
- }
2341
- }
2342
- this.swizzler = new FaceNameSwizzler(facenames.map((_) => _[1]));
2343
- const sep = this.swizzler.prefixFree ? "" : "_";
2344
- for (let i = 0; i < edgenames.length; i++) {
2345
- if (edgenames[i].length !== 3) {
2346
- throw new Error("Bad length in edge names " + edgenames[i]);
2347
- }
2348
- let c1 = faceindextoname[edgenames[i][1]];
2349
- const c2 = faceindextoname[edgenames[i][2]];
2350
- if (this.faceprecedence[edgenames[i][1]] < this.faceprecedence[edgenames[i][2]]) {
2351
- c1 = c1 + sep + c2;
2352
- } else {
2353
- c1 = c2 + sep + c1;
2354
- }
2355
- edgenames[i] = [edgenames[i][0], c1];
2356
- }
2357
- for (let i = 0; i < vertexnames.length; i++) {
2358
- if (vertexnames[i].length < 4) {
2359
- throw new Error("Bad length in vertex names");
2360
- }
2361
- let st = 1;
2362
- for (let j = 2; j < vertexnames[i].length; j++) {
2363
- if (this.faceprecedence[facenametoindex[vertexnames[i][j][0]]] < this.faceprecedence[facenametoindex[vertexnames[i][st][0]]]) {
2364
- st = j;
2365
- }
2366
- }
2367
- let r = "";
2368
- for (let j = 1; j < vertexnames[i].length; j++) {
2369
- if (j === 1) {
2370
- r = vertexnames[i][st][0];
2371
- } else {
2372
- r = r + sep + vertexnames[i][st][0];
2373
- }
2374
- for (let k = 1; k < vertexnames[i].length; k++) {
2375
- if (vertexnames[i][st][1] === vertexnames[i][k][2]) {
2376
- st = k;
2377
- break;
2378
- }
2379
- }
2380
- }
2381
- vertexnames[i] = [vertexnames[i][0], r];
2382
- }
2383
- if (this.options.verbosity > 1) {
2384
- console.log("# Face precedence list: " + this.faceorder.join(" "));
2385
- console.log("# Face names: " + facenames.map((_) => _[1]).join(" "));
2386
- console.log("# Edge names: " + edgenames.map((_) => _[1]).join(" "));
2387
- console.log("# Vertex names: " + vertexnames.map((_) => _[1]).join(" "));
2388
- }
2389
- const geonormals = [];
2390
- for (const faceplane of faceplanes) {
2391
- geonormals.push([faceplane[0].makenormal(), faceplane[1], "f"]);
2392
- }
2393
- for (const edgename of edgenames) {
2394
- geonormals.push([edgename[0].makenormal(), edgename[1], "e"]);
2395
- }
2396
- for (const vertexname of vertexnames) {
2397
- geonormals.push([vertexname[0].makenormal(), vertexname[1], "v"]);
2398
- }
2399
- this.facenames = facenames;
2400
- this.faceplanes = faceplanes;
2401
- this.edgenames = edgenames;
2402
- this.vertexnames = vertexnames;
2403
- this.geonormals = geonormals;
2404
- const geonormalnames = geonormals.map((_) => _[1]);
2405
- this.swizzler.setGripNames(geonormalnames);
2406
- if (this.options.verbosity > 0) {
2407
- console.log("# Distances: face " + 1 + " edge " + this.edgedistance + " vertex " + this.vertexdistance);
2408
- }
2409
- for (let c = 0; c < cutplanes.length; c++) {
2410
- for (const rotation of this.rotations) {
2411
- const q = cutplanes[c].rotateplane(rotation);
2412
- let wasseen = false;
2413
- for (const moveplane of this.moveplanes) {
2414
- if (q.sameplane(moveplane)) {
2415
- wasseen = true;
2416
- break;
2417
- }
2418
- }
2419
- if (!wasseen) {
2420
- this.moveplanes.push(q);
2421
- if (intersects[c]) {
2422
- this.moveplanes2.push(q);
2423
- }
2424
- }
2425
- }
2426
- }
2427
- let ft = new FaceTree(firstface);
2428
- const tar = this.moveplanes2.slice();
2429
- let rval = 31;
2430
- for (let i = 0; i < tar.length; i++) {
2431
- const j = i + Math.floor((tar.length - i) * (rval / 65536));
2432
- ft = ft.split(tar[j]);
2433
- tar[j] = tar[i];
2434
- rval = (rval * 1657 + 101) % 65536;
2435
- }
2436
- const faces = ft.collect([], true);
2437
- this.faces = faces;
2438
- if (this.options.verbosity > 0) {
2439
- console.log("# Faces is now " + faces.length);
2440
- }
2441
- this.stickersperface = faces.length;
2442
- const simplerot = [];
2443
- const cm = centermassface(firstface);
2444
- for (const rotation of this.rotations) {
2445
- const f = rotation.rotateface(firstface);
2446
- if (cm.dist(centermassface(f)) < eps3) {
2447
- simplerot.push(rotation);
2448
- }
2449
- }
2450
- const finished = new Array(faces.length);
2451
- const sortme = [];
2452
- for (let i = 0; i < faces.length; i++) {
2453
- const cm2 = faces[i].centermass();
2454
- sortme.push([cm.dist(cm2), cm2, i]);
2455
- }
2456
- sortme.sort((a, b) => a[0] - b[0]);
2457
- for (let ii = 0; ii < faces.length; ii++) {
2458
- const i = sortme[ii][2];
2459
- if (!finished[i]) {
2460
- finished[i] = true;
2461
- for (const rot of simplerot) {
2462
- const f2 = faces[i].rotate(rot);
2463
- const cm2 = f2.centermass();
2464
- for (let kk = ii + 1; kk < faces.length; kk++) {
2465
- if (sortme[kk][0] - sortme[ii][0] > eps3) {
2466
- break;
2467
- }
2468
- const k = sortme[kk][2];
2469
- if (!finished[k] && cm2.dist(sortme[kk][1]) < eps3) {
2470
- finished[k] = true;
2471
- faces[k] = f2;
2472
- break;
2473
- }
2474
- }
2475
- }
2476
- }
2477
- }
2478
- this.shortedge = 1e99;
2479
- for (const face of faces) {
2480
- for (let j = 0; j < face.length; j++) {
2481
- const k = (j + 1) % face.length;
2482
- const t = face.get(j).dist(face.get(k));
2483
- if (t < this.shortedge) {
2484
- this.shortedge = t;
2485
- }
2486
- }
2487
- }
2488
- if (this.options.verbosity > 0) {
2489
- console.log("# Short edge is " + this.shortedge);
2490
- }
2491
- if (shape === "c" && sawface && !sawedge && !sawvertex) {
2492
- this.addNotationMapper = "NxNxNCubeMapper";
2493
- this.setReidOrder = true;
2494
- }
2495
- if (shape === "c" && sawvertex && !sawface && !sawedge) {
2496
- this.addNotationMapper = "SkewbMapper";
2497
- }
2498
- if (shape === "t" && (sawvertex || sawface) && !sawedge) {
2499
- this.addNotationMapper = "PyraminxOrTetraminxMapper";
2500
- }
2501
- if (shape === "o" && sawface) {
2502
- this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler(["F", "D", "L", "BL", "R", "U", "BR", "B"]));
2503
- if (!sawedge && !sawvertex) {
2504
- this.addNotationMapper = "FTOMapper";
2505
- }
2506
- }
2507
- if (shape === "d" && sawface) {
2508
- this.addNotationMapper = "MegaminxMapper";
2509
- this.notationMapper = new FaceRenamingMapper(this.swizzler, new FaceNameSwizzler([
2510
- "U",
2511
- "F",
2512
- "L",
2513
- "BL",
2514
- "BR",
2515
- "R",
2516
- "FR",
2517
- "FL",
2518
- "DL",
2519
- "B",
2520
- "DR",
2521
- "D"
2522
- ]));
2523
- }
2524
- }
2525
- keyface(face) {
2526
- return this.keyface2(face.centermass());
2527
- }
2528
- keyface2(cm) {
2529
- let s = "";
2530
- const sfcc = String.fromCharCode;
2531
- for (const moveplaneset of this.moveplanesets) {
2532
- if (moveplaneset.length > 0) {
2533
- const dv = cm.dot(moveplaneset[0]);
2534
- let t = 0;
2535
- let b = 1;
2536
- while (b * 2 <= moveplaneset.length) {
2537
- b *= 2;
2538
- }
2539
- for (; b > 0; b >>= 1) {
2540
- if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
2541
- t += b;
2542
- }
2543
- }
2544
- if (t < 47) {
2545
- s = s + sfcc(33 + t);
2546
- } else if (t < 47 + 47 * 47) {
2547
- s = s + sfcc(33 + 47 + Math.floor(t / 47) - 1) + sfcc(33 + t % 47);
2548
- } else if (t < 47 + 47 * 47 + 47 * 47 * 47) {
2549
- s = s + sfcc(33 + 47 + Math.floor((t - 47) / (47 * 47) - 1)) + sfcc(33 + 47 + Math.floor((t - 47) / 47) % 47) + sfcc(33 + t % 47);
2550
- } else {
2551
- throw Error("Too many slices for cubie encoding");
2552
- }
2553
- }
2554
- }
2555
- return s;
2556
- }
2557
- keyface3(face) {
2558
- const cm = face.centermass();
2559
- const r = [];
2560
- for (const moveplaneset of this.moveplanesets) {
2561
- if (moveplaneset.length > 0) {
2562
- const dv = cm.dot(moveplaneset[0]);
2563
- let t = 0;
2564
- let b = 1;
2565
- while (b * 2 <= moveplaneset.length) {
2566
- b *= 2;
2567
- }
2568
- for (; b > 0; b >>= 1) {
2569
- if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
2570
- t += b;
2571
- }
2572
- }
2573
- r.push(t);
2574
- }
2575
- }
2576
- return r;
2577
- }
2578
- findface(cm) {
2579
- const key = this.keyface2(cm);
2580
- const arr = this.facelisthash.get(key);
2581
- if (arr.length === 1) {
2582
- return arr[0];
2583
- }
2584
- for (let i = 0; i + 1 < arr.length; i++) {
2585
- const face2 = this.facelisthash.get(key)[i];
2586
- if (Math.abs(cm.dist(this.facecentermass[face2])) < eps3) {
2587
- return face2;
2588
- }
2589
- }
2590
- return arr[arr.length - 1];
2591
- }
2592
- project2d(facen, edgen, targvec) {
2593
- const face = this.facenames[facen][0];
2594
- const edgen2 = (edgen + 1) % face.length;
2595
- const plane = this.baseplanes[facen];
2596
- let x0 = face[edgen2].sub(face[edgen]);
2597
- const olen = x0.len();
2598
- x0 = x0.normalize();
2599
- const y0 = x0.cross(plane).normalize();
2600
- let delta = targvec[1].sub(targvec[0]);
2601
- const len = delta.len() / olen;
2602
- delta = delta.normalize();
2603
- const cosr = delta.b;
2604
- const sinr = delta.c;
2605
- const x1 = x0.smul(cosr).sub(y0.smul(sinr)).smul(len);
2606
- const y1 = y0.smul(cosr).sum(x0.smul(sinr)).smul(len);
2607
- const off = new Quat(0, targvec[0].b - x1.dot(face[edgen]), targvec[0].c - y1.dot(face[edgen]), 0);
2608
- return [x1, y1, off];
2609
- }
2610
- allstickers() {
2611
- const t1 = tstart("allstickers");
2612
- this.faces = expandfaces(this.baseplanerot, this.faces);
2613
- if (this.options.verbosity > 0) {
2614
- console.log("# Total stickers is now " + this.faces.length);
2615
- }
2616
- this.facecentermass = new Array(this.faces.length);
2617
- for (let i = 0; i < this.faces.length; i++) {
2618
- this.facecentermass[i] = this.faces[i].centermass();
2619
- }
2620
- const moveplanesets = [];
2621
- const moveplanenormals = [];
2622
- for (const q of this.moveplanes) {
2623
- const qnormal = q.makenormal();
2624
- let wasseen = false;
2625
- for (const moveplanenormal of moveplanenormals) {
2626
- if (qnormal.sameplane(moveplanenormal.makenormal())) {
2627
- wasseen = true;
2628
- }
2629
- }
2630
- if (!wasseen) {
2631
- moveplanenormals.push(qnormal);
2632
- moveplanesets.push([]);
2633
- }
2634
- }
2635
- for (const q of this.moveplanes2) {
2636
- const qnormal = q.makenormal();
2637
- for (let j = 0; j < moveplanenormals.length; j++) {
2638
- if (qnormal.sameplane(moveplanenormals[j])) {
2639
- moveplanesets[j].push(q);
2640
- break;
2641
- }
2642
- }
2643
- }
2644
- for (let i = 0; i < moveplanesets.length; i++) {
2645
- const q = moveplanesets[i].map((_) => _.normalizeplane());
2646
- const goodnormal = moveplanenormals[i];
2647
- for (let j = 0; j < q.length; j++) {
2648
- if (q[j].makenormal().dist(goodnormal) > eps3) {
2649
- q[j] = q[j].smul(-1);
2650
- }
2651
- }
2652
- q.sort((a, b) => a.a - b.a);
2653
- moveplanesets[i] = q;
2654
- }
2655
- this.moveplanesets = moveplanesets;
2656
- this.moveplanenormals = moveplanenormals;
2657
- const sizes = moveplanesets.map((_) => _.length);
2658
- if (this.options.verbosity > 0) {
2659
- console.log("# Move plane sets: " + sizes);
2660
- }
2661
- const moverotations = [];
2662
- for (let i = 0; i < moveplanesets.length; i++) {
2663
- moverotations.push([]);
2664
- }
2665
- for (const q of this.rotations) {
2666
- if (Math.abs(Math.abs(q.a) - 1) < eps3) {
2667
- continue;
2668
- }
2669
- const qnormal = q.makenormal();
2670
- for (let j = 0; j < moveplanesets.length; j++) {
2671
- if (qnormal.sameplane(moveplanenormals[j])) {
2672
- moverotations[j].push(q);
2673
- break;
2674
- }
2675
- }
2676
- }
2677
- this.moverotations = moverotations;
2678
- for (let i = 0; i < moverotations.length; i++) {
2679
- const r = moverotations[i];
2680
- const goodnormal = r[0].makenormal();
2681
- for (let j = 0; j < r.length; j++) {
2682
- if (goodnormal.dist(r[j].makenormal()) > eps3) {
2683
- r[j] = r[j].smul(-1);
2684
- }
2685
- }
2686
- r.sort((a, b) => a.angle() - b.angle());
2687
- if (moverotations[i][0].dot(moveplanenormals[i]) < 0) {
2688
- r.reverse();
2689
- }
2690
- }
2691
- const sizes2 = moverotations.map((_) => 1 + _.length);
2692
- this.movesetorders = sizes2;
2693
- const movesetgeos = [];
2694
- let gtype = "?";
2695
- for (let i = 0; i < moveplanesets.length; i++) {
2696
- const p0 = moveplanenormals[i];
2697
- let neg = null;
2698
- let pos = null;
2699
- for (const geonormal of this.geonormals) {
2700
- const d = p0.dot(geonormal[0]);
2701
- if (Math.abs(d - 1) < eps3) {
2702
- pos = [geonormal[1], geonormal[2]];
2703
- gtype = geonormal[2];
2704
- } else if (Math.abs(d + 1) < eps3) {
2705
- neg = [geonormal[1], geonormal[2]];
2706
- gtype = geonormal[2];
2707
- }
2708
- }
2709
- if (pos === null || neg === null) {
2710
- throw new Error("Saw positive or negative sides as null");
2711
- }
2712
- movesetgeos.push([
2713
- pos[0],
2714
- pos[1],
2715
- neg[0],
2716
- neg[1],
2717
- 1 + moveplanesets[i].length
2718
- ]);
2719
- if (this.addNotationMapper === "NxNxNCubeMapper" && gtype === "f") {
2720
- this.notationMapper = new NxNxNCubeMapper(1 + moveplanesets[i].length);
2721
- this.addNotationMapper = "";
2722
- }
2723
- if (this.addNotationMapper === "SkewbMapper" && moveplanesets[0].length === 1) {
2724
- this.notationMapper = new SkewbNotationMapper(this.swizzler);
2725
- this.addNotationMapper = "";
2726
- }
2727
- if (this.addNotationMapper === "PyraminxOrTetraminxMapper") {
2728
- if (moveplanesets[0].length === 2 && moveplanesets[0][0].a === 0.333333333333333 && moveplanesets[0][1].a === 1.66666666666667) {
2729
- this.notationMapper = new PyraminxNotationMapper(this.swizzler);
2730
- this.addNotationMapper = "";
2731
- } else {
2732
- this.notationMapper = new TetraminxNotationMapper(this.swizzler);
2733
- this.addNotationMapper = "";
2734
- }
2735
- }
2736
- if (this.addNotationMapper === "MegaminxMapper" && gtype === "f") {
2737
- if (1 + moveplanesets[i].length === 3) {
2738
- this.notationMapper = new MegaminxScramblingNotationMapper(this.notationMapper);
2739
- }
2740
- this.addNotationMapper = "";
2741
- }
2742
- if (this.addNotationMapper === "FTOMapper" && gtype === "f") {
2743
- if (1 + moveplanesets[i].length === 3) {
2744
- this.notationMapper = new FTONotationMapper(this.notationMapper, this.swizzler);
2745
- }
2746
- this.addNotationMapper = "";
2747
- }
2748
- }
2749
- this.movesetgeos = movesetgeos;
2750
- const facelisthash = new Map();
2751
- const faces = this.faces;
2752
- for (let i = 0; i < faces.length; i++) {
2753
- const face = faces[i];
2754
- const s = this.keyface(face);
2755
- if (!facelisthash.get(s)) {
2756
- facelisthash.set(s, [i]);
2757
- } else {
2758
- const arr = facelisthash.get(s);
2759
- arr.push(i);
2760
- if (arr.length === this.baseFaceCount) {
2761
- if (this.options.verbosity > 0) {
2762
- console.log("# Splitting core.");
2763
- }
2764
- for (let suff = 0; suff < arr.length; suff++) {
2765
- const s2 = s + " " + suff;
2766
- facelisthash.set(s2, [arr[suff]]);
2767
- }
2768
- }
2769
- }
2770
- }
2771
- this.facelisthash = facelisthash;
2772
- if (this.options.verbosity > 0) {
2773
- console.log("# Cubies: " + facelisthash.size);
2774
- }
2775
- const cubies = [];
2776
- const facetocubie = [];
2777
- const facetoord = [];
2778
- for (const facelist of facelisthash.values()) {
2779
- if (facelist.length === this.baseFaceCount) {
2780
- continue;
2781
- }
2782
- if (facelist.length > 1) {
2783
- const cm = facelist.map((_) => faces[_].centermass());
2784
- const cmall = centermassface(cm);
2785
- for (let looplimit = 0; facelist.length > 2; looplimit++) {
2786
- let changed = false;
2787
- for (let i = 0; i < facelist.length; i++) {
2788
- const j = (i + 1) % facelist.length;
2789
- if (cmall.dot(cm[i].cross(cm[j])) < 0) {
2790
- const u = cm[i];
2791
- cm[i] = cm[j];
2792
- cm[j] = u;
2793
- const v = facelist[i];
2794
- facelist[i] = facelist[j];
2795
- facelist[j] = v;
2796
- changed = true;
2797
- }
2798
- }
2799
- if (!changed) {
2800
- break;
2801
- }
2802
- if (looplimit > 1e3) {
2803
- throw new Error("Bad epsilon math; too close to border");
2804
- }
2805
- }
2806
- let mini = 0;
2807
- let minf = facelist[mini];
2808
- for (let i = 1; i < facelist.length; i++) {
2809
- const temp = facelist[i];
2810
- if (this.faceprecedence[this.getfaceindex(temp)] < this.faceprecedence[this.getfaceindex(minf)]) {
2811
- mini = i;
2812
- minf = temp;
2813
- }
2814
- }
2815
- if (mini !== 0) {
2816
- const ofacelist = facelist.slice();
2817
- for (let i = 0; i < facelist.length; i++) {
2818
- facelist[i] = ofacelist[(mini + i) % facelist.length];
2819
- }
2820
- }
2821
- }
2822
- for (let j = 0; j < facelist.length; j++) {
2823
- const k = facelist[j];
2824
- facetocubie[k] = cubies.length;
2825
- facetoord[k] = j;
2826
- }
2827
- cubies.push(facelist);
2828
- }
2829
- this.cubies = cubies;
2830
- this.facetocubie = facetocubie;
2831
- this.facetoord = facetoord;
2832
- const typenames = ["?", "CENTERS", "EDGES", "CORNERS", "C4RNER", "C5RNER"];
2833
- const cubiesetnames = [];
2834
- const cubietypecounts = [0, 0, 0, 0, 0, 0];
2835
- const orbitoris = [];
2836
- const seen = [];
2837
- let cubiesetnum = 0;
2838
- const cubiesetnums = [];
2839
- const cubieordnums = [];
2840
- const cubieords = [];
2841
- const cubievaluemap = [];
2842
- const getcolorkey = (cubienum) => {
2843
- return cubies[cubienum].map((_) => this.getfaceindex(_)).join(" ");
2844
- };
2845
- const cubiesetcubies = [];
2846
- for (let i = 0; i < cubies.length; i++) {
2847
- if (seen[i]) {
2848
- continue;
2849
- }
2850
- const cubie = cubies[i];
2851
- if (cubie.length === 0) {
2852
- continue;
2853
- }
2854
- const cubiekeymap = {};
2855
- let cubievalueid = 0;
2856
- cubieords.push(0);
2857
- cubiesetcubies.push([]);
2858
- const facecnt = cubie.length;
2859
- const typectr = cubietypecounts[facecnt]++;
2860
- let typename = typenames[facecnt];
2861
- if (typename === void 0 || facecnt === this.baseFaceCount) {
2862
- typename = "CORE";
2863
- }
2864
- typename = typename + (typectr === 0 ? "" : typectr + 1);
2865
- cubiesetnames[cubiesetnum] = typename;
2866
- orbitoris[cubiesetnum] = facecnt;
2867
- const queue = [i];
2868
- let qg = 0;
2869
- seen[i] = true;
2870
- while (qg < queue.length) {
2871
- const cind = queue[qg++];
2872
- const cubiecolorkey = getcolorkey(cind);
2873
- if (cubie.length > 1 || cubiekeymap[cubiecolorkey] === void 0) {
2874
- cubiekeymap[cubiecolorkey] = cubievalueid++;
2875
- }
2876
- cubievaluemap[cind] = cubiekeymap[cubiecolorkey];
2877
- cubiesetnums[cind] = cubiesetnum;
2878
- cubiesetcubies[cubiesetnum].push(cind);
2879
- cubieordnums[cind] = cubieords[cubiesetnum]++;
2880
- if (queue.length < this.rotations.length) {
2881
- const cm = this.facecentermass[cubies[cind][0]];
2882
- for (const moverotation of moverotations) {
2883
- const tq = this.facetocubie[this.findface(cm.rotatepoint(moverotation[0]))];
2884
- if (!seen[tq]) {
2885
- queue.push(tq);
2886
- seen[tq] = true;
2887
- }
2888
- }
2889
- }
2890
- }
2891
- cubiesetnum++;
2892
- }
2893
- if (this.setReidOrder && 4 <= this.stickersperface && this.stickersperface <= 9) {
2894
- const reidorder = [
2895
- [
2896
- "UF",
2897
- "UR",
2898
- "UB",
2899
- "UL",
2900
- "DF",
2901
- "DR",
2902
- "DB",
2903
- "DL",
2904
- "FR",
2905
- "FL",
2906
- "BR",
2907
- "BL"
2908
- ],
2909
- ["UFR", "URB", "UBL", "ULF", "DRF", "DFL", "DLB", "DBR"],
2910
- ["U", "L", "F", "R", "B", "D"]
2911
- ];
2912
- const reidmap = {};
2913
- for (const cubie of reidorder) {
2914
- for (let j = 0; j < cubie.length; j++) {
2915
- let mask = 0;
2916
- for (let k = 0; k < cubie[j].length; k++) {
2917
- mask |= 1 << cubie[j].charCodeAt(k) - 65;
2918
- }
2919
- reidmap[mask] = j;
2920
- }
2921
- }
2922
- for (const cubieset of cubiesetcubies) {
2923
- for (const cubienum of cubieset) {
2924
- let mask = 0;
2925
- for (const cubie of cubies[cubienum]) {
2926
- mask |= 1 << this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
2927
- }
2928
- cubieordnums[cubienum] = reidmap[mask];
2929
- }
2930
- }
2931
- }
2932
- this.cubiesetnums = cubiesetnums;
2933
- this.cubieordnums = cubieordnums;
2934
- this.cubiesetnames = cubiesetnames;
2935
- this.cubieords = cubieords;
2936
- this.orbitoris = orbitoris;
2937
- this.cubievaluemap = cubievaluemap;
2938
- this.cubiesetcubies = cubiesetcubies;
2939
- if (this.options.fixedPieceType !== null) {
2940
- for (let i = 0; i < cubies.length; i++) {
2941
- if (this.options.fixedPieceType === "v" && cubies[i].length > 2 || this.options.fixedPieceType === "e" && cubies[i].length === 2 || this.options.fixedPieceType === "f" && cubies[i].length === 1) {
2942
- this.fixedCubie = i;
2943
- break;
2944
- }
2945
- }
2946
- if (this.fixedCubie < 0) {
2947
- throw new Error("Could not find a cubie of type " + this.options.fixedPieceType + " to fix.");
2948
- }
2949
- }
2950
- if (this.options.verbosity > 0) {
2951
- console.log("# Cubie orbit sizes " + cubieords);
2952
- }
2953
- tend(t1);
2954
- }
2955
- unswizzle(mv) {
2956
- const newmv = this.notationMapper.notationToInternal(mv);
2957
- if (newmv === null) {
2958
- return "";
2959
- }
2960
- return this.swizzler.unswizzle(newmv.family);
2961
- }
2962
- stringToBlockMove(mv) {
2963
- const re = RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$");
2964
- const p = mv.match(re);
2965
- if (p === null) {
2966
- throw new Error("Bad move passed " + mv);
2967
- }
2968
- const grip = p[4];
2969
- let loslice = void 0;
2970
- let hislice = void 0;
2971
- if (p[2] !== void 0) {
2972
- if (p[3] === void 0) {
2973
- throw new Error("Missing second number in range");
2974
- }
2975
- loslice = parseInt(p[2], 10);
2976
- }
2977
- if (p[3] !== void 0) {
2978
- hislice = parseInt(p[3], 10);
2979
- }
2980
- let amountstr = "1";
2981
- let amount = 1;
2982
- if (p[5] !== void 0) {
2983
- amountstr = p[5];
2984
- if (amountstr[0] === "'") {
2985
- amountstr = "-" + amountstr.substring(1);
2986
- }
2987
- amount = parseInt(amountstr, 10);
2988
- }
2989
- return new Move(new QuantumMove(grip, hislice, loslice), amount);
2990
- }
2991
- parseMove(move) {
2992
- const bm = this.notationMapper.notationToInternal(move);
2993
- if (bm === null) {
2994
- throw new Error("Bad move " + move.family);
2995
- }
2996
- move = bm;
2997
- let grip = move.family;
2998
- let fullrotation = false;
2999
- if (grip.endsWith("v") && grip[0] <= "Z") {
3000
- if (move.innerLayer !== void 0 || move.outerLayer !== void 0) {
3001
- throw new Error("Cannot use a prefix with full cube rotations");
3002
- }
3003
- grip = grip.slice(0, -1);
3004
- fullrotation = true;
3005
- }
3006
- if (grip.endsWith("w") && grip[0] <= "Z") {
3007
- grip = grip.slice(0, -1).toLowerCase();
3008
- }
3009
- let geo;
3010
- let msi = -1;
3011
- const geoname = this.swizzler.unswizzle(grip);
3012
- let firstgrip = false;
3013
- for (let i = 0; i < this.movesetgeos.length; i++) {
3014
- const g = this.movesetgeos[i];
3015
- if (geoname === g[0]) {
3016
- firstgrip = true;
3017
- geo = g;
3018
- msi = i;
3019
- }
3020
- if (geoname === g[2]) {
3021
- firstgrip = false;
3022
- geo = g;
3023
- msi = i;
3024
- }
3025
- }
3026
- let loslice = 1;
3027
- let hislice = 1;
3028
- if (grip.toUpperCase() !== grip) {
3029
- hislice = 2;
3030
- }
3031
- if (geo === void 0) {
3032
- throw new Error("Bad grip in move " + move.family);
3033
- }
3034
- if (move.outerLayer !== void 0) {
3035
- loslice = move.outerLayer;
3036
- }
3037
- if (move.innerLayer !== void 0) {
3038
- if (move.outerLayer === void 0) {
3039
- hislice = move.innerLayer;
3040
- if (grip <= "Z") {
3041
- loslice = hislice;
3042
- } else {
3043
- loslice = 1;
3044
- }
3045
- } else {
3046
- hislice = move.innerLayer;
3047
- }
3048
- }
3049
- loslice--;
3050
- hislice--;
3051
- if (fullrotation) {
3052
- loslice = 0;
3053
- hislice = this.moveplanesets[msi].length;
3054
- }
3055
- if (loslice < 0 || loslice > this.moveplanesets[msi].length || hislice < 0 || hislice > this.moveplanesets[msi].length) {
3056
- throw new Error("Bad slice spec " + loslice + " " + hislice + " vs " + this.moveplanesets[msi].length);
3057
- }
3058
- if (!permissivieMoveParsing && loslice === 0 && hislice === this.moveplanesets[msi].length && !fullrotation) {
3059
- throw new Error("! full puzzle rotations must be specified with v suffix.");
3060
- }
3061
- return [void 0, msi, loslice, hislice, firstgrip, move.amount];
3062
- }
3063
- parsemove(mv) {
3064
- const r = this.parseMove(this.stringToBlockMove(mv));
3065
- r[0] = mv;
3066
- return r;
3067
- }
3068
- genperms() {
3069
- const t1 = tstart("genperms");
3070
- if (this.cmovesbyslice.length > 0) {
3071
- return;
3072
- }
3073
- const cmovesbyslice = [];
3074
- if (this.options.orientCenters) {
3075
- for (let k = 0; k < this.cubies.length; k++) {
3076
- if (this.cubies[k].length === 1) {
3077
- const kk = this.cubies[k][0];
3078
- const i = this.getfaceindex(kk);
3079
- if (this.basefaces[i].centermass().dist(this.facecentermass[kk]) < eps3) {
3080
- const o = this.basefaces[i].length;
3081
- for (let m = 1; m < o; m++) {
3082
- this.cubies[k].push(this.cubies[k][m - 1]);
3083
- }
3084
- this.duplicatedFaces[kk] = o;
3085
- this.duplicatedCubies[k] = o;
3086
- this.orbitoris[this.cubiesetnums[k]] = o;
3087
- }
3088
- }
3089
- }
3090
- }
3091
- for (let k = 0; k < this.moveplanesets.length; k++) {
3092
- const moveplaneset = this.moveplanesets[k];
3093
- const slicenum = [];
3094
- const slicecnts = [moveplaneset.length + 1, 0];
3095
- let bhi = 1;
3096
- while (bhi * 2 <= moveplaneset.length) {
3097
- bhi *= 2;
3098
- }
3099
- for (let i = 0; i < this.faces.length; i++) {
3100
- let t = 0;
3101
- if (moveplaneset.length > 0) {
3102
- const dv = this.facecentermass[i].dot(moveplaneset[0]);
3103
- for (let b = bhi; b > 0; b >>= 1) {
3104
- if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
3105
- t += b;
3106
- }
3107
- }
3108
- t = moveplaneset.length - t;
3109
- }
3110
- slicenum.push(t);
3111
- while (slicecnts.length <= t) {
3112
- slicecnts.push(0);
3113
- }
3114
- slicecnts[t]++;
3115
- }
3116
- const axiscmoves = new Array(slicecnts.length);
3117
- for (let sc = 0; sc < slicecnts.length; sc++) {
3118
- axiscmoves[sc] = [];
3119
- }
3120
- const cubiedone = [];
3121
- for (let i = 0; i < this.faces.length; i++) {
3122
- if (slicenum[i] < 0) {
3123
- continue;
3124
- }
3125
- const b = [this.facetocubie[i], this.facetoord[i]];
3126
- let cm = this.facecentermass[i];
3127
- const ocm = cm;
3128
- let fi2 = i;
3129
- const sc = slicenum[fi2];
3130
- for (; ; ) {
3131
- slicenum[fi2] = -1;
3132
- const cm2 = cm.rotatepoint(this.moverotations[k][0]);
3133
- if (cm2.dist(ocm) < eps3) {
3134
- break;
3135
- }
3136
- fi2 = this.findface(cm2);
3137
- b.push(this.facetocubie[fi2], this.facetoord[fi2]);
3138
- cm = cm2;
3139
- }
3140
- if (b.length > 2 && this.options.orientCenters && (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)) {
3141
- if (this.facecentermass[i].dist(this.basefaces[this.getfaceindex(i)].centermass()) < eps3) {
3142
- let face1 = this.faces[this.cubies[b[0]][0]];
3143
- for (let ii = 0; ii < b.length; ii += 2) {
3144
- const face0 = this.faces[this.cubies[b[ii]][0]];
3145
- let o = -1;
3146
- for (let jj = 0; jj < face1.length; jj++) {
3147
- if (face0.get(jj).dist(face1.get(0)) < eps3) {
3148
- o = jj;
3149
- break;
3150
- }
3151
- }
3152
- if (o < 0) {
3153
- throw new Error("Couldn't find rotation of center faces; ignoring for now.");
3154
- } else {
3155
- b[ii + 1] = o;
3156
- face1 = face1.rotate(this.moverotations[k][0]);
3157
- }
3158
- }
3159
- }
3160
- }
3161
- if (b.length === 2 && this.options.orientCenters) {
3162
- for (let ii = 1; ii < this.movesetorders[k]; ii++) {
3163
- if (sc === 0) {
3164
- b.push(b[0], ii);
3165
- } else {
3166
- b.push(b[0], (this.movesetorders[k] - ii) % this.movesetorders[k]);
3167
- }
3168
- }
3169
- }
3170
- if (b.length > 2 && !cubiedone[b[0]]) {
3171
- if (b.length !== 2 * this.movesetorders[k]) {
3172
- throw new Error("Bad length in perm gen");
3173
- }
3174
- for (const v of b) {
3175
- axiscmoves[sc].push(v);
3176
- }
3177
- }
3178
- for (let j = 0; j < b.length; j += 2) {
3179
- cubiedone[b[j]] = true;
3180
- }
3181
- }
3182
- for (let kk = 0; kk < axiscmoves.length; kk++) {
3183
- axiscmoves[kk] = axiscmoves[kk].slice();
3184
- }
3185
- cmovesbyslice.push(axiscmoves);
3186
- }
3187
- this.cmovesbyslice = cmovesbyslice;
3188
- if (this.options.moveList) {
3189
- const parsedmovelist = [];
3190
- for (const moveString of this.options.moveList) {
3191
- parsedmovelist.push(this.parsemove(moveString));
3192
- }
3193
- this.parsedmovelist = parsedmovelist;
3194
- }
3195
- this.facelisthash.clear();
3196
- this.facecentermass = [];
3197
- tend(t1);
3198
- }
3199
- getboundarygeometry() {
3200
- return {
3201
- baseplanes: this.baseplanes,
3202
- facenames: this.facenames,
3203
- faceplanes: this.faceplanes,
3204
- vertexnames: this.vertexnames,
3205
- edgenames: this.edgenames,
3206
- geonormals: this.geonormals
3207
- };
3208
- }
3209
- getmovesets(k) {
3210
- const slices = this.moveplanesets[k].length;
3211
- let r = [];
3212
- if (this.parsedmovelist !== void 0) {
3213
- for (const parsedmove of this.parsedmovelist) {
3214
- if (parsedmove[1] !== k) {
3215
- continue;
3216
- }
3217
- if (parsedmove[4]) {
3218
- r.push([parsedmove[2], parsedmove[3]]);
3219
- } else {
3220
- r.push([slices - parsedmove[3], slices - parsedmove[2]]);
3221
- }
3222
- r.push(parsedmove[5]);
3223
- }
3224
- } else if (this.options.vertexMoves && !this.options.allMoves) {
3225
- const msg = this.movesetgeos[k];
3226
- if (msg[1] !== msg[3]) {
3227
- for (let i = 0; i < slices; i++) {
3228
- if (msg[1] !== "v") {
3229
- if (this.options.outerBlockMoves) {
3230
- r.push([i + 1, slices]);
3231
- } else {
3232
- r.push([i + 1]);
3233
- }
3234
- r.push(1);
3235
- } else {
3236
- if (this.options.outerBlockMoves) {
3237
- r.push([0, i]);
3238
- } else {
3239
- r.push([i, i]);
3240
- }
3241
- r.push(1);
3242
- }
3243
- }
3244
- }
3245
- } else {
3246
- for (let i = 0; i <= slices; i++) {
3247
- if (!this.options.allMoves && i + i === slices) {
3248
- continue;
3249
- }
3250
- if (this.options.outerBlockMoves) {
3251
- if (i + i > slices) {
3252
- r.push([i, slices]);
3253
- } else {
3254
- r.push([0, i]);
3255
- }
3256
- } else {
3257
- r.push([i, i]);
3258
- }
3259
- r.push(1);
3260
- }
3261
- }
3262
- if (this.fixedCubie >= 0) {
3263
- const dep = this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[k];
3264
- const newr = [];
3265
- for (let i = 0; i < r.length; i += 2) {
3266
- let o = r[i];
3267
- if (dep >= o[0] && dep <= o[1]) {
3268
- if (o[0] === 0) {
3269
- o = [o[1] + 1, slices];
3270
- } else if (slices === o[1]) {
3271
- o = [0, o[0] - 1];
3272
- } else {
3273
- throw Error("fixed cubie option would disconnect move");
3274
- }
3275
- }
3276
- let found = false;
3277
- for (let j = 0; j < newr.length; j += 2) {
3278
- if (newr[j][0] === o[0] && newr[j][1] === o[1] && newr[j + 1] === r[i + 1]) {
3279
- found = true;
3280
- break;
3281
- }
3282
- }
3283
- if (!found) {
3284
- newr.push(o);
3285
- newr.push(r[i + 1]);
3286
- }
3287
- }
3288
- r = newr;
3289
- }
3290
- return r;
3291
- }
3292
- graybyori(cubie) {
3293
- let ori = this.cubies[cubie].length;
3294
- if (this.duplicatedCubies[cubie]) {
3295
- ori = 1;
3296
- }
3297
- return ori === 1 && (this.options.grayCenters || !this.options.includeCenterOrbits) || ori === 2 && (this.options.grayEdges || !this.options.includeEdgeOrbits) || ori > 2 && (this.options.grayCorners || !this.options.includeCornerOrbits);
3298
- }
3299
- skipbyori(cubie) {
3300
- let ori = this.cubies[cubie].length;
3301
- if (this.duplicatedCubies[cubie]) {
3302
- ori = 1;
3303
- }
3304
- return ori === 1 && !this.options.includeCenterOrbits || ori === 2 && !this.options.includeEdgeOrbits || ori > 2 && !this.options.includeCornerOrbits;
3305
- }
3306
- skipcubie(fi) {
3307
- return this.skipbyori(fi);
3308
- }
3309
- header(comment) {
3310
- return comment + copyright + "\n" + comment + "\n";
3311
- }
3312
- writegap() {
3313
- const os = this.getOrbitsDef(false);
3314
- const r = [];
3315
- const mvs = [];
3316
- for (let i = 0; i < os.moveops.length; i++) {
3317
- let movename = "M_" + externalName(this.notationMapper, os.movenames[i]);
3318
- let doinv = false;
3319
- if (movename[movename.length - 1] === "'") {
3320
- movename = movename.substring(0, movename.length - 1);
3321
- doinv = true;
3322
- }
3323
- mvs.push(movename);
3324
- if (doinv) {
3325
- r.push(movename + ":=" + os.moveops[i].toPerm().inv().toGap() + ";");
3326
- } else {
3327
- r.push(movename + ":=" + os.moveops[i].toPerm().toGap() + ";");
3328
- }
3329
- }
3330
- r.push("Gen:=[");
3331
- r.push(mvs.join(","));
3332
- r.push("];");
3333
- const ip = os.solved.identicalPieces();
3334
- r.push("ip:=[" + ip.map((_) => "[" + _.map((__) => __ + 1).join(",") + "]").join(",") + "];");
3335
- r.push("# Size(Group(Gen));");
3336
- r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));");
3337
- r.push("");
3338
- return this.header("# ") + r.join("\n");
3339
- }
3340
- writeksolve(name = "PuzzleGeometryPuzzle") {
3341
- const od = this.getOrbitsDef(false);
3342
- return this.header("# ") + od.toKsolve(name, this.notationMapper).join("\n");
3343
- }
3344
- writekpuzzle(fortwisty = true, includemoves = true) {
3345
- const od = this.getOrbitsDef(fortwisty, includemoves);
3346
- const r = od.toKPuzzle(includemoves);
3347
- if (!r) {
3348
- throw new Error("Missing definition!");
3349
- }
3350
- r.moveNotation = new PGNotation(this, od);
3351
- return r;
3352
- }
3353
- getMoveFromBits(moverange, amount, inverted, axiscmoves, setmoves, movesetorder) {
3354
- const moveorbits = [];
3355
- const perms = [];
3356
- const oris = [];
3357
- for (const len of this.cubieords) {
3358
- perms.push(iota(len));
3359
- oris.push(zeros(len));
3360
- }
3361
- for (let m = moverange[0]; m <= moverange[1]; m++) {
3362
- const slicecmoves = axiscmoves[m];
3363
- for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {
3364
- const mperm = slicecmoves.slice(j, j + 2 * movesetorder);
3365
- const setnum = this.cubiesetnums[mperm[0]];
3366
- for (let ii = 0; ii < mperm.length; ii += 2) {
3367
- mperm[ii] = this.cubieordnums[mperm[ii]];
3368
- }
3369
- let inc = 2;
3370
- let oinc = 3;
3371
- if (inverted) {
3372
- inc = mperm.length - 2;
3373
- oinc = mperm.length - 1;
3374
- }
3375
- if (perms[setnum] === iota(this.cubieords[setnum])) {
3376
- perms[setnum] = perms[setnum].slice();
3377
- if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
3378
- oris[setnum] = oris[setnum].slice();
3379
- }
3380
- }
3381
- for (let ii = 0; ii < mperm.length; ii += 2) {
3382
- perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];
3383
- if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
3384
- oris[setnum][mperm[ii]] = (mperm[(ii + oinc) % mperm.length] - mperm[(ii + 1) % mperm.length] + 2 * this.orbitoris[setnum]) % this.orbitoris[setnum];
3385
- }
3386
- }
3387
- }
3388
- }
3389
- let lastId = new PGOrbit(iota(24), zeros(24), 1);
3390
- for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
3391
- if (setmoves && !setmoves[ii]) {
3392
- continue;
3393
- }
3394
- if (this.orbitoris[ii] === 1 || this.options.fixedOrientation) {
3395
- if (perms[ii] === iota(lastId.perm.length)) {
3396
- if (perms[ii] !== lastId.perm) {
3397
- lastId = new PGOrbit(perms[ii], oris[ii], 1);
3398
- }
3399
- moveorbits.push(lastId);
3400
- } else {
3401
- moveorbits.push(new PGOrbit(perms[ii], oris[ii], 1));
3402
- }
3403
- } else {
3404
- const no = new Array(oris[ii].length);
3405
- for (let jj = 0; jj < perms[ii].length; jj++) {
3406
- no[jj] = oris[ii][perms[ii][jj]];
3407
- }
3408
- moveorbits.push(new PGOrbit(perms[ii], no, this.orbitoris[ii]));
3409
- }
3410
- }
3411
- let mv = new PGTransform(moveorbits);
3412
- if (amount !== 1) {
3413
- mv = mv.mulScalar(amount);
3414
- }
3415
- return mv;
3416
- }
3417
- omitSet(name) {
3418
- for (const excludedSet of this.options.excludeOrbits) {
3419
- if (excludedSet === name) {
3420
- return true;
3421
- }
3422
- }
3423
- return false;
3424
- }
3425
- diffmvsets(a, b, slices, neg) {
3426
- for (let i = 0; i < a.length; i += 2) {
3427
- let found = false;
3428
- for (let j = 0; !found && j < b.length; j += 2) {
3429
- if (neg) {
3430
- if (a[i][0] + b[j][1] === slices && a[i][1] + b[j][0] === slices && a[i + 1] === b[j + 1]) {
3431
- found = true;
3432
- }
3433
- } else {
3434
- if (a[i][0] === b[j][0] && a[i][1] === b[j][1] && a[i + 1] === b[j + 1]) {
3435
- found = true;
3436
- }
3437
- }
3438
- }
3439
- if (!found) {
3440
- return true;
3441
- }
3442
- }
3443
- return false;
3444
- }
3445
- getOrbitsDef(fortwisty, includemoves = true) {
3446
- const setmoves = [];
3447
- if (fortwisty) {
3448
- for (let i = 0; i < this.cubiesetnames.length; i++) {
3449
- setmoves.push(1);
3450
- }
3451
- }
3452
- const setnames = [];
3453
- const setdefs = [];
3454
- const mps = [];
3455
- const addrot = [];
3456
- for (let k = 0; k < this.moveplanesets.length; k++) {
3457
- const moveset = this.getmovesets(k);
3458
- mps.push(moveset);
3459
- if (this.options.addRotations) {
3460
- addrot.push(1);
3461
- } else {
3462
- addrot.push(0);
3463
- }
3464
- }
3465
- if (this.options.moveList && this.options.addRotations) {
3466
- for (let i = 0; i < this.moverotations.length; i++) {
3467
- addrot[i] = 0;
3468
- }
3469
- for (let k = 0; k < this.moveplanesets.length; k++) {
3470
- for (let i = 0; i < this.moverotations.length; i++) {
3471
- let nn = this.moveplanenormals[k];
3472
- for (let ii = 1; ii * 2 <= this.movesetorders[i]; ii++) {
3473
- nn = nn.rotatepoint(this.moverotations[i][0]);
3474
- if (addrot[i] & ii) {
3475
- continue;
3476
- }
3477
- let found = -1;
3478
- let neg = false;
3479
- for (let j = 0; j < this.moveplanenormals.length; j++) {
3480
- if (nn.dist(this.moveplanenormals[j]) < eps3) {
3481
- found = j;
3482
- break;
3483
- } else if (nn.dist(this.moveplanenormals[j].smul(-1)) < eps3) {
3484
- found = j;
3485
- neg = true;
3486
- break;
3487
- }
3488
- }
3489
- if (found < 0) {
3490
- throw new Error("Could not find rotation");
3491
- }
3492
- const cmp = mps[found];
3493
- if (cmp.length !== mps[k].length || this.moveplanesets[k].length !== this.moveplanesets[found].length || this.diffmvsets(cmp, mps[k], this.moveplanesets[found].length, neg)) {
3494
- addrot[i] |= ii;
3495
- }
3496
- }
3497
- }
3498
- }
3499
- for (let i = 0; i < this.moverotations.length; i++) {
3500
- if (addrot[i] === 0) {
3501
- addrot[i] = 1;
3502
- } else if (addrot[i] === 1) {
3503
- if (this.movesetorders[i] > 3) {
3504
- addrot[i] = 2;
3505
- } else {
3506
- addrot[i] = 0;
3507
- }
3508
- } else if (addrot[i] === 3) {
3509
- addrot[i] = 0;
3510
- } else {
3511
- throw new Error("Impossible addrot val");
3512
- }
3513
- }
3514
- }
3515
- for (let k = 0; k < this.moveplanesets.length; k++) {
3516
- if (addrot[k] !== 0) {
3517
- mps[k].push([0, this.moveplanesets[k].length]);
3518
- mps[k].push(addrot[k]);
3519
- }
3520
- }
3521
- for (let k = 0; k < this.moveplanesets.length; k++) {
3522
- const moveset = mps[k];
3523
- const movesetorder = this.movesetorders[k];
3524
- for (let i = 0; i < moveset.length; i += 2) {
3525
- for (let j = 0; j < i; j += 2) {
3526
- if (moveset[i] === moveset[j] && moveset[i + 1] === moveset[j + 1]) {
3527
- throw new Error("Redundant moves in moveset.");
3528
- }
3529
- }
3530
- }
3531
- const allbits = [];
3532
- for (let i = 0; i < moveset.length; i += 2) {
3533
- for (let j = moveset[i][0]; j <= moveset[i][1]; j++) {
3534
- allbits[j] = 1;
3535
- }
3536
- }
3537
- const axiscmoves = this.cmovesbyslice[k];
3538
- for (let i = 0; i < axiscmoves.length; i++) {
3539
- if (allbits[i] !== 1) {
3540
- continue;
3541
- }
3542
- const slicecmoves = axiscmoves[i];
3543
- for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {
3544
- if (this.skipcubie(slicecmoves[j])) {
3545
- continue;
3546
- }
3547
- const ind = this.cubiesetnums[slicecmoves[j]];
3548
- setmoves[ind] = 1;
3549
- }
3550
- }
3551
- }
3552
- for (let i = 0; i < this.cubiesetnames.length; i++) {
3553
- if (!setmoves[i]) {
3554
- continue;
3555
- }
3556
- if (this.omitSet(this.cubiesetnames[i])) {
3557
- setmoves[i] = 0;
3558
- continue;
3559
- }
3560
- setnames.push(this.cubiesetnames[i]);
3561
- setdefs.push(new PGOrbitDef(this.cubieords[i], this.options.fixedOrientation ? 1 : this.orbitoris[i]));
3562
- }
3563
- const solved = [];
3564
- for (let i = 0; i < this.cubiesetnames.length; i++) {
3565
- if (!setmoves[i]) {
3566
- continue;
3567
- }
3568
- if (this.omitSet(this.cubiesetnames[i])) {
3569
- continue;
3570
- }
3571
- const p = [];
3572
- const o = [];
3573
- for (let j = 0; j < this.cubieords[i]; j++) {
3574
- if (fortwisty) {
3575
- p.push(j);
3576
- } else {
3577
- const cubie = this.cubiesetcubies[i][j];
3578
- p.push(this.cubievaluemap[cubie]);
3579
- }
3580
- o.push(0);
3581
- }
3582
- solved.push(new PGOrbit(p, o, this.options.fixedOrientation ? 1 : this.orbitoris[i]));
3583
- }
3584
- const movenames = [];
3585
- const moves = [];
3586
- if (includemoves) {
3587
- for (let k = 0; k < this.moveplanesets.length; k++) {
3588
- const moveplaneset = this.moveplanesets[k];
3589
- const slices = moveplaneset.length;
3590
- const moveset = mps[k];
3591
- const movesetgeo = this.movesetgeos[k];
3592
- for (let i = 0; i < moveset.length; i += 2) {
3593
- const movebits = moveset[i];
3594
- const mna = getmovename(movesetgeo, movebits, slices);
3595
- const movename = mna[0];
3596
- const inverted = mna[1];
3597
- if (moveset[i + 1] === 1) {
3598
- movenames.push(movename);
3599
- } else {
3600
- movenames.push(movename + moveset[i + 1]);
3601
- }
3602
- const mv = this.getMoveFromBits(movebits, moveset[i + 1], inverted, this.cmovesbyslice[k], setmoves, this.movesetorders[k]);
3603
- moves.push(mv);
3604
- }
3605
- }
3606
- }
3607
- let r = new PGOrbitsDef(setnames, setdefs, new VisibleState(solved), movenames, moves);
3608
- if (this.options.optimizeOrbits) {
3609
- r = r.optimize();
3610
- }
3611
- if (this.options.scrambleAmount !== 0) {
3612
- r.scramble(this.options.scrambleAmount);
3613
- }
3614
- return r;
3615
- }
3616
- getMovesAsPerms() {
3617
- return this.getOrbitsDef(false).moveops.map((_) => _.toPerm());
3618
- }
3619
- showcanon(disp) {
3620
- showcanon(this.getOrbitsDef(false), disp);
3621
- }
3622
- getsolved() {
3623
- const r = [];
3624
- for (let i = 0; i < this.baseFaceCount; i++) {
3625
- for (let j = 0; j < this.stickersperface; j++) {
3626
- r.push(i);
3627
- }
3628
- }
3629
- return new Perm(r);
3630
- }
3631
- getOrientationRotation(desiredRotation) {
3632
- const [feature1name, [x1, y1, z1]] = desiredRotation[0];
3633
- const direction1 = new Quat(0, x1, -y1, z1);
3634
- const [feature2name, [x2, y2, z2]] = desiredRotation[1];
3635
- const direction2 = new Quat(0, x2, -y2, z2);
3636
- let feature1 = null;
3637
- let feature2 = null;
3638
- const feature1geoname = this.swizzler.unswizzle(feature1name);
3639
- const feature2geoname = this.swizzler.unswizzle(feature2name);
3640
- for (const gn of this.geonormals) {
3641
- if (feature1geoname === gn[1]) {
3642
- feature1 = gn[0];
3643
- }
3644
- if (feature2geoname === gn[1]) {
3645
- feature2 = gn[0];
3646
- }
3647
- }
3648
- if (!feature1) {
3649
- throw new Error("Could not find feature " + feature1name);
3650
- }
3651
- if (!feature2) {
3652
- throw new Error("Could not find feature " + feature2name);
3653
- }
3654
- const r1 = feature1.pointrotation(direction1);
3655
- const feature2rot = feature2.rotatepoint(r1);
3656
- const r2 = feature2rot.unproject(direction1).pointrotation(direction2.unproject(direction1));
3657
- return r2.mul(r1);
3658
- }
3659
- getInitial3DRotation() {
3660
- const basefacecount = this.baseFaceCount;
3661
- let orientationDescription = null;
3662
- if (this.options.puzzleOrientation) {
3663
- orientationDescription = this.options.puzzleOrientation;
3664
- } else if (this.options.puzzleOrientations) {
3665
- orientationDescription = this.options.puzzleOrientations[basefacecount];
3666
- }
3667
- if (!orientationDescription) {
3668
- orientationDescription = defaultOrientations()[basefacecount];
3669
- }
3670
- if (!orientationDescription) {
3671
- throw new Error("No default orientation?");
3672
- }
3673
- return this.getOrientationRotation(orientationDescription);
3674
- }
3675
- generate2dmapping(w = 800, h = 500, trim = 10, threed = false, twodshrink = 0.92) {
3676
- w -= 2 * trim;
3677
- h -= 2 * trim;
3678
- function extendedges(a, n) {
3679
- let dx = a[1][0] - a[0][0];
3680
- let dy = a[1][1] - a[0][1];
3681
- const ang = 2 * Math.PI / n;
3682
- const cosa = Math.cos(ang);
3683
- const sina = Math.sin(ang);
3684
- for (let i = 2; i < n; i++) {
3685
- const ndx = dx * cosa + dy * sina;
3686
- dy = dy * cosa - dx * sina;
3687
- dx = ndx;
3688
- a.push([a[i - 1][0] + dx, a[i - 1][1] + dy]);
3689
- }
3690
- }
3691
- this.genperms();
3692
- const boundarygeo = this.getboundarygeometry();
3693
- const face0 = boundarygeo.facenames[0][0];
3694
- const polyn = face0.length;
3695
- const net = this.net;
3696
- if (net === null) {
3697
- throw new Error("No net?");
3698
- }
3699
- const edges = {};
3700
- let minx = 0;
3701
- let miny = 0;
3702
- let maxx = 1;
3703
- let maxy = 0;
3704
- edges[net[0][0]] = [
3705
- [1, 0],
3706
- [0, 0]
3707
- ];
3708
- extendedges(edges[net[0][0]], polyn);
3709
- for (const neti of net) {
3710
- const f0 = neti[0];
3711
- if (!edges[f0]) {
3712
- throw new Error("Bad edge description; first edge not connected.");
3713
- }
3714
- for (let j = 1; j < neti.length; j++) {
3715
- const f1 = neti[j];
3716
- if (f1 === "" || edges[f1]) {
3717
- continue;
3718
- }
3719
- edges[f1] = [edges[f0][j % polyn], edges[f0][(j + polyn - 1) % polyn]];
3720
- extendedges(edges[f1], polyn);
3721
- }
3722
- }
3723
- for (const f in edges) {
3724
- const es = edges[f];
3725
- for (const esi of es) {
3726
- minx = Math.min(minx, esi[0]);
3727
- maxx = Math.max(maxx, esi[0]);
3728
- miny = Math.min(miny, esi[1]);
3729
- maxy = Math.max(maxy, esi[1]);
3730
- }
3731
- }
3732
- const sc = Math.min(w / (maxx - minx), h / (maxy - miny));
3733
- const xoff = 0.5 * (w - sc * (maxx + minx));
3734
- const yoff = 0.5 * (h - sc * (maxy + miny));
3735
- const geos = {};
3736
- const bg = this.getboundarygeometry();
3737
- const edges2 = {};
3738
- const initv = [
3739
- [sc + xoff, yoff],
3740
- [xoff, yoff]
3741
- ];
3742
- edges2[net[0][0]] = initv;
3743
- extendedges(edges2[net[0][0]], polyn);
3744
- geos[this.facenames[0][1]] = this.project2d(0, 0, [
3745
- new Quat(0, initv[0][0], initv[0][1], 0),
3746
- new Quat(0, initv[1][0], initv[1][1], 0)
3747
- ]);
3748
- const connectat = [];
3749
- connectat[0] = 0;
3750
- for (const neti of net) {
3751
- const f0 = neti[0];
3752
- if (!edges2[f0]) {
3753
- throw new Error("Bad edge description; first edge not connected.");
3754
- }
3755
- let gfi = -1;
3756
- for (let j = 0; j < bg.facenames.length; j++) {
3757
- if (f0 === bg.facenames[j][1]) {
3758
- gfi = j;
3759
- break;
3760
- }
3761
- }
3762
- if (gfi < 0) {
3763
- throw new Error("Could not find first face name " + f0);
3764
- }
3765
- const thisface = bg.facenames[gfi][0];
3766
- for (let j = 1; j < neti.length; j++) {
3767
- const f1 = neti[j];
3768
- if (f1 === "" || edges2[f1]) {
3769
- continue;
3770
- }
3771
- edges2[f1] = [
3772
- edges2[f0][j % polyn],
3773
- edges2[f0][(j + polyn - 1) % polyn]
3774
- ];
3775
- extendedges(edges2[f1], polyn);
3776
- const caf0 = connectat[gfi];
3777
- const mp = thisface[(caf0 + j) % polyn].sum(thisface[(caf0 + j + polyn - 1) % polyn]).smul(0.5);
3778
- const epi = findelement(bg.edgenames, mp);
3779
- const edgename = bg.edgenames[epi][1];
3780
- const el = splitByFaceNames(edgename, this.facenames);
3781
- const gf1 = el[f0 === el[0] ? 1 : 0];
3782
- let gf1i = -1;
3783
- for (let k = 0; k < bg.facenames.length; k++) {
3784
- if (gf1 === bg.facenames[k][1]) {
3785
- gf1i = k;
3786
- break;
3787
- }
3788
- }
3789
- if (gf1i < 0) {
3790
- throw new Error("Could not find second face name");
3791
- }
3792
- const otherface = bg.facenames[gf1i][0];
3793
- for (let k = 0; k < otherface.length; k++) {
3794
- const mp2 = otherface[k].sum(otherface[(k + 1) % polyn]).smul(0.5);
3795
- if (mp2.dist(mp) <= eps3) {
3796
- const p1 = edges2[f0][(j + polyn - 1) % polyn];
3797
- const p2 = edges2[f0][j % polyn];
3798
- connectat[gf1i] = k;
3799
- geos[gf1] = this.project2d(gf1i, k, [
3800
- new Quat(0, p2[0], p2[1], 0),
3801
- new Quat(0, p1[0], p1[1], 0)
3802
- ]);
3803
- break;
3804
- }
3805
- }
3806
- }
3807
- }
3808
- let hix = 0;
3809
- let hiy = 0;
3810
- const rot = this.getInitial3DRotation();
3811
- for (let face of this.faces) {
3812
- if (threed) {
3813
- face = face.rotate(rot);
3814
- }
3815
- for (let j = 0; j < face.length; j++) {
3816
- hix = Math.max(hix, Math.abs(face.get(j).b));
3817
- hiy = Math.max(hiy, Math.abs(face.get(j).c));
3818
- }
3819
- }
3820
- const sc2 = Math.min(h / hiy / 2, (w - trim) / hix / 4);
3821
- const mappt2d = (fn, q) => {
3822
- if (threed) {
3823
- q = q.rotatepoint(rot);
3824
- const xoff2 = 0.5 * trim + 0.25 * w;
3825
- const xmul = this.baseplanes[fn].rotateplane(rot).d < 0 ? 1 : -1;
3826
- return [
3827
- trim + w * 0.5 + xmul * (xoff2 - q.b * sc2),
3828
- trim + h * 0.5 + q.c * sc2
3829
- ];
3830
- } else {
3831
- const g = geos[this.facenames[fn][1]];
3832
- return [
3833
- trim + twodshrink * q.dot(g[0]) + g[2].b,
3834
- trim + h - twodshrink * q.dot(g[1]) - g[2].c
3835
- ];
3836
- }
3837
- };
3838
- return mappt2d;
3839
- }
3840
- generatesvg(w = 800, h = 500, trim = 10, threed = false) {
3841
- const mappt2d = this.generate2dmapping(w, h, trim, threed);
3842
- function drawedges(id, pts, color) {
3843
- return '<polygon id="' + id + '" class="sticker" style="fill: ' + color + '" points="' + pts.map((p) => p[0] + " " + p[1]).join(" ") + '"/>\n';
3844
- }
3845
- const pos = this.getsolved();
3846
- const colormap = [];
3847
- const facegeo = [];
3848
- for (let i = 0; i < this.baseFaceCount; i++) {
3849
- colormap[i] = this.colors[this.facenames[i][1]];
3850
- }
3851
- for (let i = 0; i < this.faces.length; i++) {
3852
- const face = this.faces[i];
3853
- const facenum = Math.floor(i / this.stickersperface);
3854
- const fg = [];
3855
- for (let j = 0; j < face.length; j++) {
3856
- fg.push(mappt2d(facenum, face.get(j)));
3857
- }
3858
- facegeo.push(fg);
3859
- }
3860
- const svg = [];
3861
- for (let j = 0; j < this.baseFaceCount; j++) {
3862
- svg.push("<g>");
3863
- svg.push("<title>" + this.facenames[j][1] + "</title>\n");
3864
- for (let ii = 0; ii < this.stickersperface; ii++) {
3865
- const i = j * this.stickersperface + ii;
3866
- const cubie = this.facetocubie[i];
3867
- const cubieori = this.facetoord[i];
3868
- const cubiesetnum = this.cubiesetnums[cubie];
3869
- const cubieord = this.cubieordnums[cubie];
3870
- const color = this.graybyori(cubie) ? "#808080" : colormap[pos.p[i]];
3871
- let id = this.cubiesetnames[cubiesetnum] + "-l" + cubieord + "-o" + cubieori;
3872
- svg.push(drawedges(id, facegeo[i], color));
3873
- if (this.duplicatedFaces[i]) {
3874
- for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
3875
- id = this.cubiesetnames[cubiesetnum] + "-l" + cubieord + "-o" + jj;
3876
- svg.push(drawedges(id, facegeo[i], color));
3877
- }
3878
- }
3879
- }
3880
- svg.push("</g>");
3881
- }
3882
- const html = '<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">\n<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>\n' + svg.join("") + "</svg>";
3883
- return html;
3884
- }
3885
- get3d(options) {
3886
- const stickers = [];
3887
- const rot = this.getInitial3DRotation();
3888
- const faces = [];
3889
- const maxdist = 0.52 * this.basefaces[0].get(0).len();
3890
- for (let i = 0; i < this.basefaces.length; i++) {
3891
- const coords = this.basefaces[i].rotate(rot);
3892
- const name = this.facenames[i][1];
3893
- faces.push({ coords: toFaceCoords(coords, maxdist), name });
3894
- }
3895
- for (let i = 0; i < this.faces.length; i++) {
3896
- const facenum = Math.floor(i / this.stickersperface);
3897
- const cubie = this.facetocubie[i];
3898
- const cubieori = this.facetoord[i];
3899
- const cubiesetnum = this.cubiesetnums[cubie];
3900
- const cubieord = this.cubieordnums[cubie];
3901
- let color = this.graybyori(cubie) ? "#808080" : this.colors[this.facenames[facenum][1]];
3902
- if (options?.stickerColors) {
3903
- color = options.stickerColors[i];
3904
- }
3905
- const coords = this.faces[i].rotate(rot);
3906
- stickers.push({
3907
- coords: toFaceCoords(coords, maxdist),
3908
- color,
3909
- orbit: this.cubiesetnames[cubiesetnum],
3910
- ord: cubieord,
3911
- ori: cubieori,
3912
- face: facenum
3913
- });
3914
- let fcoords = coords;
3915
- if (this.duplicatedFaces[i]) {
3916
- const rotdist = fcoords.length / this.duplicatedFaces[i];
3917
- for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
3918
- for (let k = 0; k < rotdist; k++) {
3919
- fcoords = fcoords.rotateforward();
3920
- }
3921
- stickers.push({
3922
- coords: toFaceCoords(fcoords, maxdist),
3923
- color,
3924
- orbit: this.cubiesetnames[cubiesetnum],
3925
- ord: cubieord,
3926
- ori: jj,
3927
- face: facenum,
3928
- isDup: true
3929
- });
3930
- }
3931
- }
3932
- }
3933
- const grips = [];
3934
- for (let i = 0; i < this.movesetgeos.length; i++) {
3935
- const msg = this.movesetgeos[i];
3936
- const order = this.movesetorders[i];
3937
- for (const gn of this.geonormals) {
3938
- if (msg[0] === gn[1] && msg[1] === gn[2]) {
3939
- grips.push({
3940
- coordinates: toCoords(gn[0].rotatepoint(rot), 1),
3941
- quantumMove: new Move(msg[0]),
3942
- order
3943
- });
3944
- grips.push({
3945
- coordinates: toCoords(gn[0].rotatepoint(rot).smul(-1), 1),
3946
- quantumMove: new Move(msg[2]),
3947
- order
3948
- });
3949
- }
3950
- }
3951
- }
3952
- const twodmapper = this.generate2dmapping(2880, 2160, 0, false, 1);
3953
- const g = function() {
3954
- const irot = rot.invrot();
3955
- return function(facenum, coords) {
3956
- let q = new Quat(0, coords[0] * maxdist, -coords[1] * maxdist, coords[2] * maxdist);
3957
- q = q.rotatepoint(irot);
3958
- const x = twodmapper(facenum, q);
3959
- x[0] /= 2880;
3960
- x[1] = 1 - x[1] / 2160;
3961
- return x;
3962
- };
3963
- }().bind(this);
3964
- return {
3965
- stickers,
3966
- faces,
3967
- axis: grips,
3968
- unswizzle: this.unswizzle.bind(this),
3969
- notationMapper: this.notationMapper,
3970
- textureMapper: { getuv: g }
3971
- };
3972
- }
3973
- getGeoNormal(geoname) {
3974
- const rot = this.getInitial3DRotation();
3975
- const grip = this.swizzler.unswizzle(geoname);
3976
- for (const gn of this.geonormals) {
3977
- if (grip === gn[1]) {
3978
- const r = toCoords(gn[0].rotatepoint(rot), 1);
3979
- if (Math.abs(r[0]) < eps3 && Math.abs(r[2]) < eps3) {
3980
- r[0] = 0;
3981
- r[2] = 1e-6;
3982
- }
3983
- return r;
3984
- }
3985
- }
3986
- return void 0;
3987
- }
3988
- getfaceindex(facenum) {
3989
- const divid = this.stickersperface;
3990
- return Math.floor(facenum / divid);
3991
- }
3992
- textForTwizzleExplorer() {
3993
- return `Faces ${this.baseplanerot.length}
3994
- Stickers per face ${this.stickersperface}
3995
- Short edge ${this.shortedge}
3996
- Cubies ${this.cubies.length}
3997
- Edge distance ${this.edgedistance}
3998
- Vertex distance ${this.vertexdistance}`;
3999
- }
4000
- writeSchreierSims(tw) {
4001
- const os = this.getOrbitsDef(false);
4002
- const as = os.reassemblySize();
4003
- tw(`Reassembly size is ${as}`);
4004
- const ss = schreierSims(this.getMovesAsPerms(), tw);
4005
- const r = as / ss;
4006
- tw(`Ratio is ${r}`);
4007
- }
4008
- };
4009
- var PGNotation = class {
4010
- constructor(pg, od) {
4011
- this.pg = pg;
4012
- this.cache = {};
4013
- this.orbitNames = od.orbitnames;
4014
- }
4015
- lookupMove(move) {
4016
- const key = this.moveToKeyString(move);
4017
- if (key in this.cache) {
4018
- return this.cache[key];
4019
- }
4020
- const mv = this.pg.parseMove(move);
4021
- if (this.pg.parsedmovelist) {
4022
- let found = false;
4023
- for (const parsedmove of this.pg.parsedmovelist) {
4024
- if (parsedmove[1] === mv[1] && parsedmove[2] === mv[2] && parsedmove[3] === mv[3] && parsedmove[4] === mv[4]) {
4025
- found = true;
4026
- }
4027
- }
4028
- if (!found) {
4029
- return void 0;
4030
- }
4031
- }
4032
- let bits = [mv[2], mv[3]];
4033
- if (!mv[4]) {
4034
- const slices = this.pg.moveplanesets[mv[1]].length;
4035
- bits = [slices - mv[3], slices - mv[2]];
4036
- }
4037
- const pgmv = this.pg.getMoveFromBits(bits, mv[5], !mv[4], this.pg.cmovesbyslice[mv[1]], void 0, this.pg.movesetorders[mv[1]]);
4038
- const r = PGOrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
4039
- this.cache[key] = r;
4040
- return r;
4041
- }
4042
- moveToKeyString(move) {
4043
- let r = "";
4044
- if (move.outerLayer) {
4045
- r = r + move.outerLayer + ",";
4046
- }
4047
- if (move.innerLayer) {
4048
- r = r + move.innerLayer + ",";
4049
- }
4050
- r = r + move.family + "," + move.amount;
4051
- return r;
4052
- }
4053
- };
4054
15
  export {
16
+ PGNotation as ExperimentalPGNotation,
4055
17
  PuzzleGeometry,
4056
18
  Quat,
19
+ getPG3DNamedPuzzles,
20
+ getPuzzleDescriptionString,
4057
21
  getPuzzleGeometryByDesc,
4058
22
  getPuzzleGeometryByName,
4059
- getpuzzle,
4060
- getpuzzles,
4061
23
  parseOptions,
4062
24
  parsePuzzleDescription,
4063
25
  schreierSims