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 · Cube engine and views

randomScramblefunction

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. Never leaves the cube solved: a turn is added until it is not.

random is a number in [0, 1), like Math.random; pass a seeded one (seededRandom) to get the same scramble from the same seed everywhere. With faces, only the six outer faces are turned.

Import it

import { randomScramble } from "@johnmorrisdotca/kyuubu";

Definition

function randomScramble(n: number, length: number, random?: () => number, options?: ScrambleOptions): CubeMove[]

Parameters

NameTypeDescription
nnumber

The cube’s side length.

lengthnumber

The requested number of scramble moves; omitted cuboid lengths use its scrambling strategy.

random (optional)() => number

A source of numbers in [0, 1), such as seededRandom(seed).

options (optional)ScrambleOptions

Options for this call; omitted fields retain their documented defaults.

Returns

CubeMove[]

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. Never leaves the cube solved: a turn is added until it is not. random is a number in [0, 1), like Math.random; pass a seeded one (seededRandom) to get the same scramble from the same seed everywhere. With faces, only the six outer faces are turned.

Examples

import { movesNotation, randomScramble, seededRandom } from "@johnmorrisdotca/kyuubu";

console.log(movesNotation(randomScramble(3, 8, seededRandom("docs")), 3));
U F2 L D2 F E B' L'

What it prints (run when this page was built)

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