Reference · Rules, solvers and generation
portalExitfunction
The cell a line comes out at after stepping from from into portal cell into: beyond the other portal, the same way on; -1 where there is none (off the board, or across a wall).
Import it
import { portalExit } from "@johnmorrisdotca/tsunagi";
Definition
function portalExit(layout: LinkLayout, from: number, into: number): number
Parameters
| Name | Type | Description |
|---|---|---|
layout | LinkLayout | The decoded native board and its rule settings. |
from | number | The preceding cell of a portal step. |
into | number | The cell entered by the step. |
Returns
number
The cell a line comes out at after stepping from from into portal cell into: beyond the other portal, the same way on; -1 where there is none (off the board, or across a wall).
Examples
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { decodeLayout, portalExit } from "@johnmorrisdotca/tsunagi";
const givens = TSUNAGI_4[0][0];
const layout = decodeLayout(givens,4)!;
console.log(portalExit(layout,0,1));-1What it prints (run when this page was built)