Expand description
Mathdoku puzzle generator and solver.
§Core types
| Type | Role |
|---|---|
Cell | A grid position identified by (row, column), 1-indexed. |
Fill | A bitmap set of candidate values 1..=9 for a cell. |
Polyomino | A connected set of cells forming a cage shape. |
Puzzle | An n×n cage structure with constraint propagation. |
CageOperator | The arithmetic operator for a cage (Add, Subtract, etc.). |
§Entry points
- Generate a random puzzle with
generate(). - Construct a puzzle programmatically with
Puzzle::newandPuzzle::insert. - Inspect cell values with
Puzzle::get. - Solve with
Puzzle::solutions. - Query valid operators for a polyomino with
operators_for.
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§
- Cage
Operator - The arithmetic operation and target for a cage.
- Error
- Errors returned by mathdoku operations.
Functions§
- generate
- Generates a random
n×npuzzle 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_DEBUGenvironment variable is set to1. - operators_
for - Returns all operators valid for
polyomino’s size (without domain-based filtering).