Reference · Cube engine and views
planReplayfunction
A scramble and a solve read, checked and timed. A solve that does not end
on a solved cube is still planned, with solved: false, so that it can be
shown and said to be unfinished; only text that cannot be read is refused.
Import it
import { planReplay } from "@johnmorrisdotca/kyuubu";
Definition
function planReplay(source: ReplaySource): { ok: true; plan: ReplayPlan; } | { ok: false; fault: ReplayFault; }
Parameters
| Name | Type | Description |
|---|---|---|
source | ReplaySource | The scramble and solution to plan, or the guide’s explicit moves or solving method. |
Returns
{ ok: true; plan: ReplayPlan; } | { ok: false; fault: ReplayFault; }
A scramble and a solve read, checked and timed. A solve that does not end on a solved cube is still planned, with solved: false, so that it can be shown and said to be unfinished; only text that cannot be read is refused.
Examples
import { planReplay } from "@johnmorrisdotca/kyuubu";
console.log(planReplay({ size: 3, scramble: "R U", solution: "U' R'", timeMs: 1000 }));{
ok: true,
plan: {
size: 3,
scramble: [ [Object], [Object] ],
steps: [ [Object], [Object] ],
start: 'UUUUUUFFFUBBRRRRRRRRRFFDFFDDDBDDBDDBFFDLLLLLLLLLUBBUBB',
scrambleStates: [
'UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB',
'UUFUUFUUFRRRRRRRRRFFDFFDFFDDDBDDBDDBLLLLLLLLLUBBUBBUBB',
'UUUUUUFFFUBBRRRRRRRRRFFDFFDDDBDDBDDBFFDLLLLLLLLLUBBUBB'
],
states: [
'UUUUUUFFFUBBRRRRRRRRRFFDFFDDDBDDBDDBFFDLLLLLLLLLUBBUBB',
'UUFUUFUUFRRRRRRRRRFFDFFDFFDDDBDDBDDBLLLLLLLLLUBBUBBUBB',
'UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB'
],
solved: true,
stepMs: [ 500, 500 ],
totalMs: 1000,
pace: 'spread'
}
}What it prints (run when this page was built)