DEV Community

SEN LLC
SEN LLC

Posted on

Kojun: the clue you draw before you write a digit, and two walls where boards stop existing

Kojun in the browser with five rule sets inside. The grid is
divided into regions; a region of k cells holds each of 1…k exactly
once
, two cells sharing an edge never hold equal digits — across region
borders too — and of two vertically adjacent cells in the same region,
the upper one is larger. Puzzle #46 in the solver series.

Demo: https://sen.ltd/portfolio/kojun/
Repo: https://github.com/sen-ltd/kojun

Kojun

The first clue is drawn, not written

Every clue this series has measured so far was a printed number. Kojun has
printed givens too — but before a single digit hits the paper, the setter
has already committed a clue: the partition itself.

A region's outline says three things. The digit range (size k means 1…k),
the internal slope (every in-region vertical edge points downhill), and
sometimes the entire content: a region shaped like a column of height k
reads k, k−1, …, 1 from the top
— the chain of interval bounds "upper
exceeds the lower cell's minimum" resolves every cell with zero givens.

On the default partition stream (region sizes 4–7), the shapes alone pin
9–11% of every board's cells before the first given is revealed — and
almost all of that work belongs to order, the interval rule on vertical
edges:

n neigh once order region probe
6×6 1.6% 1.7% 9.3% 9.3% 9.9%
10×10 1.6% 1.6% 11.1% 11.1% 11.5%

Regions that cannot coexist — a soft wall of granularity

Try to make the partition a stronger clue and the puzzle resists in a
strange way: the board itself stops existing.

In a finished grid, the set of all cells holding v is a global
independent set
— equal digits never share an edge, whatever region they
belong to — and every region of size ≥ v contains a v. So small regions
pack the board with 1s and 2s until those classes no longer embed. The
all-singletons partition is the limiting theorem: every cell must hold 1,
two of them always touch, so no legal board exists at any size ≥ 2.

Measured, the collapse starts far above the theorem. One partition, one
fill attempt, nothing redrawn:

8×8, region sizes admits a board mean region size pinned by shape alone (order)
1–1 (all singletons) 0.0% 1.00
2–3 0.0% 2.40
2–5 2.5% 3.26 56.3%
3–6 28.8% 4.00 24.2%
4–7 (the default) 51.3% 4.70 11.4%
5–9 75.0% 5.91 7.0%

The tension runs against the setter: the shapes that say the most (56%
of cells pinned at sizes 2–5) are exactly the shapes that barely exist.

The verticality dial ends in a second wall

The vertical rule reads only in-region vertical edges, so the same
4–7-cell budget per region says more laid tall than laid flat. Sweeping
the growth bias:

8×8, vbias admits a board cells in column regions pinned by shape (order) median givens to buy a region-level finish (6×6)
0.00 (flat) 98.8% 0.7% 0.9% 18
0.50 60.0% 6.9% 10.8% 12
0.75 25.0% 24.5% 25.2% 9
1.00 (tall) 0.0% 74.6% 3

The pinning power climbs 0.9% → 25% — and then the boards vanish. The
culprit is self-solvingness itself: two column regions of height k side
by side are both forced to k…1, and their equal digits touch.
A shape
that solves itself cannot sit next to another one.

The last column is the price of ink. A unique region-grade board costs a
median 18 givens on flat 6×6 partitions — half the board — and 3 on the
tall partitions that survive. You can pay for most of the puzzle with
outline instead of digits; the fee is that such partitions almost never
exist.

Random givens are nearly worthless

