リファレンス
キューブのエンジンと表示
import { … } from "@johnmorrisdotca/kyuubu";
最小化と gzip 圧縮をしたサイズは 38.7 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
algorithmName | 関数 | The name of one of the method's algorithms, as a person would say it: "Three corners round", 「コーナーの三点交換」. |
applySolve | 関数 | A cube after these steps. |
CliResult | 型 | What the command line came to: the exit code, and what goes to standard output and standard error. |
CliSurroundings | 型 | What the command line is told about where it runs. |
CliWords | 型 | The command line's words: its help, its refusals and what it reports. |
Cloth | 型 | A cloth's name. |
clothVars | 関数 | A cloth as CSS variables; nothing for a name that is not a cloth, so the defaults stay. |
COMMIT_ANGLE | 定数 | The point of no return, in degrees, where none is given: let go short of it and the layer goes back. |
countsAsMove | 関数 | Whether a move counts towards a solve's moves: a turn of the whole cube in the hand does not. |
countSolveMoves | 関数 | How many of the steps count as moves: every turn, and no turn of the whole cube. |
CUBE_FACE_ORDER | 定数 | The faces in the order a state is written: up, right, front, down, left, back. |
CUBE_OPTION_GROUPS | 定数 | The order the groups are shown in, with what each is called. |
CUBE_OPTIONS | 定数 | Every choice the package offers, grouped, with what each is called in each way of making a cube. |
CUBE_OPTIONS_LEFT_OUT | 定数 | What is not a choice, by the way of making a cube that has it and its name there, each with why: a function, a value that is itself the state, a list that needs a program to write. |
CUBE_SCALE_INTERACTIVE | 定数 | What a cube drawn at each scale is, apart from its width: a small one is for looking at, so it is not turned by a hand or a key unless asked. |
CUBE_SCALE_PX | 定数 | How wide each is, in pixels: a cube is as tall as it is wide. |
CUBE_SCALES | 定数 | HOW BIG A CUBE IS DRAWN, as a setting: small for a list or a picker, medium, and large. |
CUBE_THEMES | 定数 | Looks that come with the package. |
CubeAxis | 型 | An axis of the cube: 0 is x (to the right), 1 is y (up) and 2 is z (towards the viewer). |
CubeFace | 型 | A face's letter: U, R, F, D, L or B. |
CubeFaceLetter | 型 | A face as the notation names it. |
CubeMaker | 型 | The three ways a cube is made. |
CubeMove | 型 | One turn: a layer, or the whole cube, turned about an axis by one, two or three quarter turns. |
cubeNet | 関数 | The cube unfolded flat, as lines of text: the top above the front, the left, front, right and back in a row, and the bottom below. |
CubeOption | 型 | One choice. |
CubeScale | 型 | One of the three. |
cubeSlots | 関数 | Every sticker slot of a cube of this size, in the order its state is written, and the way back from a slot to its place. |
cubeSolved | 関数 | SOLVED: every face one colour. |
CubeTheme | 型 | How a cube looks: its six colours, its plastic, and the shape of a sticker. |
CubeTurns | 型 | One, two or three quarter turns, counter-clockwise seen from the axis's positive end. |
CubeView | クラス | A cube on the screen. |
CubeViewEvents | 型 | What a cube tells the listeners on adds: a turn a person made, with the stickers after it; and the view turned, in degrees. |
CubeViewOptions | 型 | Everything a cube on the screen can be told when it is made. |
cubeWidthPx | 関数 | The width in pixels a cube is drawn at: width when it is a number above zero, and otherwise the scale's. |
CubeWords | 型 | THE WORDS THE CUBE ITSELF SAYS, in English and Japanese: what a screen reader calls it, whether it is solved, the names of the steps of a solve and what each is for, and the names of the method's algorithms. |
decodeCubeMoves | 関数 | The moves written in a code, or null where any of it is not a move. |
DEFAULT_COLOURS | 定数 | The standard colours, by the letter a solved face carries: white up, red right, green front, yellow down, orange left, blue back. |
DEFAULT_PLASTIC | 定数 | The colour of the plastic between the stickers, where none is given. |
DRAG_CLEAR_RATIO | 定数 | How much more one layer must go the pointer's way than the other to be picked before that. |
DRAG_DECIDE_PX | 定数 | How far it goes before a drag that could be either of two layers picks the likelier anyway. |
DRAG_START_PX | 定数 | How far the pointer goes, in pixels, before a drag picks a layer at all. |
dragAngle | 関数 | The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. |
dragHint | 関数 | The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). |
DragHint | 型 | What to drag to make a turn of one layer, or of several about one axis as one (a wide turn). |
DragPick | 型 | The layer a drag has picked: its axis and layer, and the way across the screen (a unit vector, x right and y down) that turns it forwards by the right-hand rule. |
encodeCubeMoves | 関数 | Moves written three characters each, such as x23y02z*1: compact, and readable without knowing the cube's size. |
FACE_FRAMES | 定数 | Which way each face looks, and its rows and columns as the face is seen from outside, in the order above. |
FACE_PROPERTIES | 定数 | The CSS custom property that colours each face, where no colour is given in code: set it on the cube's element or any ancestor. |
faceMove | 関数 | A face turned, depth layers in from it (1 is the face itself), on a cube of this size; null where the cube has no such layer. |
faceOfNormal | 関数 | The face whose outward normal this is. |
faceOfSlot | 関数 | The face letter a solved cube shows at this slot. |
fill | 関数 | A line of a table with its braces filled in: fill("A {n}×{n} cube", { n: 3 }) is "A 3×3 cube". |
FLICK_ANGLE | 定数 | The least a flick must have turned the layer, in degrees. |
FLICK_SPEED | 定数 | A flick: the layer still turning this fast the drag's own way, in degrees a millisecond, when the pointer lets go. |
fromJSON | 関数 | The solves in a JSON export, or null where the text is not one: not JSON, not this format, or a later one. |
fromText | 関数 | A solve read back from plain lines, or null where they are not one. |
FULL_SCRAMBLE_LENGTHS | 定数 | The lengths official competitions scramble each size to, near enough: what a "full" scramble means here. |
Guide | クラス | A guide through a list of moves or the method's steps, for a cube of side n starting from state. |
GUIDE_CSS | 定数 | The guide's stylesheet, put in the page once. |
GuideHandle | 型 | A guide beside a cube, on the page. |
GuideHeard | 型 | What a guide made of a turn it was told of: the movement finished, part of it made, a detour, or a detour taken back by hand. |
GuidePanelOptions | 型 | How a guide beside a cube is set up: what it walks, and how it speaks. |
GuideSource | 型 | What a guide walks: moves as written ("R U R' U'", wide turns and rotations read as parseSolve reads them), or as moves, each a movement; or the layer-by-layer method, step by step from the cube as it is (2×2 and 3×3). |
GuideStep | 型 | The movement a guide asks for now. |
HINT_MIN_FACING | 定数 | How squarely a face must face the viewer for an arrow to be drawn on it: the cosine of its angle to the eye. |
HINT_MIN_FOLLOW | 定数 | How closely a drag along the arrow must go the way the layer turns: the cosine between them. |
HintArrow | 型 | The arrow a hint draws, in the cube's doubled units (a sticker is 2 across), lying on a face. |
isCloth | 関数 | Whether a text names a cloth. |
isCubeScale | 関数 | Whether a value is one of the three scales. |
isCubeState | 関数 | Whether a string is a state of a cube this size: the right length, and the right number of every colour. |
joinTurns | 関数 | Turns of one layer in a row written as one, and any that come to nothing left out: "U' U2" is "U", "U' U" is nothing. |
keepScrambling | 関数 | Keep a cube turning. |
KeepScramblingHandle | 型 | What a running loop can be told. |
KeepScramblingOptions | 型 | How it is run. |
KeyReading | 型 | What a key means: a turn, a depth for the next face letter, or nothing. |
KYUUBU_CLOTHS | 定数 | THE CLOTHS A PLAYER'S STAGE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards: green, blue, red, black and wood. |
KyuubuLanguage | 型 | The two languages the package speaks. |
KyuubuStrings | 型 | Every word the package says: the cube's and the command line's. |
languageOf | 関数 | The language a tag names, as far as the package speaks it: anything beginning "ja" is Japanese, and the rest is English. |
layerOf | 関数 | The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in. |
Mat3 | 型 | A 3×3 matrix, rows of three. |
MAX_CLI_COUNT | 定数 | The most scrambles the command line makes at once. |
MAX_CLI_LENGTH | 定数 | The longest scramble the command line will make. |
MAX_RECORD_MOVES | 定数 | The most turns one record may hold, scramble and solve each. |
MAX_RECORD_SEED | 定数 | The longest seed kept with a solve. |
MAX_RECORD_SIZE | 定数 | The largest cube a record may be of: the package is made and tested for 2×2 to 7×7. |
MAX_RECORDS | 定数 | The most solves read from one file. |
MAX_REPLAY_STEPS | 定数 | The longest solve a replay takes, in steps. |
middleMove | 関数 | The middle layer of an odd cube, turned as M, E or S; null on an even cube, which has none. |
MIN_RECORD_SIZE | 定数 | The smallest cube a record may be of. |
mountGuide | 関数 | A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. |
mountMoveList | 関数 | A list of moves drawn in an element. |
MOVE_LIST_CSS | 定数 | The list's stylesheet, put in the page once. |
moveFits | 関数 | Whether a move can be made on a cube of this size. |
moveForDrag | 関数 | The turn a drag across a sticker means: the layer that carries it most nearly the way the pointer went, that way. |
moveForRelease | 関数 | The move a release makes: the picked layer turned by those quarters, or null for none. |
moveForWheel | 関数 | The turn the wheel means over a sticker. |
MoveListGroup | 型 | A run of moves under a heading: a scramble, a solution. |
MoveListHandle | 型 | A list on the page. |
MoveListItem | 型 | One move of a list: its code, what it turns in words (worked out from the code when left out), and the name a screen reader gives its button (the code and the words when left out). |
MoveListOptions | 型 | How a list is set up. |
movementSays | 関数 | A movement in plain words, for a cube held with its front towards you: "Turn the right face away from you.", 「右の面を奥に回します。」. |
movementText | 関数 | A movement in notation: one layer as moveNotation writes it; several layers from a face inwards, about one axis and as far, as a wide turn (Rw, 3Rw'); anything else as its moves one after another. |
moveName | 関数 | What a move turns, in a few plain words, in English or Japanese; null for anything that is not a move in standard form. |
moveNotation | 関数 | A move as a person writes it, for a cube of this size. |
movesForRelease | 関数 | Every layer a release turns: the picked layer, and the one beside it where the drag took a seam, each by those quarters; none for none. |
movesNotation | 関数 | Moves as a person writes them, a space between each. |
nextTurn | 関数 | One random layer, a quarter or a half turn either way, never about the axis the last one used, so it never undoes or joins it. |
NotationFault | 型 | Why a line of notation could not be read, and where. |
OptionGroup | 型 | What the choices are gathered under, in the order a page shows them. |
OptionKind | 型 | How a choice is made: a number in a range, on or off, one of a few, a colour, or text (moves are text with notation in it). |
paceSeconds | 関数 | Seconds for a pace given as a number or a name; the default for anything else. |
parseMove | 関数 | One move read back from the notation, for a cube of this size, or null where it is not one: R, R', R2, 2R', M2, x'. |
parseMoves | 関数 | A line of notation read back, or null where any of it is not a move on this cube. |
parseSolve | 関数 | A solve, or a scramble, read from the way it is written, for a cube of this size. |
parseSolveMove | 関数 | One written step read for a cube of this size, or why it is not one. |
pastCommit | 関数 | Whether a dragged layer is past the point of no return: letting go now, at rest, makes a move. |
permutationOf | 関数 | Where every sticker goes under one turn: to[i] is the slot the sticker in slot i lands on. |
pickDrag | 関数 | The layer a drag across a sticker means, once it can be told: null while the pointer has not gone far enough, or while the two layers that carry the sticker are too nearly as likely as each other. |
planReplay | 関数 | A scramble and a solve read, checked and timed. |
prefersReducedMotion | 関数 | Whether this device asks for less motion. |
quartersForRelease | 関数 | What letting go makes of a dragged layer: the quarter turns it snaps to, from −2 to 2, where 0 is back where it was and no move at all. |
quarterTurn | 関数 | A quarter turn counter-clockwise, seen from the axis's positive end. |
randomScramble | 関数 | A scramble of length turns, each of one layer chosen at random, never two in a row about the same axis, so no turn undoes or joins the one before it and the count is the count. |
readKey | 関数 | What a key means on a cube of side n, given the depth a digit before it set (1 where none did). |
readSolveLink | 関数 | A solve read out of a link to alg.cubing.net, the page most reconstructions are shared by, so that a person can paste the address and not copy two boxes by hand. |
RECORD_FORMAT | 定数 | The version of the JSON's shape. |
Replay | クラス | A planned solve played on a cube: play, pause, a step either way, anywhere by seek, faster or slower, once or over and over. |
REPLAY_LOOP_REST_MS | 定数 | How long a looped replay rests on the solved cube before it begins again, in milliseconds. |
REPLAY_SCRAMBLE_STEP_MS | 定数 | How long each turn of the scramble takes when the replay walks through it, in milliseconds. |
REPLAY_SCRUB_MS | 定数 | How long each turn made by moving the slider takes, in milliseconds. |
REPLAY_SCRUB_TURNS | 定数 | How many turns moving the slider shows one by one: a longer jump goes straight to this many steps short of where it is going, and turns the rest. |
REPLAY_SPEEDS | 定数 | The speeds a replay offers: the solve's own pace, half, a quarter and a tenth of it. |
REPLAY_STEP_MS | 定数 | How long a step takes when the solve gives no time of its own, in milliseconds. |
ReplayClock | 型 | The clock a replay runs by; the page's own unless a test gives another. |
ReplayCube | 型 | The part of a cube's view a replay needs: CubeView is one. |
ReplayFault | 型 | Why a replay could not be planned: which text would not read, and where. |
ReplayOptions | 型 | How a replay is set up. |
ReplayPlan | 型 | A solve ready to be played: read, checked and timed. |
ReplaySource | 型 | What a replay is made from. |
ReplayStatus | 型 | What a replay tells whoever is showing it. |
rotationHint | 関数 | WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. |
rotationKeys | 関数 | The key or keys that make a turn of the whole cube: X, Shift+X, X X. |
runCli | 関数 | The whole command line. |
SCRAMBLE_DEFAULT_PACE | 定数 | The pace when none is given: one turn a second. |
SCRAMBLE_PACES | 定数 | How often it turns, in seconds, by name. |
SCRAMBLE_SHORTEST | 定数 | The shortest wait it allows, in seconds: faster is a blur, and a page that asks for it gets this. |
Scrambled | 型 | What the loop turns: the cube on the screen has all of it. |
ScrambleOptions | 型 | How a scramble is made. |
ScramblePace | 型 | One of those names. |
ScramblePage | 型 | The part of a page the loop listens to: a Document is one. |
scrubPath | 関数 | What moving the slider from one position of a solve to another turns: the steps between, forwards when going on and each one undone, last first, when going back. |
ScrubPath | 型 | The turns that take a cube from one position of a solve to another, for a slider that turns the cube as it moves. |
Seam | 型 | A seam a hand has taken hold of: a turn about this axis would carry the layer the sticker is in and the one beside it, together. |
SEAM_BAND | 定数 | How near a seam between two layers a touch lands to take both: this share of a sticker's width on each side of the line between them, so that the middle of a sticker, and a little more than half of its width, is still the one layer. |
seamsAt | 関数 | The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across. |
seededRandom | 関数 | A SEEDED RANDOM SOURCE: the same seed gives the same numbers, in the same order, on every device and in every version from 1.1.0 on. |
SOLVABLE_SIZES | 定数 | The sizes the method is written for. |
SOLVE_ALGORITHMS | 定数 | The algorithms the method uses, by name. |
SolveAlgorithm | 型 | The name of one of the method's algorithms: a key of SOLVE_ALGORITHMS. |
solvedCube | 関数 | A solved cube of this size. |
SolveLink | 型 | A solve as a link carries it: its scramble, its moves, and its title where it has one. |
SolveMove | 型 | One thing a solver did: a turn, a wide turn or a turn of the whole cube. |
solveMoves | 関数 | Every layer a list of steps turns, in order: what turnAll takes. |
SolvePart | 型 | A part of a step: turns to line something up, or one of the method's algorithms. |
SolveReading | 型 | What reading a solve gives: its steps, or the first thing that could not be read. |
SolveRecord | 型 | One solve: the cube's size, the scramble that mixed it, and the turns made after. |
SolveStage | 型 | The stages of the method, in the order they are done. |
SolveStep | 型 | One step of a solve: its stage, the turns that do it, and the parts they come in. |
solveSteps | 関数 | The layer-by-layer solve of a 2×2 or 3×3 in this state, as steps a person can follow, or null for a size the method is not written for. |
SolveSummary | 型 | What a record comes to, worked out from its turns. |
solveText | 関数 | The steps written out in standard form, a space between each. |
stageName | 関数 | The name of a step of the solve, as a person would say it: "White cross", 「白のクロス」. |
stageSays | 関数 | What a step of the solve is for, in a sentence: "Make a yellow cross on the top." |
StickerSlot | 型 | Where one sticker slot sits: its cubie's centre and the direction it faces. |
STRINGS | 定数 | The package's words in both languages. |
summarize | 関数 | A record's scramble and turns in notation, the cube before and after, whether it ended solved, and its count of moves. |
toCSV | 関数 | A list of solves as CSV, for a spreadsheet: a header, then a row a solve, with lines ended CRLF as RFC 4180 has them. |
toJSON | 関数 | One solve or many, as JSON: { "format": 1, "generator": "kyuubu 1.1.0", "solves": [ … ] }. |
toText | 関数 | A solve as a few plain lines, to paste in a chat or a note: |
turnAll | 関数 | The state after every turn in order. |
turnCube | 関数 | The state after one turn. |
undoAll | 関数 | A list of moves undone, last first. |
undoOf | 関数 | The move that takes this one back. |
Vec3 | 型 | A point in the cube's doubled coordinates: a cubie's centre is a whole even or odd step from the middle, by the cube's size. |
VERSION | 定数 | The package's version, as in package.json. |
viewMatrix | 関数 | The way the viewer looks at the cube: turned about the model's y (yaw), then tipped about the screen's x (pitch), in degrees. |
wholeMove | 関数 | The whole cube turned in the hand, as x, y or z. |
WORDS | 定数 | The cube's words in both languages. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。