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
| Name | Type | Description |
|---|---|---|
size | number | The cube's side. |
scramble | SolveMove[] | The scramble's steps. |
steps | SolveMove[] | The solve's steps. |
start | string | The cube after the scramble: where a replay starts. |
scrambleStates | string[] | The cube after every step of the scramble, |
states | string[] | The cube after every step, |
solved | boolean | Whether the last of them is a solved cube, whichever way up. |
stepMs | number[] | How long each step takes at the solve's own pace, in milliseconds. |
totalMs | number | 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);trueWhat it prints (run when this page was built)