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
| Name | Type | Description |
|---|---|---|
svg | Element | The existing native SVG board element. |
layout | Layout | The decoded board with its dimensions, pipe masks and rule settings. |
masks | readonly number[] | Current pipe masks in row-major cell order. |
quarters | readonly 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);