Reference · Rules, solvers and generation
twistRolefunction
A level's part in its block's lesson, or null for a level that has none (1 to
14, or a 15th or 16th left plain because somebody had played it). newOnes
are the challenges no earlier level of the size has: what a 15th introduces.
Import it
import { twistRole } from "@johnmorrisdotca/tsunagi";
Definition
function twistRole(layouts: readonly string[], level: number): TwistRole | null
Parameters
| Name | Type | Description |
|---|---|---|
layouts | readonly string[] | The layout codes in one level collection. |
level | number | The one-based level number. |
Returns
TwistRole | null
A level's part in its block's lesson, or null for a level that has none (1 to 14, or a 15th or 16th left plain because somebody had played it). newOnes are the challenges no earlier level of the size has: what a 15th introduces.
Examples
import { twistRole } from "@johnmorrisdotca/tsunagi";
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
console.log(twistRole(TSUNAGI_4.map(([code])=>code),15));nullWhat it prints (run when this page was built)