本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス · キューブのエンジンと表示

ReplayPlan型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

定義

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

メンバー

名前型説明
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.

例

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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kyuubu 1.14.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。