本文へ移動

Suido水道

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

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

目次

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

Layout型

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

A board. network: every piece must end up wet, and no wet piece may open on nothing. drains: every drain must be reached, and no wet piece may open on nothing; a piece the water does not reach is a spare, and may face any way. inlet-outlet: one pump and one drain, each an end piece; the water must run from the one to the other through one unbranched path (every wet piece opens on two sides and no more), with nothing left open. Spares may face any way.

インポート

import type { Layout } from "@johnmorrisdotca/suido";

定義

type Layout = {
    width: number;
    height: number;
    kind: Kind;
    wrap: boolean;
    cells: number[];
    sources: number[];
    drains: number[];
    locked?: readonly number[];
    walls?: readonly number[];
    bigs?: readonly number[];
    blocks?: readonly number[];
};

メンバー

名前型説明
widthnumber
heightnumber
kindKind
wrapboolean

Whether the edges join: the east of the last column is the first, the south of the last row the top.

cellsnumber[]

The sides each piece opens on, as the board is given or as it is turned; 0 is blank ground.

sourcesnumber[]

The cells the water comes from, in order.

drainsnumber[]

The cells the water must reach, in order.

locked (省略可)readonly number[] | undefined

The cells whose piece cannot be turned: it stays facing as the board gives it, which for an answer's board is the way it faces in the answer. Ascending. Left out of a board that has none.

walls (省略可)readonly number[] | undefined

The walls: edges between two cells that water cannot cross, so a piece opening on one runs out of it as it does at the edge of the board. An edge is cell * 2 for the wall on the east side of cell and cell * 2 + 1 for the one on its south side (for a board that wraps, the east of the last column and the south of the last row are real edges). Ascending. Left out of a board that has none.

bigs (省略可)readonly number[] | undefined

The BIG PIECES: squares of four cells that are one piece. Each is named by its top left cell (the anchor), ascending. A tap turns the whole square a quarter in place: the piece in each of its cells moves round to the next cell and turns with it. Inside a big piece the pipes join: wherever two of its cells meet, either both open towards each other or neither does. Only a network has them, and they never overlap, never hold a pump, a drain, a locked piece or a wall between two of their cells, and never cross the edge of a board that wraps. Left out of a board that has none (blocks.ts).

blocks (省略可)readonly number[] | undefined

The BLOCKS THAT TURN AS ONE: like big pieces, squares of four cells that a tap turns together a quarter, but each of the four pieces is its own, with no rule about how they join inside, and a tap on any of them turns the square. Named and kept to the same rules as bigs, and no cell is in both lists. Left out of a board that has none.

例

import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout } from "@johnmorrisdotca/suido";
import type { Layout } from "@johnmorrisdotca/suido";

const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
const value: Layout = layout;
console.log(value);
{
  width: 5,
  height: 5,
  kind: 'network',
  wrap: false,
  cells: [
    3, 5, 10,  5, 2,  5,  8,  5,
    9, 8, 11,  7, 5, 15,  7, 10,
    6, 2,  2, 10, 3,  5, 10,  8,
    2
  ],
  sources: [ 0 ],
  drains: [
     4,  6,  9, 17,
    18, 23, 24
  ]
}

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

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

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