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,3009 +0,0 @@
1
- import { Move, QuantumMove } from "../alg";
2
- import { FaceNameSwizzler } from "./FaceNameSwizzler";
3
- import type { MoveNotation } from "./interfaces";
4
- import {
5
- FaceRenamingMapper,
6
- FTONotationMapper,
7
- MegaminxScramblingNotationMapper,
8
- NotationMapper,
9
- NullMapper,
10
- NxNxNCubeMapper,
11
- PyraminxNotationMapper,
12
- SkewbNotationMapper,
13
- TetraminxNotationMapper,
14
- } from "./notation-mapping";
15
- import {
16
- BaseFaceCount,
17
- FaceBasedOrientationDescription,
18
- FaceBasedOrientationDescriptionLookup,
19
- PuzzleGeometryOptions,
20
- PuzzleGeometryFullOptions,
21
- } from "./Options";
22
- import { iota, Perm, zeros } from "./Perm";
23
- import {
24
- externalName,
25
- PGOrbit,
26
- PGOrbitDef,
27
- PGOrbitsDef,
28
- showcanon,
29
- PGTransform,
30
- VisibleState,
31
- } from "./PermOriSet";
32
- import { PGPuzzles, PuzzleDescriptionString, PuzzleName } from "./PGPuzzles";
33
- import {
34
- closure,
35
- cube,
36
- dodecahedron,
37
- getface,
38
- icosahedron,
39
- octahedron,
40
- tetrahedron,
41
- uniqueplanes,
42
- } from "./PlatonicGenerator";
43
- import { centermassface, Quat } from "./Quat";
44
- import { schreierSims } from "./SchreierSims";
45
- import type {
46
- KPuzzleDefinition,
47
- Transformation as KTransformation,
48
- } from "../kpuzzle";
49
-
50
- export interface TextureMapper {
51
- getuv(fn: number, threed: number[]): number[];
52
- }
53
-
54
- export interface StickerDatSticker {
55
- coords: number[];
56
- color: string;
57
- orbit: string;
58
- ord: number;
59
- ori: number;
60
- face: number;
61
- isDup?: boolean;
62
- }
63
-
64
- export interface StickerDatFace {
65
- coords: number[];
66
- name: string;
67
- }
68
-
69
- export type StickerDatAxis = {
70
- coordinates: number[];
71
- quantumMove: Move;
72
- order: number;
73
- };
74
-
75
- export interface StickerDat {
76
- stickers: StickerDatSticker[];
77
- faces: StickerDatFace[];
78
- axis: StickerDatAxis[];
79
- unswizzle(mv: Move): string;
80
- notationMapper: NotationMapper;
81
- textureMapper: TextureMapper;
82
- }
83
-
84
- // you can fill these in to help with timing if you want
85
- function tstart(s: string): string {
86
- return s;
87
- }
88
-
89
- function tend(_: string): void {}
90
-
91
- class Face {
92
- private coords: number[];
93
- public length: number;
94
- constructor(q: Quat[]) {
95
- this.coords = new Array(q.length * 3);
96
- for (let i = 0; i < q.length; i++) {
97
- this.coords[3 * i] = q[i].b;
98
- this.coords[3 * i + 1] = q[i].c;
99
- this.coords[3 * i + 2] = q[i].d;
100
- }
101
- this.length = q.length;
102
- }
103
-
104
- get(off: number): Quat {
105
- return new Quat(
106
- 0,
107
- this.coords[3 * off],
108
- this.coords[3 * off + 1],
109
- this.coords[3 * off + 2],
110
- );
111
- }
112
-
113
- centermass(): Quat {
114
- let sx = 0;
115
- let sy = 0;
116
- let sz = 0;
117
- for (let i = 0; i < this.length; i++) {
118
- sx += this.coords[3 * i];
119
- sy += this.coords[3 * i + 1];
120
- sz += this.coords[3 * i + 2];
121
- }
122
- return new Quat(0, sx / this.length, sy / this.length, sz / this.length);
123
- }
124
-
125
- rotate(q: Quat): Face {
126
- const a = [];
127
- for (let i = 0; i < this.length; i++) {
128
- a.push(this.get(i).rotatepoint(q));
129
- }
130
- return new Face(a);
131
- }
132
-
133
- rotateforward(): Face {
134
- const a = [];
135
- for (let i = 1; i < this.length; i++) {
136
- a.push(this.get(i));
137
- }
138
- a.push(this.get(0));
139
- return new Face(a);
140
- }
141
- }
142
-
143
- export class FaceTree {
144
- constructor(
145
- private face: Quat[],
146
- private left?: FaceTree,
147
- private right?: FaceTree,
148
- ) {}
149
-
150
- public split(q: Quat): FaceTree {
151
- const t = q.cutface(this.face);
152
- if (t !== null) {
153
- if (this.left === undefined) {
154
- this.left = new FaceTree(t[0]);
155
- this.right = new FaceTree(t[1]);
156
- } else {
157
- this.left = this.left?.split(q);
158
- this.right = this.right?.split(q);
159
- }
160
- }
161
- return this;
162
- }
163
-
164
- public collect(arr: Face[], leftfirst: boolean): Face[] {
165
- if (this.left === undefined) {
166
- arr.push(new Face(this.face));
167
- } else if (leftfirst) {
168
- this.left?.collect(arr, false);
169
- this.right?.collect(arr, true);
170
- } else {
171
- this.right?.collect(arr, false);
172
- this.left?.collect(arr, true);
173
- }
174
- return arr;
175
- }
176
- }
177
-
178
- export function expandfaces(rots: Quat[], faces: Face[]): Face[] {
179
- // given a set of faces, expand by rotation set
180
- const nfaces = [];
181
- for (const rot of rots) {
182
- for (const face of faces) {
183
- nfaces.push(face.rotate(rot));
184
- }
185
- }
186
- return nfaces;
187
- }
188
-
189
- // Now we have a geometry class that does the 3D goemetry to calculate
190
- // individual sticker information from a Platonic solid and a set of
191
- // cuts. The cuts must have the same symmetry as the Platonic solid;
192
- // we even restrict them further to be either vertex-normal,
193
- // edge-normal, or face-parallel cuts. Right now our constructor takes
194
- // a character solid indicator (one of c(ube), o(ctahedron), i(cosahedron),
195
- // t(etradron), or d(odecahedron), followed by an array of cuts.
196
- // Each cut is a character normal indicator that is either f(ace),
197
- // e(dge), or v(ertex), followed by a floating point value that gives
198
- // the depth of the cut where 0 is the center and 1 is the outside
199
- // border of the shape in that direction.
200
-
201
- // This is a heavyweight class with lots of members and construction
202
- // is slow. Be gentle.
203
-
204
- // Everything except a very few methods should be considered private.
205
-
206
- const eps: number = 1e-9;
207
- const copyright = "PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.";
208
- const permissivieMoveParsing = false;
209
-
210
- // This is a description of the nets and the external names we give each
211
- // face. The names should be a set of prefix-free upper-case alphabetics
212
- // so
213
- // we can easily also name and distinguish vertices and edges, but we
214
- // may change this in the future. The nets consist of a list of lists.
215
- // Each list gives the name of a face, and then the names of the
216
- // faces connected to that face (in the net) in clockwise order.
217
- // The length of each list should be one more than the number of
218
- // edges in the regular polygon for that face. All polygons must
219
- // have the same number of edges.
220
- // The first two faces in the first list must describe a horizontal edge
221
- // that is at the bottom of a regular polygon. The first two faces in
222
- // every subsequent list for a given polytope must describe a edge that
223
- // is directly connected in the net and has already been described (this
224
- // sets the location and orientation of the polygon for that face.
225
- // Any edge that is not directly connected in the net should be given
226
- // the empty string as the other face. All faces do not need to have
227
- // a list starting with that face; just enough to describe the full
228
- // connectivity of the net.
229
- //
230
- // TODO: change this back to a const JSON definition.
231
- function defaultnets(): any {
232
- return {
233
- // four faces: tetrahedron
234
- 4: [["F", "D", "L", "R"]],
235
- // six faces: cube
236
- 6: [
237
- ["F", "D", "L", "U", "R"],
238
- ["R", "F", "", "B", ""],
239
- ],
240
- // eight faces: octahedron
241
- 8: [
242
- ["F", "D", "L", "R"],
243
- ["D", "F", "BR", ""],
244
- ["BR", "D", "", "BB"],
245
- ["BB", "BR", "U", "BL"],
246
- ],
247
- // twelve faces: dodecahedron; U/F/R/F/BL/BR from megaminx
248
- 12: [
249
- ["U", "F", "", "", "", ""],
250
- ["F", "U", "R", "C", "A", "L"],
251
- ["R", "F", "", "", "E", ""],
252
- ["E", "R", "", "BF", "", ""],
253
- ["BF", "E", "BR", "BL", "I", "D"],
254
- ],
255
- // twenty faces: icosahedron
256
- 20: [
257
- ["R", "C", "F", "E"],
258
- ["F", "R", "L", "U"],
259
- ["L", "F", "A", ""],
260
- ["E", "R", "G", "I"],
261
- ["I", "E", "S", "H"],
262
- ["S", "I", "J", "B"],
263
- ["B", "S", "K", "D"],
264
- ["K", "B", "M", "O"],
265
- ["O", "K", "P", "N"],
266
- ["P", "O", "Q", ""],
267
- ],
268
- };
269
- }
270
-
271
- // TODO: change this back to a const JSON definition.
272
- function defaultcolors(): any {
273
- return {
274
- // the colors should use the same naming convention as the nets, above.
275
- 4: { F: "#00ff00", D: "#ffff00", L: "#ff0000", R: "#0000ff" },
276
- 6: {
277
- U: "#ffffff",
278
- F: "#00ff00",
279
- R: "#ff0000",
280
- D: "#ffff00",
281
- B: "#0000ff",
282
- L: "#ff8000",
283
- },
284
- 8: {
285
- U: "#ffffff",
286
- F: "#ff0000",
287
- R: "#00bb00",
288
- D: "#ffff00",
289
- BB: "#1122ff",
290
- L: "#9524c5",
291
- BL: "#ff8800",
292
- BR: "#aaaaaa",
293
- },
294
- 12: {
295
- U: "#ffffff",
296
- F: "#006633",
297
- R: "#ff0000",
298
- C: "#ffffd0",
299
- A: "#3399ff",
300
- L: "#660099",
301
- E: "#ff66cc",
302
- BF: "#99ff00",
303
- BR: "#0000ff",
304
- BL: "#ffff00",
305
- I: "#ff6633",
306
- D: "#999999",
307
- },
308
- 20: {
309
- R: "#db69f0",
310
- C: "#178fde",
311
- F: "#23238b",
312
- E: "#9cc726",
313
- L: "#2c212d",
314
- U: "#177fa7",
315
- A: "#e0de7f",
316
- G: "#2b57c0",
317
- I: "#41126b",
318
- S: "#4b8c28",
319
- H: "#7c098d",
320
- J: "#7fe7b4",
321
- B: "#85fb74",
322
- K: "#3f4bc3",
323
- D: "#0ff555",
324
- M: "#f1c2c8",
325
- O: "#58d340",
326
- P: "#c514f2",
327
- N: "#14494e",
328
- Q: "#8b1be1",
329
- },
330
- };
331
- }
332
-
333
- // the default precedence of the faces is given here. This permits
334
- // the orientations to be reasonably predictable. There are tradeoffs;
335
- // some face precedence orders do better things to the edge orientations
336
- // than the corner orientations and some are the opposite.
337
- // TODO: change this back to a const JSON definition.
338
- function defaultfaceorders(): any {
339
- return {
340
- 4: ["F", "D", "L", "R"],
341
- 6: ["U", "D", "F", "B", "L", "R"],
342
- 8: ["F", "BB", "D", "U", "BR", "L", "R", "BL"],
343
- 12: ["L", "E", "F", "BF", "R", "I", "U", "D", "BR", "A", "BL", "C"],
344
- 20: [
345
- "L",
346
- "S",
347
- "E",
348
- "O",
349
- "F",
350
- "B",
351
- "I",
352
- "P",
353
- "R",
354
- "K",
355
- "U",
356
- "D",
357
- "J",
358
- "A",
359
- "Q",
360
- "H",
361
- "G",
362
- "N",
363
- "M",
364
- "C",
365
- ],
366
- };
367
- }
368
-
369
- /*
370
- * Default orientations for the puzzles in 3D space. Can be overridden
371
- * by puzzleOrientation or puzzleOrientations options.
372
- *
373
- * These are defined to have a strong intuitive vertical (y) direction
374
- * since 3D orbital controls need this. In comments, we list the
375
- * preferred initial camera orientation for each puzzle for twizzle;
376
- * this information is explicitly given in the twizzle app file.
377
- */
378
- // TODO: change this back to a const JSON definition.
379
- function defaultOrientations(): FaceBasedOrientationDescriptionLookup {
380
- return {
381
- 4: [
382
- ["FLR", [0, 1, 0]],
383
- ["F", [0, 0, 1]],
384
- ], // FLR towards viewer
385
- 6: [
386
- ["U", [0, 1, 0]],
387
- ["F", [0, 0, 1]],
388
- ], // URF towards viewer
389
- 8: [
390
- ["U", [0, 1, 0]],
391
- ["F", [0, 0, 1]],
392
- ], // FLUR towards viewer
393
- 12: [
394
- ["U", [0, 1, 0]],
395
- ["F", [0, 0, 1]],
396
- ], // F towards viewer
397
- 20: [
398
- ["GUQMJ", [0, 1, 0]],
399
- ["F", [0, 0, 1]],
400
- ], // F towards viewer
401
- };
402
- }
403
-
404
- function findelement(a: Quat[][], p: Quat): number {
405
- // find something in facenames, vertexnames, edgenames
406
- for (let i = 0; i < a.length; i++) {
407
- if (a[i][0].dist(p) < eps) {
408
- return i;
409
- }
410
- }
411
- throw new Error("Element not found");
412
- }
413
-
414
- export function getpuzzles(): { [s: string]: PuzzleDescriptionString } {
415
- // get some simple definitions of basic puzzles
416
- return PGPuzzles;
417
- }
418
-
419
- export function getpuzzle(puzzleName: PuzzleName): PuzzleDescriptionString {
420
- // get some simple definitions of basic puzzles
421
- return PGPuzzles[puzzleName];
422
- }
423
-
424
- export type CutDescription = { cutType: string; distance: number };
425
- export type PuzzleDescription = {
426
- shape: string;
427
- cuts: CutDescription[];
428
- };
429
-
430
- export function parsePuzzleDescription(
431
- s: PuzzleDescriptionString,
432
- ): PuzzleDescription | null {
433
- // parse a text description
434
- const a = s.split(/ /).filter(Boolean);
435
- if (a.length % 2 === 0) {
436
- return null;
437
- }
438
- const shape = a[0];
439
- if (
440
- shape !== "o" &&
441
- shape !== "c" &&
442
- shape !== "i" &&
443
- shape !== "d" &&
444
- shape !== "t"
445
- ) {
446
- return null;
447
- }
448
- const cuts: CutDescription[] = [];
449
- for (let i = 1; i < a.length; i += 2) {
450
- if (a[i] !== "f" && a[i] !== "v" && a[i] !== "e") {
451
- return null;
452
- }
453
- cuts.push({ cutType: a[i], distance: parseFloat(a[i + 1]) });
454
- }
455
- return { shape, cuts };
456
- }
457
-
458
- export function getPuzzleGeometryByDesc(
459
- desc: string,
460
- options: PuzzleGeometryOptions = {},
461
- ): PuzzleGeometry {
462
- const parsed = parsePuzzleDescription(desc);
463
- if (parsed === null) {
464
- throw new Error("Could not parse the puzzle description");
465
- }
466
- const pg = new PuzzleGeometry(
467
- parsed,
468
- Object.assign({}, { allMoves: true } as PuzzleGeometryOptions, options),
469
- );
470
- pg.allstickers();
471
- pg.genperms();
472
- return pg;
473
- }
474
-
475
- export function getPuzzleGeometryByName(
476
- puzzleName: PuzzleName,
477
- options?: PuzzleGeometryOptions,
478
- ): PuzzleGeometry {
479
- return getPuzzleGeometryByDesc(PGPuzzles[puzzleName], options);
480
- }
481
-
482
- function getmovename(
483
- geo: any,
484
- bits: number[],
485
- slices: number,
486
- ): [string, boolean] {
487
- // generate a move name based on bits, slice, and geo
488
- // if the move name is from the opposite face, say so.
489
- // find the face that's turned.
490
- let inverted = false;
491
- if (slices - bits[1] < bits[0]) {
492
- // flip if most of the move is on the other side
493
- geo = [geo[2], geo[3], geo[0], geo[1]];
494
- bits = [slices - bits[1], slices - bits[0]];
495
- inverted = true;
496
- }
497
- let movenameFamily = geo[0] as string;
498
- let movenamePrefix = "";
499
- if (bits[0] === 0 && bits[1] === slices) {
500
- movenameFamily = movenameFamily + "v";
501
- } else if (bits[0] === bits[1]) {
502
- if (bits[1] > 0) {
503
- movenamePrefix = String(bits[1] + 1);
504
- }
505
- } else if (bits[0] === 0) {
506
- movenameFamily = movenameFamily.toLowerCase();
507
- if (bits[1] > 1) {
508
- movenamePrefix = String(bits[1] + 1);
509
- }
510
- } else {
511
- throw `We only support slice and outer block moves right now. ${bits}`;
512
- }
513
- return [movenamePrefix + movenameFamily, inverted];
514
- }
515
-
516
- // split a geometrical element into face names. Do greedy match.
517
- // Permit underscores between names.
518
- function splitByFaceNames(s: string, facenames: [Quat[], string][]): string[] {
519
- const r: string[] = [];
520
- let at = 0;
521
- while (at < s.length) {
522
- if (at > 0 && at < s.length && s[at] === "_") {
523
- at++;
524
- }
525
- let currentMatch = "";
526
- for (const facename of facenames) {
527
- if (
528
- s.substr(at).startsWith(facename[1]) &&
529
- facename[1].length > currentMatch.length
530
- ) {
531
- currentMatch = facename[1];
532
- }
533
- }
534
- if (currentMatch !== "") {
535
- r.push(currentMatch);
536
- at += currentMatch.length;
537
- } else {
538
- throw new Error("Could not split " + s + " into face names.");
539
- }
540
- }
541
- return r;
542
- }
543
-
544
- function toCoords(q: Quat, maxdist: number): number[] {
545
- return [q.b / maxdist, -q.c / maxdist, q.d / maxdist];
546
- }
547
-
548
- function toFaceCoords(q: Face, maxdist: number): number[] {
549
- const r = [];
550
- const n = q.length;
551
- for (let i = 0; i < n; i++) {
552
- const pt = toCoords(q.get(n - i - 1), maxdist);
553
- r[3 * i] = pt[0];
554
- r[3 * i + 1] = pt[1];
555
- r[3 * i + 2] = pt[2];
556
- }
557
- return r;
558
- }
559
-
560
- export class PuzzleGeometry {
561
- private rotations: Quat[]; // all members of the rotation group
562
- public baseplanerot: Quat[]; // unique rotations of the baseplane
563
- private baseplanes: Quat[]; // planes, corresponding to faces
564
- private facenames: [Quat[], string][]; // face names
565
- private faceplanes: [Quat, string][]; // face planes
566
- private edgenames: [Quat, string][]; // edge names
567
- private vertexnames: [Quat, string][]; // vertexnames
568
- private geonormals: [Quat, string, string][]; // all geometric directions, with names and types
569
- private moveplanes: Quat[]; // the planes that split moves
570
- private moveplanes2: Quat[]; // the planes that split moves, filtered
571
- public moveplanesets: Quat[][]; // the move planes, in parallel sets
572
- private moveplanenormals: Quat[]; // one move plane
573
- public movesetorders: number[]; // the order of rotations for each move set
574
- public movesetgeos: [string, string, string, string, number][]; // geometric feature information for move sets
575
- private basefaces: Face[]; // polytope faces before cuts
576
- private faces: Face[]; // all the stickers
577
- private facecentermass: Quat[]; // center of mass of all faces
578
- private baseFaceCount: BaseFaceCount; // number of base faces
579
- public stickersperface: number; // number of stickers per face
580
- public shortedge: number; // number of stickers per face
581
- public cubies: number[][]; // the cubies
582
- private vertexdistance: number; // vertex distance
583
- private edgedistance: number; // edge distance
584
- private facetocubie: number[]; // map a face to a cubie index
585
- private facetoord: number[]; // map a face to a cubie ord
586
- private moverotations: Quat[][]; // move rotations
587
- private facelisthash: Map<string, number[]>; // face list by key
588
- private cubiesetnames: string[]; // cubie set names
589
- private cubieords: number[]; // the size of each orbit
590
- private cubiesetnums: number[];
591
- private cubieordnums: number[];
592
- private orbitoris: number[]; // the orientation size of each orbit
593
- private cubievaluemap: number[]; // the map for identical cubies
594
- private cubiesetcubies: number[][]; // cubies in each cubie set
595
- public cmovesbyslice: number[][][] = []; // cmoves as perms by slice
596
- public parsedmovelist: [
597
- string | undefined,
598
- number,
599
- number,
600
- number,
601
- boolean,
602
- number,
603
- ][]; // parsed move list
604
-
605
- private duplicatedFaces: number[] = []; // which faces are duplicated
606
- private duplicatedCubies: number[] = []; // which cubies are duplicated
607
- private fixedCubie: number = -1; // fixed cubie, if any
608
- private net: string[][] = [];
609
- private colors: any = [];
610
- private faceorder: string[] = [];
611
- private faceprecedence: number[] = [];
612
- private swizzler: FaceNameSwizzler;
613
- public notationMapper: NotationMapper = new NullMapper();
614
- private addNotationMapper: string = "";
615
- private setReidOrder: boolean = false;
616
-
617
- private options: PuzzleGeometryFullOptions;
618
-
619
- constructor(
620
- puzzleDescription: PuzzleDescription,
621
- options: PuzzleGeometryOptions,
622
- ) {
623
- const t1 = tstart("genperms");
624
- this.options = new PuzzleGeometryFullOptions(options);
625
- if (this.options.verbosity > 0) {
626
- console.log(this.header("# "));
627
- }
628
- this.create(puzzleDescription);
629
- tend(t1);
630
- }
631
-
632
- public create(puzzleDescription: PuzzleDescription): void {
633
- const { shape, cuts } = puzzleDescription;
634
-
635
- // create the shape, doing all the essential geometry
636
- // create only goes far enough to figure out how many stickers per
637
- // face, and what the short edge is. If the short edge is too short,
638
- // we probably don't want to display or manipulate this one. How
639
- // short is too short is hard to say.
640
- this.moveplanes = [];
641
- this.moveplanes2 = [];
642
- this.faces = [];
643
- this.cubies = [];
644
- let g = null;
645
- switch (shape) {
646
- case "c":
647
- g = cube();
648
- break;
649
- case "o":
650
- g = octahedron();
651
- break;
652
- case "i":
653
- g = icosahedron();
654
- break;
655
- case "t":
656
- g = tetrahedron();
657
- break;
658
- case "d":
659
- g = dodecahedron();
660
- break;
661
- default:
662
- throw new Error("Bad shape argument: " + shape);
663
- }
664
- this.rotations = closure(g);
665
- if (this.options.verbosity) {
666
- console.log("# Rotations: " + this.rotations.length);
667
- }
668
- const baseplane = g[0];
669
- this.baseplanerot = uniqueplanes(baseplane, this.rotations);
670
- const baseplanes = this.baseplanerot.map((_) => baseplane.rotateplane(_));
671
- this.baseplanes = baseplanes;
672
- this.baseFaceCount = baseplanes.length as BaseFaceCount;
673
- const net = defaultnets()[baseplanes.length];
674
- this.net = net;
675
- this.colors = defaultcolors()[baseplanes.length];
676
- this.faceorder = defaultfaceorders()[baseplanes.length];
677
- if (this.options.verbosity > 0) {
678
- console.log("# Base planes: " + baseplanes.length);
679
- }
680
- const baseface = getface(baseplanes);
681
- const zero = new Quat(0, 0, 0, 0);
682
- if (this.options.verbosity > 0) {
683
- console.log("# Face vertices: " + baseface.length);
684
- }
685
- const facenormal = baseplanes[0].makenormal();
686
- const edgenormal = baseface[0].sum(baseface[1]).makenormal();
687
- const vertexnormal = baseface[0].makenormal();
688
- const boundary = new Quat(1, facenormal.b, facenormal.c, facenormal.d);
689
- if (this.options.verbosity > 0) {
690
- console.log("# Boundary is " + boundary);
691
- }
692
- const planerot = uniqueplanes(boundary, this.rotations);
693
- const planes = planerot.map((_) => boundary.rotateplane(_));
694
- const firstface = getface(planes);
695
- this.edgedistance = firstface[0].sum(firstface[1]).smul(0.5).dist(zero);
696
- this.vertexdistance = firstface[0].dist(zero);
697
- const cutplanes = [];
698
- const intersects = [];
699
- let sawface = false; // what cuts did we see?
700
- let sawedge = false;
701
- let sawvertex = false;
702
- for (const cut of cuts) {
703
- let normal = null;
704
- let distance = 0;
705
- switch (cut.cutType) {
706
- case "f":
707
- normal = facenormal;
708
- distance = 1;
709
- sawface = true;
710
- break;
711
- case "v":
712
- normal = vertexnormal;
713
- distance = this.vertexdistance;
714
- sawvertex = true;
715
- break;
716
- case "e":
717
- normal = edgenormal;
718
- distance = this.edgedistance;
719
- sawedge = true;
720
- break;
721
- default:
722
- throw new Error("Bad cut argument: " + cut.cutType);
723
- }
724
- cutplanes.push(normal.makecut(cut.distance));
725
- intersects.push(cut.distance < distance);
726
- }
727
- if (this.options.addRotations) {
728
- if (!sawface) {
729
- cutplanes.push(facenormal.makecut(10));
730
- }
731
- if (!sawvertex) {
732
- cutplanes.push(vertexnormal.makecut(10));
733
- }
734
- if (!sawedge) {
735
- cutplanes.push(edgenormal.makecut(10));
736
- }
737
- }
738
- this.basefaces = [];
739
- for (const baseplanerot of this.baseplanerot) {
740
- const face = baseplanerot.rotateface(firstface);
741
- this.basefaces.push(new Face(face));
742
- }
743
- //
744
- // Determine names for edges, vertices, and planes. Planes are defined
745
- // by the plane normal/distance; edges are defined by the midpoint;
746
- // vertices are defined by actual point. In each case we define a name.
747
- // Note that edges have two potential names, and corners have n where
748
- // n planes meet at a vertex. We arbitrarily choose the one that is
749
- // alphabetically first (and we will probably want to change this).
750
- //
751
- const facenames: [Quat[], string][] = [];
752
- const faceplanes: [Quat, string][] = [];
753
- const vertexnames: any[] = [];
754
- const edgenames: any[] = [];
755
- const edgesperface = firstface.length;
756
- function searchaddelement(a: any[], p: Quat, name: any): void {
757
- for (const el of a) {
758
- if (el[0].dist(p) < eps) {
759
- el.push(name);
760
- return;
761
- }
762
- }
763
- a.push([p, name]);
764
- }
765
- for (let i = 0; i < this.baseplanerot.length; i++) {
766
- const face = this.baseplanerot[i].rotateface(firstface);
767
- for (let j = 0; j < face.length; j++) {
768
- const jj = (j + 1) % face.length;
769
- const midpoint = face[j].sum(face[jj]).smul(0.5);
770
- searchaddelement(edgenames, midpoint, i);
771
- }
772
- }
773
- const otherfaces = [];
774
- for (let i = 0; i < this.baseplanerot.length; i++) {
775
- const face = this.baseplanerot[i].rotateface(firstface);
776
- const facelist = [];
777
- for (let j = 0; j < face.length; j++) {
778
- const jj = (j + 1) % face.length;
779
- const midpoint = face[j].sum(face[jj]).smul(0.5);
780
- const el = edgenames[findelement(edgenames, midpoint)];
781
- if (i === el[1]) {
782
- facelist.push(el[2]);
783
- } else if (i === el[2]) {
784
- facelist.push(el[1]);
785
- } else {
786
- throw new Error("Could not find edge");
787
- }
788
- }
789
- otherfaces.push(facelist);
790
- }
791
- const facenametoindex: any = {};
792
- const faceindextoname: string[] = [];
793
- faceindextoname.push(net[0][0]);
794
- facenametoindex[net[0][0]] = 0;
795
- faceindextoname[otherfaces[0][0]] = net[0][1];
796
- facenametoindex[net[0][1]] = otherfaces[0][0];
797
- for (const neti of net) {
798
- const f0 = neti[0];
799
- const fi = facenametoindex[f0];
800
- if (fi === undefined) {
801
- throw new Error("Bad edge description; first edge not connected");
802
- }
803
- let ii = -1;
804
- for (let j = 0; j < otherfaces[fi].length; j++) {
805
- const fn2 = faceindextoname[otherfaces[fi][j]];
806
- if (fn2 !== undefined && fn2 === neti[1]) {
807
- ii = j;
808
- break;
809
- }
810
- }
811
- if (ii < 0) {
812
- throw new Error("First element of a net not known");
813
- }
814
- for (let j = 2; j < neti.length; j++) {
815
- if (neti[j] === "") {
816
- continue;
817
- }
818
- const of = otherfaces[fi][(j + ii - 1) % edgesperface];
819
- const fn2 = faceindextoname[of];
820
- if (fn2 !== undefined && fn2 !== neti[j]) {
821
- throw new Error("Face mismatch in net");
822
- }
823
- faceindextoname[of] = neti[j];
824
- facenametoindex[neti[j]] = of;
825
- }
826
- }
827
- for (let i = 0; i < faceindextoname.length; i++) {
828
- let found = false;
829
- for (let j = 0; j < this.faceorder.length; j++) {
830
- if (faceindextoname[i] === this.faceorder[j]) {
831
- this.faceprecedence[i] = j;
832
- found = true;
833
- break;
834
- }
835
- }
836
- if (!found) {
837
- throw new Error(
838
- "Could not find face " +
839
- faceindextoname[i] +
840
- " in face order list " +
841
- this.faceorder,
842
- );
843
- }
844
- }
845
- for (let i = 0; i < this.baseplanerot.length; i++) {
846
- const face = this.baseplanerot[i].rotateface(firstface);
847
- const faceplane = boundary.rotateplane(this.baseplanerot[i]);
848
- const facename = faceindextoname[i];
849
- facenames.push([face, facename]);
850
- faceplanes.push([faceplane, facename]);
851
- }
852
- for (let i = 0; i < this.baseplanerot.length; i++) {
853
- const face = this.baseplanerot[i].rotateface(firstface);
854
- const facename = faceindextoname[i];
855
- for (let j = 0; j < face.length; j++) {
856
- const jj = (j + 1) % face.length;
857
- const midpoint = face[j].sum(face[jj]).smul(0.5);
858
- const jjj = (j + 2) % face.length;
859
- const midpoint2 = face[jj].sum(face[jjj]).smul(0.5);
860
- const e1 = findelement(edgenames, midpoint);
861
- const e2 = findelement(edgenames, midpoint2);
862
- searchaddelement(vertexnames, face[jj], [facename, e2, e1]);
863
- }
864
- }
865
- this.swizzler = new FaceNameSwizzler(facenames.map((_) => _[1]));
866
- const sep = this.swizzler.prefixFree ? "" : "_";
867
- // fix the edge names; use face precedence order
868
- for (let i = 0; i < edgenames.length; i++) {
869
- if (edgenames[i].length !== 3) {
870
- throw new Error("Bad length in edge names " + edgenames[i]);
871
- }
872
- let c1 = faceindextoname[edgenames[i][1]];
873
- const c2 = faceindextoname[edgenames[i][2]];
874
- if (
875
- this.faceprecedence[edgenames[i][1]] <
876
- this.faceprecedence[edgenames[i][2]]
877
- ) {
878
- c1 = c1 + sep + c2;
879
- } else {
880
- c1 = c2 + sep + c1;
881
- }
882
- edgenames[i] = [edgenames[i][0], c1];
883
- }
884
- // fix the vertex names; counterclockwise rotations; low face first.
885
- for (let i = 0; i < vertexnames.length; i++) {
886
- if (vertexnames[i].length < 4) {
887
- throw new Error("Bad length in vertex names");
888
- }
889
- let st = 1;
890
- for (let j = 2; j < vertexnames[i].length; j++) {
891
- if (
892
- this.faceprecedence[facenametoindex[vertexnames[i][j][0]]] <
893
- this.faceprecedence[facenametoindex[vertexnames[i][st][0]]]
894
- ) {
895
- st = j;
896
- }
897
- }
898
- let r = "";
899
- for (let j = 1; j < vertexnames[i].length; j++) {
900
- if (j === 1) {
901
- r = vertexnames[i][st][0];
902
- } else {
903
- r = r + sep + vertexnames[i][st][0];
904
- }
905
- for (let k = 1; k < vertexnames[i].length; k++) {
906
- if (vertexnames[i][st][1] === vertexnames[i][k][2]) {
907
- st = k;
908
- break;
909
- }
910
- }
911
- }
912
- vertexnames[i] = [vertexnames[i][0], r];
913
- }
914
- if (this.options.verbosity > 1) {
915
- console.log("# Face precedence list: " + this.faceorder.join(" "));
916
- console.log("# Face names: " + facenames.map((_) => _[1]).join(" "));
917
- // TODO
918
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
919
- console.log("# Edge names: " + edgenames.map((_) => _[1]).join(" "));
920
- // TODO
921
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
922
- console.log("# Vertex names: " + vertexnames.map((_) => _[1]).join(" "));
923
- }
924
- const geonormals: [Quat, string, string][] = [];
925
- for (const faceplane of faceplanes) {
926
- geonormals.push([faceplane[0].makenormal(), faceplane[1], "f"]);
927
- }
928
- for (const edgename of edgenames) {
929
- geonormals.push([edgename[0].makenormal(), edgename[1], "e"]);
930
- }
931
- for (const vertexname of vertexnames) {
932
- geonormals.push([vertexname[0].makenormal(), vertexname[1], "v"]);
933
- }
934
- this.facenames = facenames;
935
- this.faceplanes = faceplanes;
936
- this.edgenames = edgenames;
937
- this.vertexnames = vertexnames;
938
- this.geonormals = geonormals;
939
- const geonormalnames = geonormals.map((_) => _[1]);
940
- this.swizzler.setGripNames(geonormalnames);
941
- if (this.options.verbosity > 0) {
942
- console.log(
943
- "# Distances: face " +
944
- 1 +
945
- " edge " +
946
- this.edgedistance +
947
- " vertex " +
948
- this.vertexdistance,
949
- );
950
- }
951
- // expand cutplanes by rotations. We only work with one face here.
952
- for (let c = 0; c < cutplanes.length; c++) {
953
- for (const rotation of this.rotations) {
954
- const q = cutplanes[c].rotateplane(rotation);
955
- let wasseen = false;
956
- for (const moveplane of this.moveplanes) {
957
- if (q.sameplane(moveplane)) {
958
- wasseen = true;
959
- break;
960
- }
961
- }
962
- if (!wasseen) {
963
- this.moveplanes.push(q);
964
- if (intersects[c]) {
965
- this.moveplanes2.push(q);
966
- }
967
- }
968
- }
969
- }
970
- let ft = new FaceTree(firstface);
971
- const tar = this.moveplanes2.slice();
972
- // we want to use Math.random() here but we can't, because when
973
- // we call multiple times we'll get different orbits/layouts.
974
- // to resolve this, we use a very simple linear congruential
975
- // generator. for our purposes, the numbers don't need to be
976
- // very random.
977
- let rval = 31;
978
- for (let i = 0; i < tar.length; i++) {
979
- const j = i + Math.floor((tar.length - i) * (rval / 65536.0));
980
- ft = ft.split(tar[j]);
981
- tar[j] = tar[i];
982
- rval = (rval * 1657 + 101) % 65536;
983
- }
984
- const faces = ft.collect([], true);
985
- this.faces = faces;
986
- if (this.options.verbosity > 0) {
987
- console.log("# Faces is now " + faces.length);
988
- }
989
- this.stickersperface = faces.length;
990
- // the faces when rotated don't preserve the vertex order at this
991
- // point. to improve 3d rendering speed, we would like to preserve
992
- // vertex order on rotation. First, let's see what rotations preserve
993
- // the base face; these are the ones we want to work with.
994
- const simplerot: Quat[] = [];
995
- const cm = centermassface(firstface);
996
- for (const rotation of this.rotations) {
997
- const f = rotation.rotateface(firstface);
998
- if (cm.dist(centermassface(f)) < eps) {
999
- simplerot.push(rotation);
1000
- }
1001
- }
1002
- const finished = new Array<boolean>(faces.length);
1003
- const sortme: [number, Quat, number][] = [];
1004
- for (let i = 0; i < faces.length; i++) {
1005
- const cm2 = faces[i].centermass();
1006
- sortme.push([cm.dist(cm2), cm2, i]);
1007
- }
1008
- sortme.sort((a, b) => a[0] - b[0]);
1009
- for (let ii = 0; ii < faces.length; ii++) {
1010
- const i = sortme[ii][2];
1011
- if (!finished[i]) {
1012
- finished[i] = true;
1013
- for (const rot of simplerot) {
1014
- const f2 = faces[i].rotate(rot);
1015
- const cm = f2.centermass();
1016
- for (let kk = ii + 1; kk < faces.length; kk++) {
1017
- if (sortme[kk][0] - sortme[ii][0] > eps) {
1018
- break;
1019
- }
1020
- const k = sortme[kk][2];
1021
- if (!finished[k] && cm.dist(sortme[kk][1]) < eps) {
1022
- finished[k] = true;
1023
- faces[k] = f2;
1024
- break;
1025
- }
1026
- }
1027
- }
1028
- }
1029
- }
1030
- // Find and report the shortest edge in any of the faces. If this
1031
- // is small the puzzle is probably not practical or displayable.
1032
- this.shortedge = 1e99;
1033
- for (const face of faces) {
1034
- for (let j = 0; j < face.length; j++) {
1035
- const k = (j + 1) % face.length;
1036
- const t = face.get(j).dist(face.get(k));
1037
- if (t < this.shortedge) {
1038
- this.shortedge = t;
1039
- }
1040
- }
1041
- }
1042
- if (this.options.verbosity > 0) {
1043
- console.log("# Short edge is " + this.shortedge);
1044
- }
1045
- // add nxnxn cube notation if it has cube face moves
1046
- if (shape === "c" && sawface && !sawedge && !sawvertex) {
1047
- // In this case the mapper adding is deferred until we
1048
- // know the number of slices.
1049
- this.addNotationMapper = "NxNxNCubeMapper";
1050
- // try to set Reid order of the cubies within an orbit
1051
- this.setReidOrder = true;
1052
- }
1053
- if (shape === "c" && sawvertex && !sawface && !sawedge) {
1054
- this.addNotationMapper = "SkewbMapper";
1055
- }
1056
- if (shape === "t" && (sawvertex || sawface) && !sawedge) {
1057
- this.addNotationMapper = "PyraminxOrTetraminxMapper";
1058
- }
1059
- if (shape === "o" && sawface) {
1060
- this.notationMapper = new FaceRenamingMapper(
1061
- this.swizzler,
1062
- new FaceNameSwizzler(["F", "D", "L", "BL", "R", "U", "BR", "B"]),
1063
- );
1064
- if (!sawedge && !sawvertex) {
1065
- this.addNotationMapper = "FTOMapper";
1066
- }
1067
- }
1068
- if (shape === "d" && sawface) {
1069
- this.addNotationMapper = "MegaminxMapper";
1070
- this.notationMapper = new FaceRenamingMapper(
1071
- this.swizzler,
1072
- new FaceNameSwizzler([
1073
- "U",
1074
- "F",
1075
- "L",
1076
- "BL",
1077
- "BR",
1078
- "R",
1079
- "FR",
1080
- "FL",
1081
- "DL",
1082
- "B",
1083
- "DR",
1084
- "D",
1085
- ]),
1086
- );
1087
- }
1088
- }
1089
-
1090
- private keyface(face: Face): string {
1091
- return this.keyface2(face.centermass());
1092
- }
1093
-
1094
- private keyface2(cm: Quat): string {
1095
- // take a face and figure out the sides of each move plane
1096
- let s = "";
1097
- const sfcc = String.fromCharCode;
1098
- for (const moveplaneset of this.moveplanesets) {
1099
- if (moveplaneset.length > 0) {
1100
- const dv = cm.dot(moveplaneset[0]);
1101
- let t = 0;
1102
- let b = 1;
1103
- while (b * 2 <= moveplaneset.length) {
1104
- b *= 2;
1105
- }
1106
- for (; b > 0; b >>= 1) {
1107
- if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
1108
- t += b;
1109
- }
1110
- }
1111
- if (t < 47) {
1112
- s = s + sfcc(33 + t);
1113
- } else if (t < 47 + 47 * 47) {
1114
- s = s + sfcc(33 + 47 + Math.floor(t / 47) - 1) + sfcc(33 + (t % 47));
1115
- } else if (t < 47 + 47 * 47 + 47 * 47 * 47) {
1116
- s =
1117
- s +
1118
- sfcc(33 + 47 + Math.floor((t - 47) / (47 * 47) - 1)) +
1119
- sfcc(33 + 47 + (Math.floor((t - 47) / 47) % 47)) +
1120
- sfcc(33 + (t % 47));
1121
- } else {
1122
- throw Error("Too many slices for cubie encoding");
1123
- }
1124
- }
1125
- }
1126
- return s;
1127
- }
1128
-
1129
- // same as above, but instead of returning an encoded string, return
1130
- // an array with offsets.
1131
- private keyface3(face: Face): number[] {
1132
- const cm = face.centermass();
1133
- // take a face and figure out the sides of each move plane
1134
- const r = [];
1135
- for (const moveplaneset of this.moveplanesets) {
1136
- if (moveplaneset.length > 0) {
1137
- const dv = cm.dot(moveplaneset[0]);
1138
- let t = 0;
1139
- let b = 1;
1140
- while (b * 2 <= moveplaneset.length) {
1141
- b *= 2;
1142
- }
1143
- for (; b > 0; b >>= 1) {
1144
- if (t + b <= moveplaneset.length && dv > moveplaneset[t + b - 1].a) {
1145
- t += b;
1146
- }
1147
- }
1148
- r.push(t);
1149
- }
1150
- }
1151
- return r;
1152
- }
1153
-
1154
- private findface(cm: Quat): number {
1155
- const key = this.keyface2(cm);
1156
- const arr = this.facelisthash.get(key)!;
1157
- if (arr.length === 1) {
1158
- return arr[0];
1159
- }
1160
- for (let i = 0; i + 1 < arr.length; i++) {
1161
- const face2 = this.facelisthash.get(key)![i];
1162
- if (Math.abs(cm.dist(this.facecentermass[face2])) < eps) {
1163
- return face2;
1164
- }
1165
- }
1166
- return arr[arr.length - 1];
1167
- }
1168
-
1169
- private project2d(
1170
- facen: number,
1171
- edgen: number,
1172
- targvec: Quat[],
1173
- ): [Quat, Quat, Quat] {
1174
- // calculate geometry to map a particular edge of a particular
1175
- // face to a given 2D vector. The face is given as an index into the
1176
- // facenames/baseplane arrays, and the edge is given as an offset into
1177
- // the vertices.
1178
- const face = this.facenames[facen][0];
1179
- const edgen2 = (edgen + 1) % face.length;
1180
- const plane = this.baseplanes[facen];
1181
- let x0 = face[edgen2].sub(face[edgen]);
1182
- const olen = x0.len();
1183
- x0 = x0.normalize();
1184
- const y0 = x0.cross(plane).normalize();
1185
- let delta = targvec[1].sub(targvec[0]);
1186
- const len = delta.len() / olen;
1187
- delta = delta.normalize();
1188
- const cosr = delta.b;
1189
- const sinr = delta.c;
1190
- const x1 = x0.smul(cosr).sub(y0.smul(sinr)).smul(len);
1191
- const y1 = y0.smul(cosr).sum(x0.smul(sinr)).smul(len);
1192
- const off = new Quat(
1193
- 0,
1194
- targvec[0].b - x1.dot(face[edgen]),
1195
- targvec[0].c - y1.dot(face[edgen]),
1196
- 0,
1197
- );
1198
- return [x1, y1, off];
1199
- }
1200
-
1201
- public allstickers(): void {
1202
- const t1 = tstart("allstickers");
1203
- // next step is to calculate all the stickers and orbits
1204
- // We do enough work here to display the cube on the screen.
1205
- // take our newly split base face and expand it by the rotation matrix.
1206
- // this generates our full set of "stickers".
1207
- this.faces = expandfaces(this.baseplanerot, this.faces);
1208
- if (this.options.verbosity > 0) {
1209
- console.log("# Total stickers is now " + this.faces.length);
1210
- }
1211
- this.facecentermass = new Array(this.faces.length);
1212
- for (let i = 0; i < this.faces.length; i++) {
1213
- this.facecentermass[i] = this.faces[i].centermass();
1214
- }
1215
- // Split moveplanes into a list of parallel planes.
1216
- const moveplanesets: Quat[][] = [];
1217
- const moveplanenormals: Quat[] = [];
1218
- // get the normals, first, from unfiltered moveplanes.
1219
- for (const q of this.moveplanes) {
1220
- const qnormal = q.makenormal();
1221
- let wasseen = false;
1222
- for (const moveplanenormal of moveplanenormals) {
1223
- if (qnormal.sameplane(moveplanenormal.makenormal())) {
1224
- wasseen = true;
1225
- }
1226
- }
1227
- if (!wasseen) {
1228
- moveplanenormals.push(qnormal);
1229
- moveplanesets.push([]);
1230
- }
1231
- }
1232
- for (const q of this.moveplanes2) {
1233
- const qnormal = q.makenormal();
1234
- for (let j = 0; j < moveplanenormals.length; j++) {
1235
- if (qnormal.sameplane(moveplanenormals[j])) {
1236
- moveplanesets[j].push(q);
1237
- break;
1238
- }
1239
- }
1240
- }
1241
- // make the normals all face the same way in each set.
1242
- for (let i = 0; i < moveplanesets.length; i++) {
1243
- const q: Quat[] = moveplanesets[i].map((_) => _.normalizeplane());
1244
- const goodnormal = moveplanenormals[i];
1245
- for (let j = 0; j < q.length; j++) {
1246
- if (q[j].makenormal().dist(goodnormal) > eps) {
1247
- q[j] = q[j].smul(-1);
1248
- }
1249
- }
1250
- q.sort((a, b) => a.a - b.a);
1251
- moveplanesets[i] = q;
1252
- }
1253
- this.moveplanesets = moveplanesets;
1254
- this.moveplanenormals = moveplanenormals;
1255
- const sizes = moveplanesets.map((_) => _.length);
1256
- if (this.options.verbosity > 0) {
1257
- console.log("# Move plane sets: " + sizes);
1258
- }
1259
- // for each of the move planes, find the rotations that are relevant
1260
- const moverotations: Quat[][] = [];
1261
- for (let i = 0; i < moveplanesets.length; i++) {
1262
- moverotations.push([]);
1263
- }
1264
- for (const q of this.rotations) {
1265
- if (Math.abs(Math.abs(q.a) - 1) < eps) {
1266
- continue;
1267
- }
1268
- const qnormal = q.makenormal();
1269
- for (let j = 0; j < moveplanesets.length; j++) {
1270
- if (qnormal.sameplane(moveplanenormals[j])) {
1271
- moverotations[j].push(q);
1272
- break;
1273
- }
1274
- }
1275
- }
1276
- this.moverotations = moverotations;
1277
- // Sort the rotations by the angle of rotation. A bit tricky because
1278
- // while the norms should be the same, they need not be. So we start
1279
- // by making the norms the same, and then sorting.
1280
- for (let i = 0; i < moverotations.length; i++) {
1281
- const r = moverotations[i];
1282
- const goodnormal = r[0].makenormal();
1283
- for (let j = 0; j < r.length; j++) {
1284
- if (goodnormal.dist(r[j].makenormal()) > eps) {
1285
- r[j] = r[j].smul(-1);
1286
- }
1287
- }
1288
- r.sort((a, b) => a.angle() - b.angle());
1289
- if (moverotations[i][0].dot(moveplanenormals[i]) < 0) {
1290
- r.reverse();
1291
- }
1292
- }
1293
- const sizes2 = moverotations.map((_) => 1 + _.length);
1294
- this.movesetorders = sizes2;
1295
- const movesetgeos: [string, string, string, string, number][] = [];
1296
- let gtype = "?";
1297
- for (let i = 0; i < moveplanesets.length; i++) {
1298
- const p0 = moveplanenormals[i];
1299
- let neg = null;
1300
- let pos = null;
1301
- for (const geonormal of this.geonormals) {
1302
- const d = p0.dot(geonormal[0]);
1303
- if (Math.abs(d - 1) < eps) {
1304
- pos = [geonormal[1], geonormal[2]];
1305
- gtype = geonormal[2];
1306
- } else if (Math.abs(d + 1) < eps) {
1307
- neg = [geonormal[1], geonormal[2]];
1308
- gtype = geonormal[2];
1309
- }
1310
- }
1311
- if (pos === null || neg === null) {
1312
- throw new Error("Saw positive or negative sides as null");
1313
- }
1314
- movesetgeos.push([
1315
- pos[0],
1316
- pos[1],
1317
- neg[0],
1318
- neg[1],
1319
- 1 + moveplanesets[i].length,
1320
- ]);
1321
- if (this.addNotationMapper === "NxNxNCubeMapper" && gtype === "f") {
1322
- this.notationMapper = new NxNxNCubeMapper(1 + moveplanesets[i].length);
1323
- this.addNotationMapper = "";
1324
- }
1325
- if (
1326
- this.addNotationMapper === "SkewbMapper" &&
1327
- moveplanesets[0].length === 1
1328
- ) {
1329
- this.notationMapper = new SkewbNotationMapper(this.swizzler);
1330
- this.addNotationMapper = "";
1331
- }
1332
- if (this.addNotationMapper === "PyraminxOrTetraminxMapper") {
1333
- if (
1334
- moveplanesets[0].length === 2 &&
1335
- moveplanesets[0][0].a === 0.333333333333333 &&
1336
- moveplanesets[0][1].a === 1.66666666666667
1337
- ) {
1338
- this.notationMapper = new PyraminxNotationMapper(this.swizzler);
1339
- this.addNotationMapper = "";
1340
- } else {
1341
- this.notationMapper = new TetraminxNotationMapper(this.swizzler);
1342
- this.addNotationMapper = "";
1343
- }
1344
- }
1345
- if (this.addNotationMapper === "MegaminxMapper" && gtype === "f") {
1346
- if (1 + moveplanesets[i].length === 3) {
1347
- this.notationMapper = new MegaminxScramblingNotationMapper(
1348
- this.notationMapper,
1349
- );
1350
- }
1351
- this.addNotationMapper = "";
1352
- }
1353
- if (this.addNotationMapper === "FTOMapper" && gtype === "f") {
1354
- if (1 + moveplanesets[i].length === 3) {
1355
- this.notationMapper = new FTONotationMapper(
1356
- this.notationMapper,
1357
- this.swizzler,
1358
- );
1359
- }
1360
- this.addNotationMapper = "";
1361
- }
1362
- }
1363
- this.movesetgeos = movesetgeos;
1364
- // Cubies are split by move plane sets. For each cubie we can
1365
- // average its points to find a point on the interior of that
1366
- // cubie. We can then check that point against all the move
1367
- // planes and from that derive a coordinate for the cubie.
1368
- // This also works for faces; no face should ever lie on a move
1369
- // plane. This allows us to take a set of stickers and break
1370
- // them up into cubie sets.
1371
- const facelisthash = new Map();
1372
- const faces = this.faces;
1373
- for (let i = 0; i < faces.length; i++) {
1374
- const face = faces[i];
1375
- const s = this.keyface(face);
1376
- if (!facelisthash.get(s)) {
1377
- facelisthash.set(s, [i]);
1378
- } else {
1379
- const arr = facelisthash.get(s)!;
1380
- arr.push(i);
1381
- // If we find a core cubie, split it up into multiple cubies,
1382
- // because ksolve doesn't handle orientations that are not
1383
- // cyclic, and the rotation group of the core is not cyclic.
1384
- if (arr.length === this.baseFaceCount) {
1385
- if (this.options.verbosity > 0) {
1386
- console.log("# Splitting core.");
1387
- }
1388
- for (let suff = 0; suff < arr.length; suff++) {
1389
- const s2 = s + " " + suff;
1390
- facelisthash.set(s2, [arr[suff]]);
1391
- }
1392
- }
1393
- }
1394
- }
1395
- this.facelisthash = facelisthash;
1396
- if (this.options.verbosity > 0) {
1397
- console.log("# Cubies: " + facelisthash.size);
1398
- }
1399
- const cubies: number[][] = [];
1400
- const facetocubie = [];
1401
- const facetoord = [];
1402
- for (const facelist of facelisthash.values()) {
1403
- if (facelist.length === this.baseFaceCount) {
1404
- // this is the original "cubie" of a split core; we ignore it.
1405
- continue;
1406
- }
1407
- // Sort the faces around each corner so they are counterclockwise. Only
1408
- // relevant for cubies that actually are corners (three or more
1409
- // faces). In general cubies might have many faces; for icosohedrons
1410
- // there are five faces on the corner cubies.
1411
- if (facelist.length > 1) {
1412
- const cm = facelist.map((_: number) => faces[_].centermass());
1413
- const cmall = centermassface(cm);
1414
- for (let looplimit = 0; facelist.length > 2; looplimit++) {
1415
- let changed = false;
1416
- for (let i = 0; i < facelist.length; i++) {
1417
- const j = (i + 1) % facelist.length;
1418
- // var ttt = cmall.dot(cm[i].cross(cm[j])) ; // TODO
1419
- if (cmall.dot(cm[i].cross(cm[j])) < 0) {
1420
- const u = cm[i];
1421
- cm[i] = cm[j];
1422
- cm[j] = u;
1423
- const v = facelist[i];
1424
- facelist[i] = facelist[j];
1425
- facelist[j] = v;
1426
- changed = true;
1427
- }
1428
- }
1429
- if (!changed) {
1430
- break;
1431
- }
1432
- if (looplimit > 1000) {
1433
- throw new Error("Bad epsilon math; too close to border");
1434
- }
1435
- }
1436
- let mini = 0;
1437
- let minf = facelist[mini];
1438
- for (let i = 1; i < facelist.length; i++) {
1439
- const temp = facelist[i];
1440
- if (
1441
- this.faceprecedence[this.getfaceindex(temp)] <
1442
- this.faceprecedence[this.getfaceindex(minf)]
1443
- ) {
1444
- mini = i;
1445
- minf = temp;
1446
- }
1447
- }
1448
- if (mini !== 0) {
1449
- const ofacelist = facelist.slice();
1450
- for (let i = 0; i < facelist.length; i++) {
1451
- facelist[i] = ofacelist[(mini + i) % facelist.length];
1452
- }
1453
- }
1454
- }
1455
- for (let j = 0; j < facelist.length; j++) {
1456
- const k = facelist[j];
1457
- facetocubie[k] = cubies.length;
1458
- facetoord[k] = j;
1459
- }
1460
- cubies.push(facelist);
1461
- }
1462
- this.cubies = cubies;
1463
- this.facetocubie = facetocubie;
1464
- this.facetoord = facetoord;
1465
- // Calculate the orbits of each cubie. Assumes we do all moves.
1466
- // Also calculates which cubies are identical.
1467
- const typenames = ["?", "CENTERS", "EDGES", "CORNERS", "C4RNER", "C5RNER"];
1468
- const cubiesetnames = [];
1469
- const cubietypecounts = [0, 0, 0, 0, 0, 0];
1470
- const orbitoris = [];
1471
- const seen = [];
1472
- let cubiesetnum = 0;
1473
- const cubiesetnums = [];
1474
- const cubieordnums = [];
1475
- const cubieords = [];
1476
- const cubievaluemap = [];
1477
- // Later we will make this smarter to use a get color for face function
1478
- // so we support puzzles with multiple faces the same color
1479
- const getcolorkey = (cubienum: number): string => {
1480
- return cubies[cubienum].map((_) => this.getfaceindex(_)).join(" ");
1481
- };
1482
- const cubiesetcubies: any = [];
1483
- for (let i = 0; i < cubies.length; i++) {
1484
- if (seen[i]) {
1485
- continue;
1486
- }
1487
- const cubie = cubies[i];
1488
- if (cubie.length === 0) {
1489
- continue;
1490
- }
1491
- const cubiekeymap: any = {};
1492
- let cubievalueid = 0;
1493
- cubieords.push(0);
1494
- cubiesetcubies.push([]);
1495
- const facecnt = cubie.length;
1496
- const typectr = cubietypecounts[facecnt]++;
1497
- let typename = typenames[facecnt];
1498
- if (typename === undefined || facecnt === this.baseFaceCount) {
1499
- typename = "CORE";
1500
- }
1501
- typename = typename + (typectr === 0 ? "" : typectr + 1);
1502
- cubiesetnames[cubiesetnum] = typename;
1503
- orbitoris[cubiesetnum] = facecnt;
1504
- const queue = [i];
1505
- let qg = 0;
1506
- seen[i] = true;
1507
- while (qg < queue.length) {
1508
- const cind = queue[qg++];
1509
- const cubiecolorkey = getcolorkey(cind);
1510
- if (cubie.length > 1 || cubiekeymap[cubiecolorkey] === undefined) {
1511
- cubiekeymap[cubiecolorkey] = cubievalueid++;
1512
- }
1513
- cubievaluemap[cind] = cubiekeymap[cubiecolorkey];
1514
- cubiesetnums[cind] = cubiesetnum;
1515
- cubiesetcubies[cubiesetnum].push(cind);
1516
- cubieordnums[cind] = cubieords[cubiesetnum]++;
1517
- if (queue.length < this.rotations.length) {
1518
- const cm = this.facecentermass[cubies[cind][0]];
1519
- for (const moverotation of moverotations) {
1520
- const tq =
1521
- this.facetocubie[this.findface(cm.rotatepoint(moverotation[0]))];
1522
- if (!seen[tq]) {
1523
- queue.push(tq);
1524
- seen[tq] = true;
1525
- }
1526
- }
1527
- }
1528
- }
1529
- cubiesetnum++;
1530
- }
1531
- if (
1532
- this.setReidOrder &&
1533
- 4 <= this.stickersperface &&
1534
- this.stickersperface <= 9
1535
- ) {
1536
- const reidorder = [
1537
- [
1538
- "UF",
1539
- "UR",
1540
- "UB",
1541
- "UL",
1542
- "DF",
1543
- "DR",
1544
- "DB",
1545
- "DL",
1546
- "FR",
1547
- "FL",
1548
- "BR",
1549
- "BL",
1550
- ],
1551
- ["UFR", "URB", "UBL", "ULF", "DRF", "DFL", "DLB", "DBR"],
1552
- ["U", "L", "F", "R", "B", "D"],
1553
- ];
1554
- const reidmap: { [key: number]: number } = {};
1555
- for (const cubie of reidorder) {
1556
- for (let j = 0; j < cubie.length; j++) {
1557
- let mask = 0;
1558
- for (let k = 0; k < cubie[j].length; k++) {
1559
- mask |= 1 << (cubie[j].charCodeAt(k) - 65);
1560
- }
1561
- reidmap[mask] = j;
1562
- }
1563
- }
1564
- for (const cubieset of cubiesetcubies) {
1565
- for (const cubienum of cubieset) {
1566
- let mask = 0;
1567
- for (const cubie of cubies[cubienum]) {
1568
- mask |=
1569
- 1 <<
1570
- (this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65);
1571
- }
1572
- cubieordnums[cubienum] = reidmap[mask];
1573
- }
1574
- }
1575
- }
1576
- this.cubiesetnums = cubiesetnums;
1577
- this.cubieordnums = cubieordnums;
1578
- this.cubiesetnames = cubiesetnames;
1579
- this.cubieords = cubieords;
1580
- this.orbitoris = orbitoris;
1581
- this.cubievaluemap = cubievaluemap;
1582
- this.cubiesetcubies = cubiesetcubies;
1583
- // if we fix a cubie, find a cubie to fix
1584
- if (this.options.fixedPieceType !== null) {
1585
- for (let i = 0; i < cubies.length; i++) {
1586
- if (
1587
- (this.options.fixedPieceType === "v" && cubies[i].length > 2) ||
1588
- (this.options.fixedPieceType === "e" && cubies[i].length === 2) ||
1589
- (this.options.fixedPieceType === "f" && cubies[i].length === 1)
1590
- ) {
1591
- this.fixedCubie = i;
1592
- break;
1593
- }
1594
- }
1595
- if (this.fixedCubie < 0) {
1596
- throw new Error(
1597
- "Could not find a cubie of type " +
1598
- this.options.fixedPieceType +
1599
- " to fix.",
1600
- );
1601
- }
1602
- }
1603
- // show the orbits
1604
- if (this.options.verbosity > 0) {
1605
- console.log("# Cubie orbit sizes " + cubieords);
1606
- }
1607
- tend(t1);
1608
- }
1609
-
1610
- public unswizzle(mv: Move): string {
1611
- const newmv = this.notationMapper.notationToInternal(mv);
1612
- if (newmv === null) {
1613
- return "";
1614
- }
1615
- return this.swizzler.unswizzle(newmv.family);
1616
- }
1617
-
1618
- // We use an extremely permissive parse here; any character but
1619
- // digits are allowed in a family name.
1620
- private stringToBlockMove(mv: string): Move {
1621
- // parse a move from the command line
1622
- const re = RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$");
1623
- const p = mv.match(re);
1624
- if (p === null) {
1625
- throw new Error("Bad move passed " + mv);
1626
- }
1627
- const grip = p[4];
1628
- let loslice = undefined;
1629
- let hislice = undefined;
1630
- if (p[2] !== undefined) {
1631
- if (p[3] === undefined) {
1632
- throw new Error("Missing second number in range");
1633
- }
1634
- loslice = parseInt(p[2], 10);
1635
- }
1636
- if (p[3] !== undefined) {
1637
- hislice = parseInt(p[3], 10);
1638
- }
1639
- let amountstr = "1";
1640
- let amount = 1;
1641
- if (p[5] !== undefined) {
1642
- amountstr = p[5];
1643
- if (amountstr[0] === "'") {
1644
- amountstr = "-" + amountstr.substring(1);
1645
- }
1646
- amount = parseInt(amountstr, 10);
1647
- }
1648
- return new Move(new QuantumMove(grip, hislice, loslice), amount);
1649
- }
1650
-
1651
- public parseMove(
1652
- move: Move,
1653
- ): [string | undefined, number, number, number, boolean, number] {
1654
- const bm = this.notationMapper.notationToInternal(move); // pluggable notation
1655
- if (bm === null) {
1656
- throw new Error("Bad move " + move.family);
1657
- }
1658
- move = bm;
1659
- let grip = move.family;
1660
- let fullrotation = false;
1661
- if (grip.endsWith("v") && grip[0] <= "Z") {
1662
- if (move.innerLayer !== undefined || move.outerLayer !== undefined) {
1663
- throw new Error("Cannot use a prefix with full cube rotations");
1664
- }
1665
- grip = grip.slice(0, -1);
1666
- fullrotation = true;
1667
- }
1668
- if (grip.endsWith("w") && grip[0] <= "Z") {
1669
- grip = grip.slice(0, -1).toLowerCase();
1670
- }
1671
- let geo;
1672
- let msi = -1;
1673
- const geoname = this.swizzler.unswizzle(grip);
1674
- let firstgrip = false;
1675
- for (let i = 0; i < this.movesetgeos.length; i++) {
1676
- const g = this.movesetgeos[i];
1677
- if (geoname === g[0]) {
1678
- firstgrip = true;
1679
- geo = g;
1680
- msi = i;
1681
- }
1682
- if (geoname === g[2]) {
1683
- firstgrip = false;
1684
- geo = g;
1685
- msi = i;
1686
- }
1687
- }
1688
- let loslice = 1;
1689
- let hislice = 1;
1690
- if (grip.toUpperCase() !== grip) {
1691
- hislice = 2;
1692
- }
1693
- if (geo === undefined) {
1694
- throw new Error("Bad grip in move " + move.family);
1695
- }
1696
- if (move.outerLayer !== undefined) {
1697
- loslice = move.outerLayer;
1698
- }
1699
- if (move.innerLayer !== undefined) {
1700
- if (move.outerLayer === undefined) {
1701
- hislice = move.innerLayer;
1702
- // big assumption here! if outerlayer not specified, but inner
1703
- // layer is (like 2U), we use the case of the family (upper vs
1704
- // lower) to decide if it should be a slice turn or a wide turn.
1705
- if (grip <= "Z") {
1706
- // uppercase; slice move
1707
- loslice = hislice;
1708
- } else {
1709
- // lowercase; wide move
1710
- loslice = 1;
1711
- }
1712
- } else {
1713
- hislice = move.innerLayer;
1714
- }
1715
- }
1716
- loslice--;
1717
- hislice--;
1718
- if (fullrotation) {
1719
- loslice = 0;
1720
- hislice = this.moveplanesets[msi].length;
1721
- }
1722
- if (
1723
- loslice < 0 ||
1724
- loslice > this.moveplanesets[msi].length ||
1725
- hislice < 0 ||
1726
- hislice > this.moveplanesets[msi].length
1727
- ) {
1728
- throw new Error(
1729
- "Bad slice spec " +
1730
- loslice +
1731
- " " +
1732
- hislice +
1733
- " vs " +
1734
- this.moveplanesets[msi].length,
1735
- );
1736
- }
1737
- if (
1738
- !permissivieMoveParsing &&
1739
- loslice === 0 &&
1740
- hislice === this.moveplanesets[msi].length &&
1741
- !fullrotation
1742
- ) {
1743
- throw new Error(
1744
- "! full puzzle rotations must be specified with v suffix.",
1745
- );
1746
- }
1747
- return [undefined, msi, loslice, hislice, firstgrip, move.amount];
1748
- }
1749
-
1750
- private parsemove(
1751
- mv: string,
1752
- ): [string | undefined, number, number, number, boolean, number] {
1753
- const r = this.parseMove(this.stringToBlockMove(mv));
1754
- r[0] = mv;
1755
- return r;
1756
- }
1757
-
1758
- public genperms(): void {
1759
- const t1 = tstart("genperms");
1760
- // generate permutations for moves
1761
- if (this.cmovesbyslice.length > 0) {
1762
- // did this already?
1763
- return;
1764
- }
1765
- const cmovesbyslice = [];
1766
- // if orientCenters is set, we find all cubies that have only one
1767
- // sticker and that sticker is in the center of a face, and we
1768
- // introduce duplicate stickers so we can orient them properly.
1769
- if (this.options.orientCenters) {
1770
- for (let k = 0; k < this.cubies.length; k++) {
1771
- if (this.cubies[k].length === 1) {
1772
- const kk = this.cubies[k][0];
1773
- const i = this.getfaceindex(kk);
1774
- if (
1775
- this.basefaces[i].centermass().dist(this.facecentermass[kk]) < eps
1776
- ) {
1777
- const o = this.basefaces[i].length;
1778
- for (let m = 1; m < o; m++) {
1779
- this.cubies[k].push(this.cubies[k][m - 1]);
1780
- }
1781
- this.duplicatedFaces[kk] = o;
1782
- this.duplicatedCubies[k] = o;
1783
- this.orbitoris[this.cubiesetnums[k]] = o;
1784
- }
1785
- }
1786
- }
1787
- }
1788
- for (let k = 0; k < this.moveplanesets.length; k++) {
1789
- const moveplaneset = this.moveplanesets[k];
1790
- const slicenum = [];
1791
- const slicecnts = [moveplaneset.length + 1, 0];
1792
- let bhi = 1;
1793
- while (bhi * 2 <= moveplaneset.length) {
1794
- bhi *= 2;
1795
- }
1796
- for (let i = 0; i < this.faces.length; i++) {
1797
- let t = 0;
1798
- if (moveplaneset.length > 0) {
1799
- const dv = this.facecentermass[i].dot(moveplaneset[0]);
1800
- for (let b = bhi; b > 0; b >>= 1) {
1801
- if (
1802
- t + b <= moveplaneset.length &&
1803
- dv > moveplaneset[t + b - 1].a
1804
- ) {
1805
- t += b;
1806
- }
1807
- }
1808
- t = moveplaneset.length - t;
1809
- }
1810
- slicenum.push(t);
1811
- while (slicecnts.length <= t) {
1812
- slicecnts.push(0);
1813
- }
1814
- slicecnts[t]++;
1815
- }
1816
- const axiscmoves = new Array(slicecnts.length);
1817
- for (let sc = 0; sc < slicecnts.length; sc++) {
1818
- axiscmoves[sc] = [];
1819
- }
1820
- const cubiedone = [];
1821
- for (let i = 0; i < this.faces.length; i++) {
1822
- if (slicenum[i] < 0) {
1823
- continue;
1824
- }
1825
- const b = [this.facetocubie[i], this.facetoord[i]];
1826
- let cm = this.facecentermass[i];
1827
- const ocm = cm;
1828
- let fi2 = i;
1829
- const sc = slicenum[fi2];
1830
- for (;;) {
1831
- slicenum[fi2] = -1;
1832
- const cm2 = cm.rotatepoint(this.moverotations[k][0]);
1833
- if (cm2.dist(ocm) < eps) {
1834
- break;
1835
- }
1836
- fi2 = this.findface(cm2);
1837
- b.push(this.facetocubie[fi2], this.facetoord[fi2]);
1838
- cm = cm2;
1839
- }
1840
- // If an oriented center is moving, we need to figure out
1841
- // the appropriate new orientation. Normally we use the cubie
1842
- // sticker identity to locate, but this doesn't work here.
1843
- // Instead we need to redo the geometry of the sticker itself
1844
- // rotating and figure out how that maps to the destination
1845
- // sticker.
1846
- //
1847
- // We only need to do this for central center stickers: those
1848
- // where the face vertex goes through the center. The others
1849
- // don't actually need orientation because they can only be
1850
- // in one orientation by physical constraints. (You can't spin
1851
- // a point or cross sticker on the 5x5x5, for example.)
1852
- //
1853
- // This also simplifies things because it means the actual
1854
- // remapping has the same order as the moves themselves.
1855
- //
1856
- // The center may or may not have been duplicated at this point.
1857
- //
1858
- // The move moving the center might not be the same modulo as the
1859
- // center itself.
1860
- if (
1861
- b.length > 2 &&
1862
- this.options.orientCenters &&
1863
- (this.cubies[b[0]].length === 1 || this.duplicatedCubies[b[0]] > 1)
1864
- ) {
1865
- // is this a real center cubie, around an axis?
1866
- if (
1867
- this.facecentermass[i].dist(
1868
- this.basefaces[this.getfaceindex(i)].centermass(),
1869
- ) < eps
1870
- ) {
1871
- // how does remapping of the face/point set map to the original?
1872
- let face1 = this.faces[this.cubies[b[0]][0]];
1873
- for (let ii = 0; ii < b.length; ii += 2) {
1874
- const face0 = this.faces[this.cubies[b[ii]][0]];
1875
- let o = -1;
1876
- for (let jj = 0; jj < face1.length; jj++) {
1877
- if (face0.get(jj).dist(face1.get(0)) < eps) {
1878
- o = jj;
1879
- break;
1880
- }
1881
- }
1882
- if (o < 0) {
1883
- throw new Error(
1884
- "Couldn't find rotation of center faces; ignoring for now.",
1885
- );
1886
- } else {
1887
- b[ii + 1] = o;
1888
- face1 = face1.rotate(this.moverotations[k][0]);
1889
- }
1890
- }
1891
- }
1892
- }
1893
- // b.length == 2 means a sticker is spinning in place.
1894
- // in this case we add duplicate stickers
1895
- // so that we can make it animate properly in a 3D world.
1896
- if (b.length === 2 && this.options.orientCenters) {
1897
- for (let ii = 1; ii < this.movesetorders[k]; ii++) {
1898
- if (sc === 0) {
1899
- b.push(b[0], ii);
1900
- } else {
1901
- b.push(
1902
- b[0],
1903
- (this.movesetorders[k] - ii) % this.movesetorders[k],
1904
- );
1905
- }
1906
- }
1907
- }
1908
- if (b.length > 2 && !cubiedone[b[0]]) {
1909
- if (b.length !== 2 * this.movesetorders[k]) {
1910
- throw new Error("Bad length in perm gen");
1911
- }
1912
- for (const v of b) {
1913
- axiscmoves[sc].push(v);
1914
- }
1915
- }
1916
- for (let j = 0; j < b.length; j += 2) {
1917
- cubiedone[b[j]] = true;
1918
- }
1919
- }
1920
- for (let kk = 0; kk < axiscmoves.length; kk++) {
1921
- axiscmoves[kk] = axiscmoves[kk].slice();
1922
- }
1923
- cmovesbyslice.push(axiscmoves);
1924
- }
1925
- this.cmovesbyslice = cmovesbyslice;
1926
- if (this.options.moveList) {
1927
- const parsedmovelist: [
1928
- string | undefined,
1929
- number,
1930
- number,
1931
- number,
1932
- boolean,
1933
- number,
1934
- ][] = [];
1935
- // make sure the movelist makes sense based on the geos.
1936
- for (const moveString of this.options.moveList) {
1937
- parsedmovelist.push(this.parsemove(moveString));
1938
- }
1939
- this.parsedmovelist = parsedmovelist;
1940
- }
1941
- this.facelisthash.clear();
1942
- this.facecentermass = [];
1943
- tend(t1);
1944
- }
1945
-
1946
- private getboundarygeometry(): any {
1947
- // get the boundary geometry
1948
- return {
1949
- baseplanes: this.baseplanes,
1950
- facenames: this.facenames,
1951
- faceplanes: this.faceplanes,
1952
- vertexnames: this.vertexnames,
1953
- edgenames: this.edgenames,
1954
- geonormals: this.geonormals,
1955
- };
1956
- }
1957
-
1958
- private getmovesets(k: number): any {
1959
- // get the move sets we support based on slices
1960
- // for even values we omit the middle "slice". This isn't perfect
1961
- // but it is what we do for now.
1962
- // if there was a move list specified, pull values from that
1963
- const slices = this.moveplanesets[k].length;
1964
- let r: any[] = [];
1965
- if (this.parsedmovelist !== undefined) {
1966
- for (const parsedmove of this.parsedmovelist) {
1967
- if (parsedmove[1] !== k) {
1968
- continue;
1969
- }
1970
- if (parsedmove[4]) {
1971
- r.push([parsedmove[2], parsedmove[3]]);
1972
- } else {
1973
- r.push([slices - parsedmove[3], slices - parsedmove[2]]);
1974
- }
1975
- r.push(parsedmove[5]);
1976
- }
1977
- } else if (this.options.vertexMoves && !this.options.allMoves) {
1978
- const msg = this.movesetgeos[k];
1979
- if (msg[1] !== msg[3]) {
1980
- for (let i = 0; i < slices; i++) {
1981
- if (msg[1] !== "v") {
1982
- if (this.options.outerBlockMoves) {
1983
- r.push([i + 1, slices]);
1984
- } else {
1985
- r.push([i + 1]);
1986
- }
1987
- r.push(1);
1988
- } else {
1989
- if (this.options.outerBlockMoves) {
1990
- r.push([0, i]);
1991
- } else {
1992
- r.push([i, i]);
1993
- }
1994
- r.push(1);
1995
- }
1996
- }
1997
- }
1998
- } else {
1999
- for (let i = 0; i <= slices; i++) {
2000
- if (!this.options.allMoves && i + i === slices) {
2001
- continue;
2002
- }
2003
- if (this.options.outerBlockMoves) {
2004
- if (i + i > slices) {
2005
- r.push([i, slices]);
2006
- } else {
2007
- r.push([0, i]);
2008
- }
2009
- } else {
2010
- r.push([i, i]);
2011
- }
2012
- r.push(1);
2013
- }
2014
- }
2015
- if (this.fixedCubie >= 0) {
2016
- const dep = this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[k];
2017
- const newr = [];
2018
- for (let i = 0; i < r.length; i += 2) {
2019
- let o = r[i];
2020
- if (dep >= o[0] && dep <= o[1]) {
2021
- if (o[0] === 0) {
2022
- o = [o[1] + 1, slices];
2023
- } else if (slices === o[1]) {
2024
- o = [0, o[0] - 1];
2025
- } else {
2026
- throw Error("fixed cubie option would disconnect move");
2027
- }
2028
- }
2029
- let found = false;
2030
- for (let j = 0; j < newr.length; j += 2) {
2031
- if (
2032
- newr[j][0] === o[0] &&
2033
- newr[j][1] === o[1] &&
2034
- newr[j + 1] === r[i + 1]
2035
- ) {
2036
- found = true;
2037
- break;
2038
- }
2039
- }
2040
- if (!found) {
2041
- newr.push(o);
2042
- newr.push(r[i + 1]);
2043
- }
2044
- }
2045
- r = newr;
2046
- }
2047
- // TODO
2048
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
2049
- return r;
2050
- }
2051
-
2052
- private graybyori(cubie: number): boolean {
2053
- let ori = this.cubies[cubie].length;
2054
- if (this.duplicatedCubies[cubie]) {
2055
- ori = 1;
2056
- }
2057
- return (
2058
- (ori === 1 &&
2059
- (this.options.grayCenters || !this.options.includeCenterOrbits)) ||
2060
- (ori === 2 &&
2061
- (this.options.grayEdges || !this.options.includeEdgeOrbits)) ||
2062
- (ori > 2 &&
2063
- (this.options.grayCorners || !this.options.includeCornerOrbits))
2064
- );
2065
- }
2066
-
2067
- private skipbyori(cubie: number): boolean {
2068
- let ori = this.cubies[cubie].length;
2069
- if (this.duplicatedCubies[cubie]) {
2070
- ori = 1;
2071
- }
2072
- return (
2073
- (ori === 1 && !this.options.includeCenterOrbits) ||
2074
- (ori === 2 && !this.options.includeEdgeOrbits) ||
2075
- (ori > 2 && !this.options.includeCornerOrbits)
2076
- );
2077
- }
2078
-
2079
- private skipcubie(fi: number): boolean {
2080
- return this.skipbyori(fi);
2081
- }
2082
-
2083
- private header(comment: string): string {
2084
- return comment + copyright + "\n" + comment + "\n";
2085
- }
2086
-
2087
- public writegap(): string {
2088
- // write out a gap set of generators
2089
- const os = this.getOrbitsDef(false);
2090
- const r = [];
2091
- const mvs = [];
2092
- for (let i = 0; i < os.moveops.length; i++) {
2093
- let movename = "M_" + externalName(this.notationMapper, os.movenames[i]);
2094
- let doinv = false;
2095
- if (movename[movename.length - 1] === "'") {
2096
- movename = movename.substring(0, movename.length - 1);
2097
- doinv = true;
2098
- }
2099
- // gap doesn't like angle brackets in IDs
2100
- mvs.push(movename);
2101
- if (doinv) {
2102
- r.push(movename + ":=" + os.moveops[i].toPerm().inv().toGap() + ";");
2103
- } else {
2104
- r.push(movename + ":=" + os.moveops[i].toPerm().toGap() + ";");
2105
- }
2106
- }
2107
- r.push("Gen:=[");
2108
- r.push(mvs.join(","));
2109
- r.push("];");
2110
- const ip = os.solved.identicalPieces();
2111
- r.push(
2112
- "ip:=[" +
2113
- ip.map((_) => "[" + _.map((__) => __ + 1).join(",") + "]").join(",") +
2114
- "];",
2115
- );
2116
- r.push("# Size(Group(Gen));");
2117
- r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));");
2118
- r.push("");
2119
- return this.header("# ") + r.join("\n");
2120
- }
2121
-
2122
- public writeksolve(name: string = "PuzzleGeometryPuzzle"): string {
2123
- const od = this.getOrbitsDef(false);
2124
- return (
2125
- this.header("# ") + od.toKsolve(name, this.notationMapper).join("\n")
2126
- );
2127
- }
2128
-
2129
- public writekpuzzle(
2130
- fortwisty: boolean = true,
2131
- includemoves: boolean = true,
2132
- ): KPuzzleDefinition {
2133
- const od = this.getOrbitsDef(fortwisty, includemoves);
2134
- const r = od.toKPuzzle(includemoves);
2135
- if (!r) {
2136
- throw new Error("Missing definition!");
2137
- }
2138
- r.moveNotation = new PGNotation(this, od);
2139
- return r;
2140
- }
2141
-
2142
- public getMoveFromBits(
2143
- moverange: number[],
2144
- amount: number,
2145
- inverted: boolean,
2146
- axiscmoves: number[][],
2147
- setmoves: number[] | undefined,
2148
- movesetorder: number,
2149
- ): PGTransform {
2150
- const moveorbits: PGOrbit[] = [];
2151
- const perms = [];
2152
- const oris = [];
2153
- for (const len of this.cubieords) {
2154
- perms.push(iota(len));
2155
- oris.push(zeros(len));
2156
- }
2157
- for (let m = moverange[0]; m <= moverange[1]; m++) {
2158
- const slicecmoves = axiscmoves[m];
2159
- for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {
2160
- const mperm = slicecmoves.slice(j, j + 2 * movesetorder);
2161
- const setnum = this.cubiesetnums[mperm[0]];
2162
- for (let ii = 0; ii < mperm.length; ii += 2) {
2163
- mperm[ii] = this.cubieordnums[mperm[ii]];
2164
- }
2165
- let inc = 2;
2166
- let oinc = 3;
2167
- if (inverted) {
2168
- inc = mperm.length - 2;
2169
- oinc = mperm.length - 1;
2170
- }
2171
- if (perms[setnum] === iota(this.cubieords[setnum])) {
2172
- perms[setnum] = perms[setnum].slice();
2173
- if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
2174
- oris[setnum] = oris[setnum].slice();
2175
- }
2176
- }
2177
- for (let ii = 0; ii < mperm.length; ii += 2) {
2178
- perms[setnum][mperm[(ii + inc) % mperm.length]] = mperm[ii];
2179
- if (this.orbitoris[setnum] > 1 && !this.options.fixedOrientation) {
2180
- oris[setnum][mperm[ii]] =
2181
- (mperm[(ii + oinc) % mperm.length] -
2182
- mperm[(ii + 1) % mperm.length] +
2183
- 2 * this.orbitoris[setnum]) %
2184
- this.orbitoris[setnum];
2185
- }
2186
- }
2187
- }
2188
- }
2189
- let lastId = new PGOrbit(iota(24), zeros(24), 1);
2190
- for (let ii = 0; ii < this.cubiesetnames.length; ii++) {
2191
- if (setmoves && !setmoves[ii]) {
2192
- continue;
2193
- }
2194
- if (this.orbitoris[ii] === 1 || this.options.fixedOrientation) {
2195
- if (perms[ii] === iota(lastId.perm.length)) {
2196
- if (perms[ii] !== lastId.perm) {
2197
- lastId = new PGOrbit(perms[ii], oris[ii], 1);
2198
- }
2199
- moveorbits.push(lastId);
2200
- } else {
2201
- moveorbits.push(new PGOrbit(perms[ii], oris[ii], 1));
2202
- }
2203
- } else {
2204
- const no = new Array<number>(oris[ii].length);
2205
- // convert ksolve oris to our internal ori rep
2206
- for (let jj = 0; jj < perms[ii].length; jj++) {
2207
- no[jj] = oris[ii][perms[ii][jj]];
2208
- }
2209
- moveorbits.push(new PGOrbit(perms[ii], no, this.orbitoris[ii]));
2210
- }
2211
- }
2212
- let mv = new PGTransform(moveorbits);
2213
- if (amount !== 1) {
2214
- mv = mv.mulScalar(amount);
2215
- }
2216
- return mv;
2217
- }
2218
-
2219
- private omitSet(name: string): boolean {
2220
- for (const excludedSet of this.options.excludeOrbits) {
2221
- if (excludedSet === name) {
2222
- return true;
2223
- }
2224
- }
2225
- return false;
2226
- }
2227
-
2228
- private diffmvsets(a: any[], b: any[], slices: number, neg: boolean) {
2229
- for (let i = 0; i < a.length; i += 2) {
2230
- let found = false;
2231
- for (let j = 0; !found && j < b.length; j += 2) {
2232
- if (neg) {
2233
- if (
2234
- a[i][0] + b[j][1] === slices &&
2235
- a[i][1] + b[j][0] === slices &&
2236
- a[i + 1] === b[j + 1]
2237
- ) {
2238
- found = true;
2239
- }
2240
- } else {
2241
- if (
2242
- a[i][0] === b[j][0] &&
2243
- a[i][1] === b[j][1] &&
2244
- a[i + 1] === b[j + 1]
2245
- ) {
2246
- found = true;
2247
- }
2248
- }
2249
- }
2250
- if (!found) {
2251
- return true;
2252
- }
2253
- }
2254
- return false;
2255
- }
2256
-
2257
- // TODO: This is only public for testing; can we make it private again?
2258
- public getOrbitsDef(
2259
- fortwisty: boolean,
2260
- includemoves: boolean = true,
2261
- ): PGOrbitsDef {
2262
- // generate a representation of the puzzle
2263
- const setmoves = [];
2264
- if (fortwisty) {
2265
- for (let i = 0; i < this.cubiesetnames.length; i++) {
2266
- setmoves.push(1);
2267
- }
2268
- }
2269
- const setnames: string[] = [];
2270
- const setdefs: PGOrbitDef[] = [];
2271
- // if both a movelist and rotations are needed, eliminate rotations
2272
- // that do not preserve the movelist.
2273
- const mps = [];
2274
- const addrot = [];
2275
- for (let k = 0; k < this.moveplanesets.length; k++) {
2276
- const moveset = this.getmovesets(k);
2277
- mps.push(moveset);
2278
- if (this.options.addRotations) {
2279
- addrot.push(1);
2280
- } else {
2281
- addrot.push(0);
2282
- }
2283
- }
2284
- if (this.options.moveList && this.options.addRotations) {
2285
- for (let i = 0; i < this.moverotations.length; i++) {
2286
- addrot[i] = 0;
2287
- }
2288
- for (let k = 0; k < this.moveplanesets.length; k++) {
2289
- // does a rotation around k preserve the move set?
2290
- for (let i = 0; i < this.moverotations.length; i++) {
2291
- let nn = this.moveplanenormals[k];
2292
- for (let ii = 1; ii * 2 <= this.movesetorders[i]; ii++) {
2293
- nn = nn.rotatepoint(this.moverotations[i][0]);
2294
- if (addrot[i] & ii) {
2295
- continue;
2296
- }
2297
- let found = -1;
2298
- let neg = false;
2299
- for (let j = 0; j < this.moveplanenormals.length; j++) {
2300
- if (nn.dist(this.moveplanenormals[j]) < eps) {
2301
- found = j;
2302
- break;
2303
- } else if (nn.dist(this.moveplanenormals[j].smul(-1)) < eps) {
2304
- found = j;
2305
- neg = true;
2306
- break;
2307
- }
2308
- }
2309
- if (found < 0) {
2310
- throw new Error("Could not find rotation");
2311
- }
2312
- const cmp = mps[found];
2313
- if (
2314
- cmp.length !== mps[k].length ||
2315
- this.moveplanesets[k].length !==
2316
- this.moveplanesets[found].length ||
2317
- this.diffmvsets(
2318
- cmp,
2319
- mps[k],
2320
- this.moveplanesets[found].length,
2321
- neg,
2322
- )
2323
- ) {
2324
- addrot[i] |= ii;
2325
- }
2326
- }
2327
- }
2328
- }
2329
- for (let i = 0; i < this.moverotations.length; i++) {
2330
- if (addrot[i] === 0) {
2331
- addrot[i] = 1;
2332
- } else if (addrot[i] === 1) {
2333
- if (this.movesetorders[i] > 3) {
2334
- addrot[i] = 2;
2335
- } else {
2336
- addrot[i] = 0;
2337
- }
2338
- } else if (addrot[i] === 3) {
2339
- addrot[i] = 0;
2340
- } else {
2341
- throw new Error("Impossible addrot val");
2342
- }
2343
- }
2344
- }
2345
- for (let k = 0; k < this.moveplanesets.length; k++) {
2346
- if (addrot[k] !== 0) {
2347
- mps[k].push([0, this.moveplanesets[k].length]);
2348
- mps[k].push(addrot[k]);
2349
- }
2350
- }
2351
- for (let k = 0; k < this.moveplanesets.length; k++) {
2352
- const moveset = mps[k];
2353
- const movesetorder = this.movesetorders[k];
2354
- // check there's no redundancy in moveset.
2355
- for (let i = 0; i < moveset.length; i += 2) {
2356
- for (let j = 0; j < i; j += 2) {
2357
- if (moveset[i] === moveset[j] && moveset[i + 1] === moveset[j + 1]) {
2358
- throw new Error("Redundant moves in moveset.");
2359
- }
2360
- }
2361
- }
2362
- const allbits = [];
2363
- for (let i = 0; i < moveset.length; i += 2) {
2364
- for (let j = moveset[i][0]; j <= moveset[i][1]; j++) {
2365
- allbits[j] = 1;
2366
- }
2367
- }
2368
- const axiscmoves = this.cmovesbyslice[k];
2369
- for (let i = 0; i < axiscmoves.length; i++) {
2370
- if (allbits[i] !== 1) {
2371
- continue;
2372
- }
2373
- const slicecmoves = axiscmoves[i];
2374
- for (let j = 0; j < slicecmoves.length; j += 2 * movesetorder) {
2375
- if (this.skipcubie(slicecmoves[j])) {
2376
- continue;
2377
- }
2378
- const ind = this.cubiesetnums[slicecmoves[j]];
2379
- setmoves[ind] = 1;
2380
- }
2381
- }
2382
- }
2383
- for (let i = 0; i < this.cubiesetnames.length; i++) {
2384
- if (!setmoves[i]) {
2385
- continue;
2386
- }
2387
- if (this.omitSet(this.cubiesetnames[i])) {
2388
- setmoves[i] = 0;
2389
- continue;
2390
- }
2391
- setnames.push(this.cubiesetnames[i]);
2392
- setdefs.push(
2393
- new PGOrbitDef(
2394
- this.cubieords[i],
2395
- this.options.fixedOrientation ? 1 : this.orbitoris[i],
2396
- ),
2397
- );
2398
- }
2399
- const solved: PGOrbit[] = [];
2400
- for (let i = 0; i < this.cubiesetnames.length; i++) {
2401
- if (!setmoves[i]) {
2402
- continue;
2403
- }
2404
- if (this.omitSet(this.cubiesetnames[i])) {
2405
- continue;
2406
- }
2407
- const p = [];
2408
- const o = [];
2409
- for (let j = 0; j < this.cubieords[i]; j++) {
2410
- if (fortwisty) {
2411
- p.push(j);
2412
- } else {
2413
- const cubie = this.cubiesetcubies[i][j];
2414
- p.push(this.cubievaluemap[cubie]);
2415
- }
2416
- o.push(0);
2417
- }
2418
- solved.push(
2419
- new PGOrbit(
2420
- p,
2421
- o,
2422
- this.options.fixedOrientation ? 1 : this.orbitoris[i],
2423
- ),
2424
- );
2425
- }
2426
- const movenames: string[] = [];
2427
- const moves: PGTransform[] = [];
2428
- if (includemoves) {
2429
- for (let k = 0; k < this.moveplanesets.length; k++) {
2430
- const moveplaneset = this.moveplanesets[k];
2431
- const slices = moveplaneset.length;
2432
- const moveset = mps[k];
2433
- const movesetgeo = this.movesetgeos[k];
2434
- for (let i = 0; i < moveset.length; i += 2) {
2435
- const movebits = moveset[i];
2436
- const mna = getmovename(movesetgeo, movebits, slices);
2437
- const movename = mna[0];
2438
- const inverted = mna[1];
2439
- if (moveset[i + 1] === 1) {
2440
- movenames.push(movename);
2441
- } else {
2442
- movenames.push(movename + moveset[i + 1]);
2443
- }
2444
- const mv = this.getMoveFromBits(
2445
- movebits,
2446
- moveset[i + 1],
2447
- inverted,
2448
- this.cmovesbyslice[k],
2449
- setmoves,
2450
- this.movesetorders[k],
2451
- );
2452
- moves.push(mv);
2453
- }
2454
- }
2455
- }
2456
- let r = new PGOrbitsDef(
2457
- setnames,
2458
- setdefs,
2459
- new VisibleState(solved),
2460
- movenames,
2461
- moves,
2462
- );
2463
- if (this.options.optimizeOrbits) {
2464
- r = r.optimize();
2465
- }
2466
- if (this.options.scrambleAmount !== 0) {
2467
- r.scramble(this.options.scrambleAmount);
2468
- }
2469
- return r;
2470
- }
2471
-
2472
- public getMovesAsPerms(): Perm[] {
2473
- return this.getOrbitsDef(false).moveops.map((_) => _.toPerm());
2474
- }
2475
-
2476
- public showcanon(disp: (s: string) => void): void {
2477
- // show information for canonical move derivation
2478
- showcanon(this.getOrbitsDef(false), disp);
2479
- }
2480
-
2481
- public getsolved(): Perm {
2482
- // get a solved position
2483
- const r = [];
2484
- for (let i = 0; i < this.baseFaceCount; i++) {
2485
- for (let j = 0; j < this.stickersperface; j++) {
2486
- r.push(i);
2487
- }
2488
- }
2489
- return new Perm(r);
2490
- }
2491
-
2492
- // Given a rotation description that says to align feature1
2493
- // with a given vector, and then as much as possible feature2
2494
- // with another given vector, return a Quaternion that
2495
- // performs this rotation.
2496
- private getOrientationRotation(desiredRotation: any[]): Quat {
2497
- const [feature1name, [x1, y1, z1]] = desiredRotation[0];
2498
- const direction1 = new Quat(0, x1, -y1, z1);
2499
-
2500
- const [feature2name, [x2, y2, z2]] = desiredRotation[1];
2501
- const direction2 = new Quat(0, x2, -y2, z2);
2502
- let feature1: Quat | null = null;
2503
- let feature2: Quat | null = null;
2504
- const feature1geoname = this.swizzler.unswizzle(feature1name);
2505
- const feature2geoname = this.swizzler.unswizzle(feature2name);
2506
- for (const gn of this.geonormals) {
2507
- if (feature1geoname === gn[1]) {
2508
- feature1 = gn[0];
2509
- }
2510
- if (feature2geoname === gn[1]) {
2511
- feature2 = gn[0];
2512
- }
2513
- }
2514
- if (!feature1) {
2515
- throw new Error("Could not find feature " + feature1name);
2516
- }
2517
- if (!feature2) {
2518
- throw new Error("Could not find feature " + feature2name);
2519
- }
2520
- const r1 = feature1.pointrotation(direction1);
2521
- const feature2rot = feature2.rotatepoint(r1);
2522
- const r2 = feature2rot
2523
- .unproject(direction1)
2524
- .pointrotation(direction2.unproject(direction1));
2525
- return r2.mul(r1);
2526
- }
2527
-
2528
- private getInitial3DRotation(): Quat {
2529
- const basefacecount = this.baseFaceCount;
2530
- let orientationDescription: FaceBasedOrientationDescription | null = null;
2531
- if (this.options.puzzleOrientation) {
2532
- orientationDescription = this.options.puzzleOrientation;
2533
- } else if (this.options.puzzleOrientations) {
2534
- orientationDescription = this.options.puzzleOrientations[basefacecount];
2535
- }
2536
- // either no option specified or no matching key in
2537
- // puzzleOrientations.
2538
- if (!orientationDescription) {
2539
- orientationDescription = defaultOrientations()[basefacecount];
2540
- }
2541
- if (!orientationDescription) {
2542
- throw new Error("No default orientation?");
2543
- }
2544
- return this.getOrientationRotation(orientationDescription);
2545
- }
2546
-
2547
- private generate2dmapping(
2548
- w: number = 800,
2549
- h: number = 500,
2550
- trim: number = 10,
2551
- threed: boolean = false,
2552
- twodshrink: number = 0.92,
2553
- ): (fn: number, q: Quat) => number[] {
2554
- // generate a mapping to use for 2D for textures, svg
2555
- w -= 2 * trim;
2556
- h -= 2 * trim;
2557
- function extendedges(a: number[][], n: number): void {
2558
- let dx = a[1][0] - a[0][0];
2559
- let dy = a[1][1] - a[0][1];
2560
- const ang = (2 * Math.PI) / n;
2561
- const cosa = Math.cos(ang);
2562
- const sina = Math.sin(ang);
2563
- for (let i = 2; i < n; i++) {
2564
- const ndx = dx * cosa + dy * sina;
2565
- dy = dy * cosa - dx * sina;
2566
- dx = ndx;
2567
- a.push([a[i - 1][0] + dx, a[i - 1][1] + dy]);
2568
- }
2569
- }
2570
- // Find a net from a given face count. Walk it, assuming we locate
2571
- // the first edge from (0,0) to (1,1) and compute the minimum and
2572
- // maximum vertex locations from this. Then do a second walk, and
2573
- // assign the actual geometry.
2574
- this.genperms();
2575
- const boundarygeo = this.getboundarygeometry();
2576
- const face0 = boundarygeo.facenames[0][0];
2577
- const polyn = face0.length; // number of vertices; 3, 4, or 5
2578
- const net = this.net;
2579
- if (net === null) {
2580
- throw new Error("No net?");
2581
- }
2582
- const edges: any = {};
2583
- let minx = 0;
2584
- let miny = 0;
2585
- let maxx = 1;
2586
- let maxy = 0;
2587
- edges[net[0][0]] = [
2588
- [1, 0],
2589
- [0, 0],
2590
- ];
2591
- extendedges(edges[net[0][0]], polyn);
2592
- for (const neti of net) {
2593
- const f0 = neti[0];
2594
- if (!edges[f0]) {
2595
- throw new Error("Bad edge description; first edge not connected.");
2596
- }
2597
- for (let j = 1; j < neti.length; j++) {
2598
- const f1 = neti[j];
2599
- if (f1 === "" || edges[f1]) {
2600
- continue;
2601
- }
2602
- edges[f1] = [edges[f0][j % polyn], edges[f0][(j + polyn - 1) % polyn]];
2603
- extendedges(edges[f1], polyn);
2604
- }
2605
- }
2606
- for (const f in edges) {
2607
- const es = edges[f];
2608
- for (const esi of es) {
2609
- minx = Math.min(minx, esi[0]);
2610
- maxx = Math.max(maxx, esi[0]);
2611
- miny = Math.min(miny, esi[1]);
2612
- maxy = Math.max(maxy, esi[1]);
2613
- }
2614
- }
2615
- const sc = Math.min(w / (maxx - minx), h / (maxy - miny));
2616
- const xoff = 0.5 * (w - sc * (maxx + minx));
2617
- const yoff = 0.5 * (h - sc * (maxy + miny));
2618
- const geos: Record<string, Quat[]> = {};
2619
- const bg = this.getboundarygeometry();
2620
- const edges2: any = {};
2621
- const initv = [
2622
- [sc + xoff, yoff],
2623
- [xoff, yoff],
2624
- ];
2625
- edges2[net[0][0]] = initv;
2626
- extendedges(edges2[net[0][0]], polyn);
2627
- geos[this.facenames[0][1]] = this.project2d(0, 0, [
2628
- new Quat(0, initv[0][0], initv[0][1], 0),
2629
- new Quat(0, initv[1][0], initv[1][1], 0),
2630
- ]);
2631
- const connectat = [];
2632
- connectat[0] = 0;
2633
- for (const neti of net) {
2634
- const f0 = neti[0];
2635
- if (!edges2[f0]) {
2636
- throw new Error("Bad edge description; first edge not connected.");
2637
- }
2638
- let gfi = -1;
2639
- for (let j = 0; j < bg.facenames.length; j++) {
2640
- if (f0 === bg.facenames[j][1]) {
2641
- gfi = j;
2642
- break;
2643
- }
2644
- }
2645
- if (gfi < 0) {
2646
- throw new Error("Could not find first face name " + f0);
2647
- }
2648
- const thisface = bg.facenames[gfi][0];
2649
- for (let j = 1; j < neti.length; j++) {
2650
- const f1 = neti[j];
2651
- if (f1 === "" || edges2[f1]) {
2652
- continue;
2653
- }
2654
- edges2[f1] = [
2655
- edges2[f0][j % polyn],
2656
- edges2[f0][(j + polyn - 1) % polyn],
2657
- ];
2658
- extendedges(edges2[f1], polyn);
2659
- // what edge are we at?
2660
- const caf0 = connectat[gfi];
2661
- const mp = thisface[(caf0 + j) % polyn]
2662
- .sum(thisface[(caf0 + j + polyn - 1) % polyn])
2663
- .smul(0.5);
2664
- const epi = findelement(bg.edgenames, mp);
2665
- const edgename = bg.edgenames[epi][1];
2666
- const el = splitByFaceNames(edgename, this.facenames);
2667
- const gf1 = el[f0 === el[0] ? 1 : 0];
2668
- let gf1i = -1;
2669
- for (let k = 0; k < bg.facenames.length; k++) {
2670
- if (gf1 === bg.facenames[k][1]) {
2671
- gf1i = k;
2672
- break;
2673
- }
2674
- }
2675
- if (gf1i < 0) {
2676
- throw new Error("Could not find second face name");
2677
- }
2678
- const otherface = bg.facenames[gf1i][0];
2679
- for (let k = 0; k < otherface.length; k++) {
2680
- const mp2 = otherface[k].sum(otherface[(k + 1) % polyn]).smul(0.5);
2681
- if (mp2.dist(mp) <= eps) {
2682
- const p1 = edges2[f0][(j + polyn - 1) % polyn];
2683
- const p2 = edges2[f0][j % polyn];
2684
- connectat[gf1i] = k;
2685
- geos[gf1] = this.project2d(gf1i, k, [
2686
- new Quat(0, p2[0], p2[1], 0),
2687
- new Quat(0, p1[0], p1[1], 0),
2688
- ]);
2689
- break;
2690
- }
2691
- }
2692
- }
2693
- }
2694
- let hix = 0;
2695
- let hiy = 0;
2696
- const rot = this.getInitial3DRotation();
2697
- for (let face of this.faces) {
2698
- if (threed) {
2699
- face = face.rotate(rot);
2700
- }
2701
- for (let j = 0; j < face.length; j++) {
2702
- hix = Math.max(hix, Math.abs(face.get(j).b));
2703
- hiy = Math.max(hiy, Math.abs(face.get(j).c));
2704
- }
2705
- }
2706
- const sc2 = Math.min(h / hiy / 2, (w - trim) / hix / 4);
2707
- const mappt2d = (fn: number, q: Quat): number[] => {
2708
- if (threed) {
2709
- q = q.rotatepoint(rot);
2710
- const xoff2 = 0.5 * trim + 0.25 * w;
2711
- const xmul = this.baseplanes[fn].rotateplane(rot).d < 0 ? 1 : -1;
2712
- return [
2713
- trim + w * 0.5 + xmul * (xoff2 - q.b * sc2),
2714
- trim + h * 0.5 + q.c * sc2,
2715
- ];
2716
- } else {
2717
- const g = geos[this.facenames[fn][1]];
2718
- return [
2719
- trim + twodshrink * q.dot(g[0]) + g[2].b,
2720
- trim + h - twodshrink * q.dot(g[1]) - g[2].c,
2721
- ];
2722
- }
2723
- };
2724
- return mappt2d;
2725
- }
2726
-
2727
- public generatesvg(
2728
- w: number = 800,
2729
- h: number = 500,
2730
- trim: number = 10,
2731
- threed: boolean = false,
2732
- ): string {
2733
- const mappt2d = this.generate2dmapping(w, h, trim, threed);
2734
- function drawedges(id: string, pts: number[][], color: string): string {
2735
- return (
2736
- '<polygon id="' +
2737
- id +
2738
- '" class="sticker" style="fill: ' +
2739
- color +
2740
- '" points="' +
2741
- pts.map((p) => p[0] + " " + p[1]).join(" ") +
2742
- '"/>\n'
2743
- );
2744
- }
2745
- // Let's build arrays for faster rendering. We want to map from geo
2746
- // base face number to color, and we want to map from geo face number
2747
- // to 2D geometry. These can be reused as long as the puzzle overall
2748
- // orientation and canvas size remains unchanged.
2749
- const pos = this.getsolved();
2750
- const colormap = [];
2751
- const facegeo = [];
2752
- for (let i = 0; i < this.baseFaceCount; i++) {
2753
- colormap[i] = this.colors[this.facenames[i][1]];
2754
- }
2755
- for (let i = 0; i < this.faces.length; i++) {
2756
- const face = this.faces[i];
2757
- const facenum = Math.floor(i / this.stickersperface);
2758
- const fg = [];
2759
- for (let j = 0; j < face.length; j++) {
2760
- fg.push(mappt2d(facenum, face.get(j)));
2761
- }
2762
- facegeo.push(fg);
2763
- }
2764
- const svg = [];
2765
- // group each base face so we can add a hover element
2766
- for (let j = 0; j < this.baseFaceCount; j++) {
2767
- svg.push("<g>");
2768
- svg.push("<title>" + this.facenames[j][1] + "</title>\n");
2769
- for (let ii = 0; ii < this.stickersperface; ii++) {
2770
- const i = j * this.stickersperface + ii;
2771
- const cubie = this.facetocubie[i];
2772
- const cubieori = this.facetoord[i];
2773
- const cubiesetnum = this.cubiesetnums[cubie];
2774
- const cubieord = this.cubieordnums[cubie];
2775
- const color = this.graybyori(cubie) ? "#808080" : colormap[pos.p[i]];
2776
- let id =
2777
- this.cubiesetnames[cubiesetnum] + "-l" + cubieord + "-o" + cubieori;
2778
- svg.push(drawedges(id, facegeo[i], color));
2779
- if (this.duplicatedFaces[i]) {
2780
- for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
2781
- id = this.cubiesetnames[cubiesetnum] + "-l" + cubieord + "-o" + jj;
2782
- svg.push(drawedges(id, facegeo[i], color));
2783
- }
2784
- }
2785
- }
2786
- svg.push("</g>");
2787
- }
2788
- const html =
2789
- '<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">\n' +
2790
- '<style type="text/css"><![CDATA[' +
2791
- ".sticker { stroke: #000000; stroke-width: 1px; }" +
2792
- "]]></style>\n" +
2793
- svg.join("") +
2794
- "</svg>";
2795
- return html;
2796
- }
2797
-
2798
- // The colorfrac parameter says how much of the face should be
2799
- // colored (vs dividing lines); we default to 0.77 which seems
2800
- // to work pretty well. It should be a number between probably
2801
- // 0.4 and 0.9.
2802
- public get3d(options?: { stickerColors?: string[] }): StickerDat {
2803
- const stickers = [];
2804
- const rot = this.getInitial3DRotation();
2805
- const faces = [];
2806
- const maxdist: number = 0.52 * this.basefaces[0].get(0).len();
2807
- for (let i = 0; i < this.basefaces.length; i++) {
2808
- const coords = this.basefaces[i].rotate(rot);
2809
- const name = this.facenames[i][1];
2810
- faces.push({ coords: toFaceCoords(coords, maxdist), name });
2811
- }
2812
- for (let i = 0; i < this.faces.length; i++) {
2813
- const facenum = Math.floor(i / this.stickersperface);
2814
- const cubie = this.facetocubie[i];
2815
- const cubieori = this.facetoord[i];
2816
- const cubiesetnum = this.cubiesetnums[cubie];
2817
- const cubieord = this.cubieordnums[cubie];
2818
- let color = this.graybyori(cubie)
2819
- ? "#808080"
2820
- : this.colors[this.facenames[facenum][1]];
2821
- if (options?.stickerColors) {
2822
- color = options.stickerColors[i];
2823
- }
2824
- const coords = this.faces[i].rotate(rot);
2825
- stickers.push({
2826
- coords: toFaceCoords(coords, maxdist),
2827
- color,
2828
- orbit: this.cubiesetnames[cubiesetnum],
2829
- ord: cubieord,
2830
- ori: cubieori,
2831
- face: facenum,
2832
- });
2833
- let fcoords = coords;
2834
- if (this.duplicatedFaces[i]) {
2835
- const rotdist = fcoords.length / this.duplicatedFaces[i];
2836
- for (let jj = 1; jj < this.duplicatedFaces[i]; jj++) {
2837
- for (let k = 0; k < rotdist; k++) {
2838
- fcoords = fcoords.rotateforward();
2839
- }
2840
- stickers.push({
2841
- coords: toFaceCoords(fcoords, maxdist),
2842
- color,
2843
- orbit: this.cubiesetnames[cubiesetnum],
2844
- ord: cubieord,
2845
- ori: jj,
2846
- face: facenum,
2847
- isDup: true,
2848
- });
2849
- }
2850
- }
2851
- }
2852
- const grips: StickerDatAxis[] = [];
2853
- for (let i = 0; i < this.movesetgeos.length; i++) {
2854
- const msg = this.movesetgeos[i];
2855
- const order = this.movesetorders[i];
2856
- for (const gn of this.geonormals) {
2857
- if (msg[0] === gn[1] && msg[1] === gn[2]) {
2858
- grips.push({
2859
- coordinates: toCoords(gn[0].rotatepoint(rot), 1),
2860
- quantumMove: new Move(msg[0]),
2861
- order,
2862
- });
2863
- grips.push({
2864
- coordinates: toCoords(gn[0].rotatepoint(rot).smul(-1), 1),
2865
- quantumMove: new Move(msg[2]),
2866
- order,
2867
- });
2868
- }
2869
- }
2870
- }
2871
- const twodmapper = this.generate2dmapping(2880, 2160, 0, false, 1.0);
2872
- const g = (function () {
2873
- const irot = rot.invrot();
2874
- return function (facenum: number, coords: number[]): number[] {
2875
- let q = new Quat(
2876
- 0,
2877
- coords[0] * maxdist,
2878
- -coords[1] * maxdist,
2879
- coords[2] * maxdist,
2880
- );
2881
- q = q.rotatepoint(irot);
2882
- const x = twodmapper(facenum, q);
2883
- x[0] /= 2880;
2884
- x[1] = 1 - x[1] / 2160;
2885
- return x;
2886
- };
2887
- })().bind(this);
2888
- return {
2889
- stickers,
2890
- faces,
2891
- axis: grips,
2892
- unswizzle: this.unswizzle.bind(this),
2893
- notationMapper: this.notationMapper,
2894
- textureMapper: { getuv: g },
2895
- };
2896
- }
2897
-
2898
- // From the name of a geometric element (face, vertex, edge), get a
2899
- // normal vector respecting the default orientation. This is useful
2900
- // to define the initial position of the camera in a 3D scene. The
2901
- // return value is normalized, so multiply it by the camera distance.
2902
- // Returns undefined if no such geometric element.
2903
- public getGeoNormal(geoname: string): number[] | undefined {
2904
- const rot = this.getInitial3DRotation();
2905
- const grip = this.swizzler.unswizzle(geoname);
2906
- for (const gn of this.geonormals) {
2907
- if (grip === gn[1]) {
2908
- const r = toCoords(gn[0].rotatepoint(rot), 1);
2909
- // This routine is intended to use for the camera location.
2910
- // If the camera location is vertical, and we give some
2911
- // near-zero values for x and z, then the rotation in the
2912
- // X/Z plane will be somewhat arbitrary. So we clean up the
2913
- // returned vector here. We give a very slight positive
2914
- // z value.
2915
- if (Math.abs(r[0]) < eps && Math.abs(r[2]) < eps) {
2916
- r[0] = 0.0;
2917
- r[2] = 1e-6;
2918
- }
2919
- return r;
2920
- }
2921
- }
2922
- return undefined;
2923
- }
2924
-
2925
- private getfaceindex(facenum: number): number {
2926
- const divid = this.stickersperface;
2927
- return Math.floor(facenum / divid);
2928
- }
2929
-
2930
- public textForTwizzleExplorer(): string {
2931
- return `Faces ${this.baseplanerot.length}
2932
- Stickers per face ${this.stickersperface}
2933
- Short edge ${this.shortedge}
2934
- Cubies ${this.cubies.length}
2935
- Edge distance ${this.edgedistance}
2936
- Vertex distance ${this.vertexdistance}`;
2937
- }
2938
-
2939
- writeSchreierSims(tw: (s: string) => void) {
2940
- const os = this.getOrbitsDef(false);
2941
- const as = os.reassemblySize();
2942
- tw(`Reassembly size is ${as}`);
2943
- const ss = schreierSims(this.getMovesAsPerms(), tw);
2944
- const r = as / ss;
2945
- tw(`Ratio is ${r}`);
2946
- }
2947
- }
2948
-
2949
- class PGNotation implements MoveNotation {
2950
- private cache: { [key: string]: KTransformation } = {};
2951
- private orbitNames: string[];
2952
- constructor(private pg: PuzzleGeometry, od: PGOrbitsDef) {
2953
- this.orbitNames = od.orbitnames;
2954
- }
2955
-
2956
- public lookupMove(move: Move): KTransformation | undefined {
2957
- const key = this.moveToKeyString(move);
2958
- if (key in this.cache) {
2959
- return this.cache[key];
2960
- }
2961
- const mv = this.pg.parseMove(move);
2962
- // if a move list subset is defined, don't return moves outside the subset.
2963
- if (this.pg.parsedmovelist) {
2964
- let found = false;
2965
- for (const parsedmove of this.pg.parsedmovelist) {
2966
- if (
2967
- parsedmove[1] === mv[1] &&
2968
- parsedmove[2] === mv[2] &&
2969
- parsedmove[3] === mv[3] &&
2970
- parsedmove[4] === mv[4]
2971
- ) {
2972
- found = true;
2973
- }
2974
- }
2975
- if (!found) {
2976
- return undefined;
2977
- }
2978
- }
2979
- let bits = [mv[2], mv[3]];
2980
- if (!mv[4]) {
2981
- const slices = this.pg.moveplanesets[mv[1]].length;
2982
- bits = [slices - mv[3], slices - mv[2]];
2983
- }
2984
- const pgmv = this.pg.getMoveFromBits(
2985
- bits,
2986
- mv[5],
2987
- !mv[4],
2988
- this.pg.cmovesbyslice[mv[1]],
2989
- undefined,
2990
- this.pg.movesetorders[mv[1]],
2991
- );
2992
- const r = PGOrbitsDef.transformToKPuzzle(this.orbitNames, pgmv);
2993
- this.cache[key] = r;
2994
- return r;
2995
- }
2996
-
2997
- // This is only used to construct keys, so does not need to be beautiful.
2998
- private moveToKeyString(move: Move): string {
2999
- let r = "";
3000
- if (move.outerLayer) {
3001
- r = r + move.outerLayer + ",";
3002
- }
3003
- if (move.innerLayer) {
3004
- r = r + move.innerLayer + ",";
3005
- }
3006
- r = r + move.family + "," + move.amount;
3007
- return r;
3008
- }
3009
- }