placeBlocks関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Places blocks on a board of width by height, where near is the table of neighbours with no walls
(neighboursOf): bigs big pieces, each of a kind drawn at random facing a way that has no opening
off the edge of the board, and turning blocks that turn as one. No two overlap, no big piece touches
another big piece along a side, and none stands across the edge of a board that wraps. Fewer are placed
where the board has no room for them.
インポート
import { placeBlocks } from "@johnmorrisdotca/suido";
定義
function placeBlocks(near: Int32Array, width: number, height: number, bigs: number, turning: number, random: Random, mix?: BigMix): Placed[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
near | Int32Array<ArrayBufferLike> | The board neighbour table. |
width | number | The board width in cells. |
height | number | The board height in cells. |
bigs | number | The desired number of big pieces. |
turning | number | The desired number of blocks that turn together. |
random | Random | A random source returning values in [0,1). |
mix (省略可) | BigMix | The supported big-piece family mix. |
戻り値
Placed[]
Places blocks on a board of width by height, where near is the table of neighbours with no walls (neighboursOf): bigs big pieces, each of a kind drawn at random facing a way that has no opening off the edge of the board, and turning blocks that turn as one. No two overlap, no big piece touches another big piece along a side, and none stands across the edge of a board that wraps. Fewer are placed where the board has no room for them.
例
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout, neighboursOf, placeBlocks, seededRandom } from "@johnmorrisdotca/suido";
const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
console.log(placeBlocks(neighboursOf(layout),layout.width,layout.height,1,0,seededRandom(42)));この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。