turnsOffunction
The answer to a board as one digit a cell: how many quarter turns clockwise each piece needs, the fewest. Null when solution is not the board's pieces turned.
Import it
import { turnsOf } from "@johnmorrisdotca/suido/levels";
Also exported from: @johnmorrisdotca/suido/levels-info
Definition
function turnsOf(layout: Layout, solution: readonly number[]): string | null
Parameters
| Name | Type | Description |
|---|---|---|
layout | Layout | The decoded board with its dimensions, pipe masks and rule settings. |
solution | readonly number[] | The solved pipe masks in row-major cell order. |
Returns
string | null
The answer to a board as one digit a cell: how many quarter turns clockwise each piece needs, the fewest. null when solution is not the board's pieces turned.
Examples
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { decodeLayout } from "@johnmorrisdotca/suido";
import { levelSolution, turnsOf } from "@johnmorrisdotca/suido/levels";
const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
const solution = levelSolution(row)!;
console.log(turnsOf(layout,solution));1101202133111021323101003What it prints (run when this page was built)