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

generateAkarifunction

Makes a seeded board and proves it has one answer. A random wall of black squares is lit by randomly placed bulbs, every black square that touches a white one is numbered, and then numbers 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 of its numbers), hard by supposing one square at a time, extra-hard for as long as the answer stays single, which leaves a board that needs more supposing than that. If no board of the level is found within the attempts, the next one down is tried; if none of the levels finds one, the same is tried again with more black squares, which a large board needs to be solvable at all (see AKARI_DENSER_CROWDS). The fixed lattice of the first generator is only what is left if even that fails, which no seed does at any size offered.

Import it

import { generateAkari } from "@johnmorrisdotca/kazu/akari";

Also exported from: @johnmorrisdotca/kazu

Definition

function generateAkari(width?: number, height?: number, seed?: number, level?: AkariLevel): AkariPuzzle

Parameters

NameTypeDescription
width (optional)number

The supported board width in cells.

height (optional)number

The supported board height in cells.

seed (optional)number

The reproducible native puzzle seed.

level (optional)AkariLevel

The requested native difficulty tier.

Returns

AkariPuzzle

Makes a seeded board and proves it has one answer. A random wall of black squares is lit by randomly placed bulbs, every black square that touches a white one is numbered, and then numbers 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 of its numbers), hard by supposing one square at a time, extra-hard for as long as the answer stays single, which leaves a board that needs more supposing than that. If no board of the level is found within the attempts, the next one down is tried; if none of the levels finds one, the same is tried again with more black squares, which a large board needs to be solvable at all (see AKARI_DENSER_CROWDS). The fixed lattice of the first generator is only what is left if even that fails, which no seed does at any size offered.

Examples

import { generateAkari } from "@johnmorrisdotca/kazu/akari";

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

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