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

nextTurnfunction

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.

Import it

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

Definition

function nextTurn(n: number, last: CubeMove | null, random: () => number, faces: boolean): CubeMove

Parameters

NameTypeDescription
nnumber

The cube’s side length.

lastCubeMove | null

The preceding move, or null when there is none.

random() => number

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

facesboolean

Whether only outer faces may turn.

Returns

CubeMove

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.

Examples

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

console.log(nextTurn(3, null, seededRandom("docs"), true));
{ axis: 1, layer: 2, turns: 3 }

What it prints (run when this page was built)

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