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

regionsAreSoundfunction

Whether region divides a size×size grid into size regions of size cells each, every one of them joined edge to edge. O(cells): a check of a Jigsaw asks it of whatever regions it was sent.

Import it

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

Definition

function regionsAreSound(size: number, region: readonly number[]): boolean

Parameters

NameTypeDescription
sizenumber

The supported square grid side length.

regionreadonly number[]

The row-major region number of every cell.

Returns

boolean

Whether region divides a size×size grid into size regions of size cells each, every one of them joined edge to edge. O(cells): a check of a Jigsaw asks it of whatever regions it was sent.

Examples

import { boxedLayout, regionsAreSound } from "@johnmorrisdotca/kazu";

console.log(regionsAreSound(4,boxedLayout(4).region));
true

What it prints (run when this page was built)

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