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

paintSuidofunction

Update the existing board SVG with current facings and water, returning its flow state.

Import it

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

Definition

function paintSuido(svg: Element, layout: Layout, masks: readonly number[], quarters: readonly number[]): Flow

Parameters

NameTypeDescription
svgElement

The existing native SVG board element.

layoutLayout

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

masksreadonly number[]

Current pipe masks in row-major cell order.

quartersreadonly number[]

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

Returns

Flow

Update the existing board SVG with current facings and water, returning its flow state.

Examples

import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout, newGame } from "@johnmorrisdotca/suido";
import { levelSolution } from "@johnmorrisdotca/suido/levels";
import { drawSuido, paintSuido } from "@johnmorrisdotca/suido/draw";

const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
const solution = levelSolution(row)!;
const game = newGame(code)!;
const host = document.createElement("div");
document.body.append(host);
host.innerHTML = drawSuido(layout);
const svg = host.querySelector("svg")!;
console.log(paintSuido(svg,layout,solution,game.quarters).solved);

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