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

How-to

Replay a solve

Check a solve's notation, replay it with a player, set its timing and save it as a record.

Validate the notation first

planReplay distinguishes a refused input from a valid but unfinished solve. ok: false identifies the failed part. ok: true supplies the states and timing; inspect plan.solved to know whether the last state is solved.

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

const result = planReplay({ size: 3, scramble: "R U", solution: "U' R'", timeMs: 1200 });
if (result.ok) console.log(result.plan.solved, result.plan.totalMs);
else console.log(result.fault.part, result.fault.fault?.token);
true 1200

Mount the controls

The player entry draws the cube, move list, slider and controls without requiring React. Autoplay is optional.

import { mountPlayer } from "@johnmorrisdotca/kyuubu/player";

const host = document.createElement("div");
document.body.append(host);
const player = mountPlayer(host, { scramble: "R U", solution: "U' R'", autoplay: false, locale: "en" });
console.log(player.plan?.solved);
player.seek(1);
// Call player.destroy() when removing it.

Choose timing and records

timeMs spreads the recorded solve time across its moves; stepMs supplies per-step timing. speed changes playback without rewriting the plan. Famous solves is a separate data entry; import it only when needed. The longer walkthrough remains in Replay.

Save a solve

A SolveRecord stores size, scramble moves, solve moves and optional timing, date and seed. toJSON/fromJSON and toText/fromText provide round trips; CSV, Markdown and SQL downloads are described in List downloads.

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