本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス

直方体のエンジン

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

最小化と gzip 圧縮をしたサイズは 9.4 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

エクスポート

名前種類概要
CUBOID_MAX_SIDE定数The most a side of a cuboid can be.
CUBOID_MIN_SIDE定数The least a side of a cuboid can be.
CUBOID_PRESETS定数The named cuboids, smallest first.
CUBOID_RANDOM_STATE_MAX定数The most states a cuboid has and still has its scramble drawn uniformly out of all of them.
CUBOID_WORDS定数The cuboid's words in both languages.
CuboidDims型The width, height and depth of a cuboid, in cubies: each a whole number from 1 to 7.
cuboidDragAngle関数The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way.
CuboidDragPick型The 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.
CuboidFace型One 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.
cuboidFaceMove関数A face turned, depth layers in from it (1 is the face itself), on this cuboid: the move, or why not.
cuboidFaces関数The six faces of a cuboid, in the order the state is written, with their size and where each begins.
CuboidFault型Why a piece of notation is not a move on this cuboid.
CuboidKeyReading型What a key means on a cuboid: a turn, a depth for the next face letter, or nothing.
cuboidLayerOf関数The layer, 0 to the axis's depth − 1 from its negative side, that a cubie centre sits in.
CuboidLineReading型What reading a line gives: its moves, or the first piece that is not one, where it began (counted in characters from 0) and why.
cuboidMiddleMove関数The middle layer of an odd side, turned as M, E or S: the move, or why not.
CuboidMove型One 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.
cuboidMoveForRelease関数The move a release makes: the picked layer turned by those quarters, or null for none.
cuboidMoveLegal関数Whether 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.
cuboidMoveName関数What 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".
cuboidMoveNotation関数A move as a person writes it on this cuboid: R, R', R2, 2U2, M2.
cuboidMovesNotation関数Moves as a person writes them, a space between each.
cuboidName関数A cuboid's name as it is written: 2×3×3.
cuboidPastCommit関数Whether a held layer is past its point of no return: letting go now, at rest, makes a move.
cuboidPermutationOf関数Where every sticker goes under a legal turn: to[i] is the slot the sticker in slot i lands on.
cuboidPreset関数The named cuboid with this key, or undefined.
CuboidPreset型THE NAMED CUBOIDS: the shapes people know, each with a name, the way it is best seen, and a line on what makes it different.
cuboidQuartersForRelease関数What letting go makes of a dragged layer, as quarter turns from −2 to 2, where 0 is back where it was.
CuboidReading型What reading one piece of notation gives: the move, or why it is not one.
CuboidReplayFault型Why a cuboid replay could not be planned: which text would not read, where and why.
CuboidReplayPlan型A cuboid solve ready to be played: a ReplayPlan whose size is the longest side, with the puzzle's own dims.
CuboidReplaySource型What a cuboid replay is made from.
cuboidScrambleLength関数How 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.
cuboidSlots関数Every sticker slot of a cuboid, in the order its state is written, and the way back from a slot to its place.
cuboidSolved関数SOLVED: every face one colour, whichever colour it is, so a cuboid solved and then turned whole in the hand is still solved.
cuboidStickerCount関数How many stickers a cuboid has: the area of its surface.
CuboidWords型THE CUBOID'S OWN WORDS, in English and Japanese: what a screen reader calls it and what is said when a move cannot be made.
faultSays関数The line that says why a piece of notation is not a move on a cuboid.
HALF_TURN_COMMIT定数The point of no return of a half turn, in degrees: the middle of the way round.
halfTurnOnly関数Whether a layer turns only by a half turn: it has a slice that is not square.
hasRandomStateScramble関数Whether a cuboid has few enough states to be scrambled to one drawn uniformly out of all of them.
isCuboidDims関数Whether this is a cuboid the package makes: three whole numbers from 1 to 7, and not 1×1×1, which has nothing to turn.
isCuboidState関数Whether 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.
legalCuboidMoves関数Every move a cuboid can make, by axis, layer and turn.
legalTurns関数The 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.
parseCuboidDims関数A 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.
parseCuboidMove関数One piece of notation as a move, or null where it is not one on this cuboid.
parseCuboidMoves関数A line of notation as moves, or null where any of it is not a move on this cuboid.
pickCuboidDrag関数The 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.
planCuboidReplay関数A scramble and a solve read, checked and timed.
randomCuboidScramble関数A scramble.
readCuboidKey関数What 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.
readCuboidMove関数One piece of notation read for this cuboid: R, R', R2, 2R', M2.
readCuboidMoves関数A line of notation read for this cuboid, saying which piece is wrong and why where one is.
sameCuboid関数Whether two cuboids are the same puzzle turned about in the hand: the same three sides in any order.
sliceOf関数The two axes a layer across axis is a slice of, and so what its slice measures: the other two sides.
solvedCuboid関数A solved cuboid: each face one letter.
turnAllCuboid関数The state after every turn in order.
turnCuboid関数The state after one turn; an illegal turn throws a RangeError.
undoCuboidMove関数The turn that takes one back.
undoCuboidMoves関数A list of moves undone, last first.

ソースを見るGitHub で編集@johnmorrisdotca/kyuubu 1.14.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。