Guideクラス
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A guide through a list of moves or the method's steps, for a cube of side
n starting from state.
インポート
import { Guide } from "@johnmorrisdotca/kyuubu";
定義
class Guide
new Guide(state: string, n: number, source: GuideSource): Guide
引数
| 名前 | 型 | 説明 |
|---|---|---|
state | string | The initial sticker-state string. |
n | number | The cube’s side length. |
source | GuideSource | Explicit guide moves or the solving method. |
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
n | number | The cube's side. |
state | string | The cube as the guide has it: where it started, with every turn it has been told of or has handed out. |
next | GuideStep | null | The movement to make now, or null when there is nothing left to make. While there is a detour it is still the movement to come back to. |
detours | readonly CubeMove[] | The turns made that were not asked for, oldest first. |
done | number | How many movements have been finished, over every step of the method. |
finished | boolean | Whether there is nothing left to make. |
heard | (move: CubeMove): GuideHeard | A turn made on the cube, by a person or anything else, told to the guide.
|
takeBack | (): CubeMove[] | The turns that take every detour back, last first, as the guide now has them made: turn them on the cube without telling the guide again. |
makeNext | (): CubeMove[] | Every detour taken back and the movement made, as the guide now has it: the turns to make on the cube, without telling the guide again. |
例
import { Guide, parseMove, solvedCube } from "@johnmorrisdotca/kyuubu";
const guide = new Guide(solvedCube(3), 3, { moves: "R U" });
console.log(guide.next?.text);
console.log(guide.heard(parseMove("R", 3)!));R
done出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。