Skip to main content

Crate mathdoku

Crate mathdoku 

Source
Expand description

Mathdoku puzzle generator and solver.

§Core types

TypeRole
CellA grid position identified by (row, column), 1-indexed.
FillA bitmap set of candidate values 1..=9 for a cell.
PolyominoA connected set of cells forming a cage shape.
PuzzleAn n×n cage structure with constraint propagation.
CageOperatorThe arithmetic operator for a cage (Add, Subtract, etc.).

§Entry points

Structs§

Cage
A cage: a connected group of cells subject to an arithmetic constraint.
Cell
A grid position identified by (row, column), both 1-indexed.
Fill
The set of candidate values for a cell, stored as a u16 bitmap.
Operation
The arithmetic operation for a cage: operator and target value.
Polyomino
A set of edge-adjacent cells.
Puzzle
A Mathdoku puzzle: an n×n grid partitioned into cages, each with an arithmetic constraint.

Enums§

CageOperator
The arithmetic operation and target for a cage.
Error
Errors returned by mathdoku operations.

Functions§

generate
Generates a random n×n puzzle using the default operation policy and a default Poisson size distribution.
generate_latin_square
Generates a uniformly random n×n Latin square using the Jacobson-Matthews Markov chain.
init_debug_logging
Initialises debug logging if the MATHDOKU_DEBUG environment variable is set to 1.
operators_for
Returns all operators valid for polyomino’s size (without domain-based filtering).

Type Aliases§

N
A Fill value or grid dimension in the range 1..=9.
Operator
Alias for CageOperator.
T
The accumulated result of an arithmetic cage operation (sum or product of N values).
Target
Alias for T.