本文へ移動

Kyuubuキューブ

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

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

目次

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

Replayクラス

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

A planned solve played on a cube: play, pause, a step either way, anywhere by seek, faster or slower, once or over and over.

インポート

import { Replay } from "@johnmorrisdotca/kyuubu";

定義

class Replay
new Replay(cube: ReplayCube, plan: ReplayPlan, options?: ReplayOptions): Replay

引数

名前型説明
cubeReplayCube

The host’s cube state and turning interface.

planReplayPlan

The validated replay plan.

options (省略可)ReplayOptions

View or replay options.

メンバー

名前型説明
planReplayPlan
statusReplayStatus

Where it is and what it is doing.

play(): void

Run from where it is; from the beginning when it is at the end.

pause(): void

Stop where it is.

restart(): void

Back to the scrambled cube, and wait there: the solve as it was before its first move, until it is played.

step(by: 1 | -1): void

One step on, or one back, and stop there. A step on is turned, and a step back is turned the other way, each as long as the other: the cube shows the move being made and taken back, never a jump. At the scrambled cube a step back stays there (seekScramble goes into the scramble); once gone back into the scramble, steps walk it.

walk(by: 1 | -1): void

One move on or back along the scramble and the solve together, turned: step, except that a step back from the scrambled cube turns the scramble's last move undone, so that Back can go on into the scramble.

seek(position: number, { animate }?: { animate?: boolean; }): void

Straight to the cube as it was after this many steps; it goes on running if it was. With animate, the turns between where it was and where it goes are shown, forwards going on and each undone going back (scrubPath), so a slider turns the cube the right way as it moves; a jump of many steps catches up at once. A solve gone back into the scramble is not animated.

seekScramble(position: number): void

Straight to the cube as it was after this many steps of the scramble, the whole of it being the scrambled cube the solve starts from; it goes on running if it was, on through the rest of the scramble and the solve.

setSpeed(speed: number): void

Faster or slower from the next step: 1 is the solve's own pace, 0.5 half of it.

setLoop(loop: boolean): void

Whether it begins again when it ends.

destroy(): void

Stop, and leave the cube as it is.

例

import { Replay, cubeSolved, planReplay, turnAll } from "@johnmorrisdotca/kyuubu";

const result = planReplay({ scramble: "R", solution: "R'" });
if (result.ok) {
  let state = result.plan.start;
  const replay = new Replay({ setState: (next) => { state = next; }, turnTogether: (moves) => { state = turnAll(state, 3, moves); } }, result.plan);
  replay.seek(result.plan.steps.length);
  console.log(cubeSolved(state, 3));
  replay.destroy();
}
true

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

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

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