Reference · Pipes, rules and solving
blockQuartersBetweenfunction
How many quarters clockwise, 0 to 3, make the block's pieces in from the ones in to; null when no turn does.
Import it
import { blockQuartersBetween } from "@johnmorrisdotca/suido";
Definition
function blockQuartersBetween(from: readonly number[], to: readonly number[], block: Block): number | null
Parameters
| Name | Type | Description |
|---|---|---|
from | readonly number[] | The original pipe mask or mask array specified by the signature. |
to | readonly number[] | The desired pipe mask or mask array specified by the signature. |
block | Block | The zero-based ladder block index, or decoded four-cell block specified by the signature. |
Returns
number | null
How many quarters clockwise, 0 to 3, make the block's pieces in from the ones in to; null when no turn does.
Examples
import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { blockInfo, blockQuartersBetween, decodeLayout, turnBlock } from "@johnmorrisdotca/suido";
const row = SUIDO_5X5[0];
const code = row[0];
const layout = decodeLayout(code)!;
const blockLayout = {...layout,bigs:[0]};
const block = blockInfo(blockLayout).blocks[0];
console.log(blockQuartersBetween(blockLayout.cells,turnBlock(blockLayout.cells,block),block));1What it prints (run when this page was built)