randomScramble関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A scramble of length turns, each of one layer chosen at random, never two
in a row about the same axis, so no turn undoes or joins the one before it
and the count is the count. Never leaves the cube solved: a turn is added
until it is not.
random is a number in [0, 1), like Math.random; pass a seeded one
(seededRandom) to get the same scramble from the same seed everywhere.
With faces, only the six outer faces are turned.
インポート
import { randomScramble } from "@johnmorrisdotca/kyuubu";
定義
function randomScramble(n: number, length: number, random?: () => number, options?: ScrambleOptions): CubeMove[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
n | number | The cube’s side length. |
length | number | The requested number of scramble moves; omitted cuboid lengths use its scrambling strategy. |
random (省略可) | () => number | A source of numbers in [0, 1), such as seededRandom(seed). |
options (省略可) | ScrambleOptions | Options for this call; omitted fields retain their documented defaults. |
戻り値
CubeMove[]
A scramble of length turns, each of one layer chosen at random, never two in a row about the same axis, so no turn undoes or joins the one before it and the count is the count. Never leaves the cube solved: a turn is added until it is not. random is a number in [0, 1), like Math.random; pass a seeded one (seededRandom) to get the same scramble from the same seed everywhere. With faces, only the six outer faces are turned.
例
import { movesNotation, randomScramble, seededRandom } from "@johnmorrisdotca/kyuubu";
console.log(movesNotation(randomScramble(3, 8, seededRandom("docs")), 3));U F2 L D2 F E B' L'出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。