本文へ移動

Suido水道

管を回してポンプと排水口をつなぎます。収録された問題やシード付きの問題で遊べます。

「水道」は、水を届ける設備を表す言葉です。 名前について(英語)

目次

リファレンス · 管・ルール・解法

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[]

引数

名前型説明
nearInt32Array<ArrayBufferLike>

The board neighbour table.

widthnumber

The board width in cells.

heightnumber

The board height in cells.

bigsnumber

The desired number of big pieces.

turningnumber

The desired number of blocks that turn together.

randomRandom

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)));

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

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