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 · Regions rules

generateRegionsfunction

Makes a seeded puzzle and proves its answer is the only one. The board is cut into connected regions, each holding its own size, with no two of one size touching; every square starts given, and givens are taken away for as long as the puzzle can still be solved the way the level asks: easy and medium by the rules alone (easy keeps most givens), hard by supposing one number at a time, extra-hard for as long as the answer stays single. If no board of the level is found within the attempts the next level down is tried, and a puzzle that gives every square is the last resort.

Import it

import { generateRegions } from "@johnmorrisdotca/kazu/regions";

Also exported from: @johnmorrisdotca/kazu

Definition

function generateRegions(width?: number, height?: number, level?: RegionsLevel, seed?: number): RegionsPuzzle

Parameters

NameTypeDescription
width (optional)number

The supported board width in cells.

height (optional)number

The supported board height in cells.

level (optional)RegionsLevel

The requested native difficulty tier.

seed (optional)number

The reproducible native puzzle seed.

Returns

RegionsPuzzle

Makes a seeded puzzle and proves its answer is the only one. The board is cut into connected regions, each holding its own size, with no two of one size touching; every square starts given, and givens are taken away for as long as the puzzle can still be solved the way the level asks: easy and medium by the rules alone (easy keeps most givens), hard by supposing one number at a time, extra-hard for as long as the answer stays single. If no board of the level is found within the attempts the next level down is tried, and a puzzle that gives every square is the last resort.

Examples

import { generateRegions } from "@johnmorrisdotca/kazu/regions";

console.log(generateRegions(5,5,"easy",42));

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