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

CellStatetype

How one cell is to look.

Import it

import type { CellState } from "@johnmorrisdotca/suido/draw";

Definition

type CellState = {
    cell: number;
    quarters: number;
    wet: boolean;
    depth: number;
    arms: [
        ArmState,
        ArmState,
        ArmState,
        ArmState
    ];
};

Members

NameTypeDescription
cellnumber
quartersnumber

Quarter turns clockwise from the piece as the board gave it, as the drawing turns it.

wetboolean
depthnumber

Cells the water went through to reach it, 0 for a pump; -1 for a dry cell.

arms[ArmState, ArmState, ArmState, ArmState]

What the water does at each of the piece's four sides as drawn (the sides it had as the board gave it, not as it faces now): "in" where it comes in, "out" where it goes on, "leak" where it runs out of an open end, "" for no water or no opening.

Examples

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

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

What it prints (run when this page was built)

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