Reference · Rules, solvers and generation
orderByDifficultyfunction
The order to play a size's levels in: easiest first, by score, and among
equal scores by their order in levels so the ranking is the same every
time it is made. Returns indexes into levels.
Import it
import { orderByDifficulty } from "@johnmorrisdotca/tsunagi";
Definition
function orderByDifficulty(levels: readonly (readonly [string, string])[], size: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
levels | readonly (readonly [string, string])[] | Layout/answer rows in their current order. |
size | number | The number of cells on each side of the board. |
Returns
number[]
The order to play a size's levels in: easiest first, by score, and among equal scores by their order in levels so the ranking is the same every time it is made. Returns indexes into levels.
Examples
import { orderByDifficulty } from "@johnmorrisdotca/tsunagi";
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
console.log(orderByDifficulty([TSUNAGI_4[0]],4));[ 0 ]What it prints (run when this page was built)