Skip to the content

Kazu数

Generate checked Sudoku and logic puzzles, read native rules and hints, and draw or embed playable boards.

Kazu is the Japanese word 数 for number. About the name

Contents

Reference · Number-puzzle engines

encodeRegionsfunction

The region of every cell as a letter, a for the first region and so on: one character a cell.

Import it

import { encodeRegions } from "@johnmorrisdotca/kazu";

Definition

function encodeRegions(regions: readonly number[]): string

Parameters

NameTypeDescription
regionsreadonly number[]

The row-major region index of every cell.

Returns

string

The region of every cell as a letter, a for the first region and so on: one character a cell.

Examples

import { decodeJigsaw, encodeRegions } from "@johnmorrisdotca/kazu";

const jigsaw = decodeJigsaw(".1.34....33..12...45423..bbaaacbaaecbeeecbddeccddd",5)!;
console.log(encodeRegions(jigsaw.regions));
bbaaacbaaecbeeecbddeccddd

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kazu 2.1.0.