The givens have their own lesson. Revealing 30% of all cells at random
leaves 6×6 boards unique 0.0% of the time (50% reveals: 6%; at 8×8
even 50% gives 0%). Meanwhile the generator's adversarial reveal —
grow-until-solved, then greedily delete — buys uniqueness with a median of
12 givens. Where a given lands matters almost infinitely more than how
many there are. The lesson from Nanro (#326), where 19 adversarial hints
did what 19 random ones failed to do in 30 of 30 tries, survives in a
puzzle where the setter fully owns hint placement.

One roof over the ladder — and on naked boards, even the roof goes quiet

The ladder: neigh (a pinned grid neighbour erases its digit here),
once (the region as a permutation: pinned cells erase, lone homes pin),
order (interval bounds on vertical edges), region (enumerate every
complete assignment of one region and keep exactly the supported values),
probe (assume, propagate, delete on contradiction).

once (a census of homes per digit) and order (a geometry of edges) are
incomparable middle rungs. But every deletion the three cheap rules can
justify lives inside a single region, or crosses one boundary edge to a
pinned cell — exactly what region's enumeration checks. The roof
subsumes all three, as a theorem; ablation confirms it in bits:

10×10 cells pinned fixpoints moved region assignments probes
full 12.7% 8,196 706
−neigh 12.7% 0 of 20 11,129 706
−once 12.7% 0 of 20 9,914 706
−order 12.7% 0 of 20 9,413 706
−region 12.7% 0 of 20 975 706
−probe 11.7% 18 of 20 975 0

Dropping any cheap rule leaves the fixpoint bit-for-bit identical at every
size; what moves is the bill (−neigh raises the roof's enumeration work
by a third). That much is familiar from this series. The fifth row is the
new part: on this stream, removing the roof changes nothing either. On
naked boards every deletion the roof can make, the probe re-derives — the
whole ladder above order falls silent.

The middle wakes up when givens arrive. The shipped bank (80 boards)
fills all five grades at every size: printed digits separate the rungs
that the naked stream collapses. A bare partition flattens the ladder to
two levels; givens unfold it back to five.

The multinomial census

Soundness is pinned by an independent engine that shares no machinery with
the ladder: it deals whole regions one at a time — the search space is
literally Π kᵢ! — checking placed digits only against the raw rule text,
and scoring every leaf with the validator. It agreed with the propagating
search on 482/482 solution counts.

It also faces an external identity. An isolated p×q rectangular region (p
rows, q columns, no givens) is constrained only in its columns, each
strictly decreasing downward — so the count of fillings must be the
multinomial:

(pq)! / (p!)^q   — choose each column's digits; their order inside is forced
Enter fullscreen mode Exit fullscreen mode

The engine, which knows nothing about multinomials, landed on every term
asked: 1×5 = 120, 3×2 = 20, 4×2 = 70, 3×3 = 1,680, 2×5 = 113,400 — and
k×1 = 1, the counting-theory version of "a column is its own solution."

A second solution read straight off the answer — 98–100% explained

A single cell can never change value silently: its region would gain a
duplicate and lose a digit (the tests prove this exhaustively over every
cell and every alternative value). So the cheapest ambiguity is a swap
two ungiven cells of one region trading digits with every law intact — and
one scan of the finished grid finds it, no search at all:

n non-unique boards explained by one swap false alarms on unique boards
4×4 296 291 (98.3%) 0
6×6 200 200 (100.0%) 0
8×8 240 240 (100.0%) 0

Magnets (#328) got 37–47% out of its pair certificate. Kojun's ambiguity
is almost entirely confined inside single regions — the small bijections
lock digits so tightly that multi-region rearrangements are almost never
the cheapest second solution. And the probe ladder agreed with true
uniqueness on all 680 stream boards, in both directions.

Takeaways

  • Kojun's first clue is the partition: column regions solve themselves with zero givens, and default shapes pin 9–11% of all cells on their own (nearly all of it order's work)
  • Digit classes are board-wide independent sets, so small regions are the most informative and the least existent: at 8×8, sizes 2–3 admit 0% of boards, 5–9 admit 75%; the all-singletons partition is empty by theorem
  • The verticality dial raises shape-pinning 0.9% → 25% while existence falls 98.8% → 0% — self-solving shapes cannot sit next to each other. Ink cost: 18 givens flat, 3 tall
  • Random givens are nearly worthless (30% reveals: 0% unique); 12 adversarial ones do the job
  • The region roof provably subsumes the three cheap rules — ablation is bit-identical everywhere — and on naked boards the roof itself is redundant; only givens wake the ladder's middle (the bank still fills all five grades at every size)
  • The independent Π kᵢ! engine matched 482/482 counts and reproduced the multinomial census (pq)!/(p!)^q on every rectangle asked
  • The in-region swap certificate explains 98–100% of non-unique boards with zero false alarms; probe ⇔ unique held on all 680 boards

27 tests. TypeScript, zero runtime dependencies.

Demo: https://sen.ltd/portfolio/kojun/
Repo: https://github.com/sen-ltd/kojun

Top comments (0)