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

CuboidReplayPlantype

A cuboid solve ready to be played: a ReplayPlan whose size is the longest side, with the puzzle's own dims.

Import it

import type { CuboidReplayPlan } from "@johnmorrisdotca/kyuubu/cuboid";

Definition

type CuboidReplayPlan = ReplayPlan & {
    dims: CuboidDims;
};

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.

dimsCuboidDims

The puzzle's width, height and depth.

Examples

import type { CuboidReplayPlan } from "@johnmorrisdotca/kyuubu/cuboid";
import { planCuboidReplay } from "@johnmorrisdotca/kyuubu/cuboid";

function requireCuboidPlan() {
  const result = planCuboidReplay({ dims: [2, 3, 3], scramble: "R", solution: "R'" });
  if (!result.ok) throw new Error("Invalid replay");
  return result.plan;
}

const value: CuboidReplayPlan = requireCuboidPlan();
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.