Skip to the content

Kyuubuキューブ

Turn CSS 3D cubes by touch, keys or notation, reproduce a scramble from a seed, and follow a solve one named step at a time.

Kyuubu (キューブ) is the Japanese spelling of cube. About the name

Contents

Reference

Cuboid engine

import { … } from "@johnmorrisdotca/kyuubu/cuboid";

9.4 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
CUBOID_MAX_SIDEconstantThe most a side of a cuboid can be.
CUBOID_MIN_SIDEconstantThe least a side of a cuboid can be.
CUBOID_PRESETSconstantThe named cuboids, smallest first.
CUBOID_RANDOM_STATE_MAXconstantThe most states a cuboid has and still has its scramble drawn uniformly out of all of them.
CUBOID_WORDSconstantThe cuboid's words in both languages.
CuboidDimstypeThe width, height and depth of a cuboid, in cubies: each a whole number from 1 to 7.
cuboidDragAnglefunctionThe angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way.
CuboidDragPicktypeThe layer a drag has picked: its axis and layer, the way across the screen (a unit vector, x right and y down) that turns it forwards by the right-hand rule, and whether it can only be turned by a half turn.
CuboidFacetypeOne face of a cuboid: how many columns and rows of stickers it has as it is seen from outside, and where its stickers begin in the state.
cuboidFaceMovefunctionA face turned, depth layers in from it (1 is the face itself), on this cuboid: the move, or why not.
cuboidFacesfunctionThe six faces of a cuboid, in the order the state is written, with their size and where each begins.
CuboidFaulttypeWhy a piece of notation is not a move on this cuboid.
CuboidKeyReadingtypeWhat a key means on a cuboid: a turn, a depth for the next face letter, or nothing.
cuboidLayerOffunctionThe layer, 0 to the axis's depth − 1 from its negative side, that a cubie centre sits in.
CuboidLineReadingtypeWhat reading a line gives: its moves, or the first piece that is not one, where it began (counted in characters from 0) and why.
cuboidMiddleMovefunctionThe middle layer of an odd side, turned as M, E or S: the move, or why not.
CuboidMovetypeOne turn of a layer: its axis, its layer from the axis's negative side (0 to the axis's depth − 1), and one, two or three quarter turns by the right-hand rule.
cuboidMoveForReleasefunctionThe move a release makes: the picked layer turned by those quarters, or null for none.
cuboidMoveLegalfunctionWhether a move can be made on this cuboid: its layer exists, is not the whole puzzle, and its turn is one that layer may make.
cuboidMoveNamefunctionWhat a move of a cuboid turns, in a few plain words, in English or Japanese: R2 is "Right face, twice", 2U2 "Up layer 2, twice", M2 "Middle slice, twice".
cuboidMoveNotationfunctionA move as a person writes it on this cuboid: R, R', R2, 2U2, M2.
cuboidMovesNotationfunctionMoves as a person writes them, a space between each.
cuboidNamefunctionA cuboid's name as it is written: 2×3×3.
cuboidPastCommitfunctionWhether a held layer is past its point of no return: letting go now, at rest, makes a move.
cuboidPermutationOffunctionWhere every sticker goes under a legal turn: to[i] is the slot the sticker in slot i lands on.
cuboidPresetfunctionThe named cuboid with this key, or undefined.
CuboidPresettypeTHE NAMED CUBOIDS: the shapes people know, each with a name, the way it is best seen, and a line on what makes it different.
cuboidQuartersForReleasefunctionWhat letting go makes of a dragged layer, as quarter turns from −2 to 2, where 0 is back where it was.
CuboidReadingtypeWhat reading one piece of notation gives: the move, or why it is not one.
CuboidReplayFaulttypeWhy a cuboid replay could not be planned: which text would not read, where and why.
CuboidReplayPlantypeA cuboid solve ready to be played: a ReplayPlan whose size is the longest side, with the puzzle's own dims.
CuboidReplaySourcetypeWhat a cuboid replay is made from.
cuboidScrambleLengthfunctionHow many turns a random walk that scrambles a cuboid has: 8, and 2.2 for every layer that is not the whole puzzle, up to 100.
cuboidSlotsfunctionEvery sticker slot of a cuboid, in the order its state is written, and the way back from a slot to its place.
cuboidSolvedfunctionSOLVED: every face one colour, whichever colour it is, so a cuboid solved and then turned whole in the hand is still solved.
cuboidStickerCountfunctionHow many stickers a cuboid has: the area of its surface.
CuboidWordstypeTHE CUBOID'S OWN WORDS, in English and Japanese: what a screen reader calls it and what is said when a move cannot be made.
faultSaysfunctionThe line that says why a piece of notation is not a move on a cuboid.
HALF_TURN_COMMITconstantThe point of no return of a half turn, in degrees: the middle of the way round.
halfTurnOnlyfunctionWhether a layer turns only by a half turn: it has a slice that is not square.
hasRandomStateScramblefunctionWhether a cuboid has few enough states to be scrambled to one drawn uniformly out of all of them.
isCuboidDimsfunctionWhether this is a cuboid the package makes: three whole numbers from 1 to 7, and not 1×1×1, which has nothing to turn.
isCuboidStatefunctionWhether a string is a state of a cuboid this size: the right length, and each face's letter as many times as the face has stickers.
legalCuboidMovesfunctionEvery move a cuboid can make, by axis, layer and turn.
legalTurnsfunctionThe turns a layer can make: [1, 2, 3] where its slice is square, [2] where it is not, and none where there is no such layer or the layer is the whole puzzle.
parseCuboidDimsfunctionA cuboid read from 2x3x3, 2×3×3, 2 3 3 or 2,3,3: its dims, or null where it is not one the package makes.
parseCuboidMovefunctionOne piece of notation as a move, or null where it is not one on this cuboid.
parseCuboidMovesfunctionA line of notation as moves, or null where any of it is not a move on this cuboid.
pickCuboidDragfunctionThe layer a drag across a sticker means, once it can be told: null while the pointer has not gone far enough, while the two layers that carry the sticker are too nearly as likely as each other, or where neither can turn.
planCuboidReplayfunctionA scramble and a solve read, checked and timed.
randomCuboidScramblefunctionA scramble.
readCuboidKeyfunctionWhat a key means on a cuboid, given the depth a digit before it set (1 where none did): the cube's keys (readKey) without the turns of the whole cube.
readCuboidMovefunctionOne piece of notation read for this cuboid: R, R', R2, 2R', M2.
readCuboidMovesfunctionA line of notation read for this cuboid, saying which piece is wrong and why where one is.
sameCuboidfunctionWhether two cuboids are the same puzzle turned about in the hand: the same three sides in any order.
sliceOffunctionThe two axes a layer across axis is a slice of, and so what its slice measures: the other two sides.
solvedCuboidfunctionA solved cuboid: each face one letter.
turnAllCuboidfunctionThe state after every turn in order.
turnCuboidfunctionThe state after one turn; an illegal turn throws a RangeError.
undoCuboidMovefunctionThe turn that takes one back.
undoCuboidMovesfunctionA list of moves undone, last first.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kyuubu 1.14.1.