Skip to main content

Source files

Every file in csrc/ with the comment at its top; the headers have pages of their own.

als.cpp
bindings.cpp
brute_force.cpp
canon.cpp
chains.cpp
colour.cpp
deadline.hpp(reference)
desc.cpp
direct_view.cpp
explain.cpp
forcing.cpp
listing_cache.cpp
loads.cpp
mental.cpp
model.cpp
model.hppConstraint-agnostic puzzle model: cells, houses, relations, n-ary constraints (built from pencilmark/model.py). Constraint kinds: AllDiff groups complete (houses: exactly D cells, every digit once) or partial (cages), optionally carrying a sum pair relations exclusion tables rel_ex[a][b][v] = digits excluded at b when a == v (non-consecutive, thermo, kropki, XV, whispers, ... all reduce to this) neq pairs anti-knight / anti-king style "different" links domains per-cell allowed-digit masks Everything downstream works on these four primitives only; extensions (arrow sums, generic AIC link graphs, ...) add new primitives here plus strategies that consume them (see strategy.hpp). (reference)
move_util.hppFile-local helpers shared by uniqueness.cpp, als.cpp and set_logic.cpp (split from extra.cpp): move descriptors, eliminations, and a set that keeps an elimination list from being reported twice. Internal linkage: each file that includes this header gets its own copy. (reference)
nary.cpp
nary.hppGeneric multi-cell ("n-ary") constraints and their consistency engine. A constraint is a scope of unique cells ("vars") plus a type-specific predicate over positions (positions index vars, so a cell may appear more than once, e.g. a line crossing itself). The engine enumerates assignments consistent with the current domains respecting pairwise distinctness (shared AllDiff groups / neq links / the constraint's own distinct flag) and pair-relation tables between scope cells with bound pruning, and returns per-var supports (generalized arc consistency), the number of consistent assignments, the intersection of their digit sets ("must contain") and whether that digit set is unique. (reference)
nary_moves.cpp
notes_view.cpp
portable.hppPortability shims. With GCC / Clang on Linux and macOS nothing changes: the compiler builtins are used directly and pm_long is plain long (64-bit there), so those builds compile to the same code as the reference build. - Windows (MSVC and clang-cl): long is 32-bit, so pm_long is long long (the engine assumes a 64-bit long).
  • MSVC proper: no __builtin_popcount / ctz / clz; mapped to portable code and _BitScan* intrinsics. (reference) | | pycompat.hpp | Bit-exact emulation of the bits of CPython 3.14 the reference solver's behaviour depends on: - set iteration order (setobject.c: linear probing + perturbation, resize policy, merge / intersection construction order),
  • tuple hashing (xxHash-style tuplehash, used for set-of-tuples order),
  • builtin sum() over floats (Neumaier compensated summation, 3.12+),
  • float ** float special cases. Only what the solver needs: keys are non-negative ints (hash == value) or interned tuple ids carrying a precomputed hash. (reference) | | refute.cpp | | | set_logic.cpp | | | solver.cpp | | | solver.hpp | Two-phase logical solver: technique ids, moves, pricing parameters and the Solver class (solver.cpp and the technique files). (reference) | | solver_util.hpp | File-local helpers shared by the solver's source files (solver.cpp, direct_view.cpp, notes_view.cpp, nary_moves.cpp): k-combinations, innie / outie region records, move descriptors, eliminations. Internal linkage: each file that includes this header gets its own copy. (reference) | | sudokuwiki.cpp | | | uniqueness.cpp | | | variant_logic.cpp | |