Reference · Rules, solvers and generation
pressAtfunction
A press: the lines after it, and the pair now being drawn, or null where the press draws nothing.
Import it
import { pressAt } from "@johnmorrisdotca/tsunagi";
Definition
function pressAt(layout: LinkLayout, lines: Lines, cell: number): { lines: Lines; drawing: number | null; }
Parameters
| Name | Type | Description |
|---|---|---|
layout | LinkLayout | The decoded native board and its rule settings. |
lines | Lines | The native cell lists for every pair. |
cell | number | The zero-based pointer target cell. |
Returns
{ lines: Lines; drawing: number | null; }
The lines and drawing pair; drawing is null when the press starts no line.
Examples
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { decodeLayout, noLines, pressAt } from "@johnmorrisdotca/tsunagi";
const givens = TSUNAGI_4[0][0];
const layout = decodeLayout(givens,4)!;
const lines = noLines(layout);
console.log(pressAt(layout,lines,layout.ends[0][0]));{ lines: [ [ 0 ], [], [], [] ], drawing: 0 }What it prints (run when this page was built)