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

Guideclass

A guide through a list of moves or the method's steps, for a cube of side n starting from state.

Import it

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

Definition

class Guide
new Guide(state: string, n: number, source: GuideSource): Guide

Parameters

NameTypeDescription
statestring

The initial sticker-state string.

nnumber

The cube’s side length.

sourceGuideSource

Explicit guide moves or the solving method.

Members

NameTypeDescription
nnumber

The cube's side.

statestring

The cube as the guide has it: where it started, with every turn it has been told of or has handed out.

nextGuideStep | null

The movement to make now, or null when there is nothing left to make. While there is a detour it is still the movement to come back to.

detoursreadonly CubeMove[]

The turns made that were not asked for, oldest first.

donenumber

How many movements have been finished, over every step of the method.

finishedboolean

Whether there is nothing left to make.

heard(move: CubeMove): GuideHeard

A turn made on the cube, by a person or anything else, told to the guide. "done": that finished the movement, and next is the one after. "part": it was part of it, and next asks for the rest. "off": it was not asked for, and is kept as a detour. "back": it undid the last detour.

takeBack(): CubeMove[]

The turns that take every detour back, last first, as the guide now has them made: turn them on the cube without telling the guide again.

makeNext(): CubeMove[]

Every detour taken back and the movement made, as the guide now has it: the turns to make on the cube, without telling the guide again.

Examples

import { Guide, parseMove, solvedCube } from "@johnmorrisdotca/kyuubu";

const guide = new Guide(solvedCube(3), 3, { moves: "R U" });
console.log(guide.next?.text);
console.log(guide.heard(parseMove("R", 3)!));
R
done

What it prints (run when this page was built)

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