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

readCuboidKeyfunction

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. On a layer that only half turns, the key turns it a half, whichever way Shift says, because that is the only turn it has.

Import it

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

Definition

function readCuboidKey(key: string, shift: boolean, dims: CuboidDims, depth: number): CuboidKeyReading

Parameters

NameTypeDescription
keystring

The pressed key, or the cuboid preset key for a lookup.

shiftboolean

Whether Shift reverses the key’s turn.

dimsCuboidDims

The cuboid’s x, y and z dimensions, in that order.

depthnumber

The layer depth counted from the named face, starting at 1.

Returns

CuboidKeyReading

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. On a layer that only half turns, the key turns it a half, whichever way Shift says, because that is the only turn it has.

Examples

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

const dims = [2, 3, 3] as const;
console.log(readCuboidKey("u", false, dims, 1));
{ move: { axis: 1, layer: 2, turns: 2 } }

What it prints (run when this page was built)

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