Skip to the content

Suido水道

Turn pipes to connect the pumps and drains, through fixed levels or seeded puzzles.

Suido means water supply in Japanese. About the name

Contents

Reference · Pipes, rules and solving

Layouttype

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 it

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

Definition

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

Members

NameTypeDescription
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 (optional)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 (optional)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 (optional)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 (optional)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.

Examples

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

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/suido 1.7.0.