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 · SVG board

cellStatesfunction

The state of every piece of a board whose pieces face as masks say. A piece is named by the cell it was given in, which is where it is unless it is in a block that turns as one (blocks.ts): the block carries it round, so its water is read where it is now, and its quarters are the block's.

Import it

import { cellStates } from "@johnmorrisdotca/suido/draw";

Definition

function cellStates(layout: Layout, masks?: readonly number[], quarters?: readonly number[], flow?: Flow): CellState[]

Parameters

NameTypeDescription
layoutLayout

The decoded board with its dimensions, pipe masks and rule settings.

masks (optional)readonly number[]

Current pipe masks in row-major cell order.

quarters (optional)readonly number[] | undefined

Clockwise quarter turns, per cell or for the piece specified by the signature.

flow (optional)Flow

Optional previously computed water flow for these masks.

Returns

CellState[]

The state of every piece of a board whose pieces face as masks say. A piece is named by the cell it was given in, which is where it is unless it is in a block that turns as one (blocks.ts): the block carries it round, so its water is read where it is now, and its quarters are the block's.

Examples

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

const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
console.log(cellStates(layout).slice(0,2));
[
  {
    cell: 0,
    quarters: 0,
    wet: true,
    depth: 0,
    arms: [ 'leak', 'leak', '', '' ]
  },
  {
    cell: 1,
    quarters: 0,
    wet: false,
    depth: -1,
    arms: [ '', '', '', '' ]
  }
]

What it prints (run when this page was built)

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