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

ReplayPlantype

A solve ready to be played: read, checked and timed.

Import it

import type { ReplayPlan } from "@johnmorrisdotca/kyuubu";

Definition

type ReplayPlan = {
    size: number;
    scramble: SolveMove[];
    steps: SolveMove[];
    start: string;
    scrambleStates: string[];
    states: string[];
    solved: boolean;
    stepMs: number[];
    totalMs: number;
    pace: "spread" | "given" | "default";
};

Members

NameTypeDescription
sizenumber

The cube's side.

scrambleSolveMove[]

The scramble's steps.

stepsSolveMove[]

The solve's steps.

startstring

The cube after the scramble: where a replay starts.

scrambleStatesstring[]

The cube after every step of the scramble, scrambleStates[k] being the cube after k of them: scrambleStates[0] is the solved cube and the last is start.

statesstring[]

The cube after every step, states[k] being the cube after k steps; states[0] is start.

solvedboolean

Whether the last of them is a solved cube, whichever way up.

stepMsnumber[]

How long each step takes at the solve's own pace, in milliseconds.

totalMsnumber

The whole time at the solve's own pace, in milliseconds.

pace"spread" | "given" | "default"

Whether the pace is the solve's own recorded time spread evenly, a time given for each step, or only a steady default.

Examples

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

function requirePlan() {
  const result = planReplay({ scramble: "R", solution: "R'" });
  if (!result.ok) throw new Error("Invalid replay");
  return result.plan;
}

const value: ReplayPlan = requirePlan();
console.log(value.solved);
true

What it prints (run when this page was built)

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