Reference · Rules, solvers and generation
difficultyScoresfunction
Each level's score, 0 (easiest) to 100 (hardest), as the blend of its four
percentiles among measures — one size's levels. A percentile is the share
of the other levels strictly below it, so ties share a place and the score
of a set of one is 0.
Import it
import { difficultyScores } from "@johnmorrisdotca/tsunagi";
Definition
function difficultyScores(measures: readonly LevelMeasure[], size: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
measures | readonly LevelMeasure[] | Native level measures to compare within this size. |
size | number | The number of cells on each side of the board. |
Returns
number[]
Each level's score, 0 (easiest) to 100 (hardest), as the blend of its four percentiles among measures — one size's levels. A percentile is the share of the other levels strictly below it, so ties share a place and the score of a set of one is 0.
Examples
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { difficultyScores, measureSolved } from "@johnmorrisdotca/tsunagi";
const givens = TSUNAGI_4[0][0];
const answer = TSUNAGI_4[0][1];
const measure = measureSolved(givens,answer,4,{nodes:1,branches:0})!;
console.log(difficultyScores([measure],4));[ 0 ]What it prints (run when this page was built)