DEV Community

SEN LLC
SEN LLC

Posted on

Nondango: one swap is all it takes, and it caps how much puzzle a board can hold

Nondango in the browser with a four-rung solver. The rule forbids
three consecutive circles in a line from all being black — but a region paints
exactly one circle, so a triple with two circles in the same region can
never fire. It is satisfied before the puzzle starts, and that is
34.8% of the geometry on the boards I ship. The load-bearing fact is
shorter still: move a region's black circle onto another circle of the same
region and every other region is untouched, so the only thing that can make it
illegal is a line of three through the new circle whose other two were
already black. So a unique board needs one such line per white circle —
and a line with two blacks holds exactly one white circle, so it can cover at
most one. Hence circles − regions ≤ live triples, which is the entire amount
of choice a board is allowed to have.

Live demo: https://sen.ltd/portfolio/nondango/
Source: https://github.com/sen-ltd/nondango

Nondango

The rule

The grid is cut into regions. Some cells carry a circle.

  • Paint exactly one circle black in every region.
  • Three consecutive circles — across, down, or on either diagonal — must never all be black.

That is the whole thing. Cells without circles belong to a region but hold
nothing. Two lines of rules, and rather more than two lines of consequence.

A third of the geometry is dead on arrival

The forbidden object is a set of three circles. But a region paints exactly
one circle, so if two of those three circles live in the same region they
can never both be black. That triple is satisfied before you start. It carries
no information at all.

I call those dead and the solver drops them first. On the shipped bank that
is not a rounding error:

board geometric triples live dead
8×8 43.1 28.3 14.8
12×12 146.4 95.3 51.1

34.8% overall. With regions averaging about three cells, a line of three
cells lands inside one or two regions surprisingly often.

The screen is checked rather than trusted: on all 36 of the 8×8 boards, solving
with every geometric triple and solving with only the live ones return the same
answer set, 36 times out of 36.

What happens when you move one circle

Now the actual point. Suppose you have an answer. Take one region and move its
black circle onto a different circle of the same region.

  • No other region was touched, so it is still exactly one black per region.
  • You removed one black and added one. Removing a black can never create a violation.

So if that grid is illegal, there is exactly one possible reason: a line of
three through the circle you just painted, whose other two circles were
already black.

Call that line the circle's certificate. Then:

A board with a unique answer needs a certificate for every circle its answer
leaves white.

That is not a hunch, and it does not need a proof you have to trust — it can be
hit with a hammer. Across the 72 shipped boards there are 2,113 such moves.
Every one produces an illegal grid, and every one has a certificate to explain
why.

The budget

Counting certificates gets you something stronger.

A line of three with two black circles holds exactly one white circle. (All
three black would make the answer illegal, so at least one is white; two are
black, so exactly one is white.) Therefore one line can certify at most one
circle
.

Which gives:

circles − regions  ≤  certifying lines  ≤  live triples
Enter fullscreen mode Exit fullscreen mode

And the left-hand side is exactly the number of decoys on the board — the
circles that are not the answer, which is the entire amount of choice the solver
has to work through. So the inequality says something concrete about design:
the geometry caps how interesting the board can be. A line of three only
grows on three consecutive cells, and those are not handed out freely.

board white circles certifying lines live triples geometric triples
8×8 15.4 20.3 28.3 43.1
12×12 43.3 60.4 95.3 146.4

There is less headroom than it looks. The tightest shipped board has one
certifying line to spare; the median has nine. npm test asserts the inequality
on all 72.

No live triple, no puzzle

Join two regions when a live triple touches both, and you get connected groups
of regions. The rule never crosses from one group to another, so the groups
are independent and the board's answer count is their product. That is why the
complete solver is a plain backtracker run once per group — no cleverness
required.

The useful direction is the contrapositive:

A region touched by no live triple is a group of one, and its circle count
multiplies straight into the answer count.

So a region holding two or more circles and appearing in no line of three is an
instant second answer. Nothing can be done about it.

Measured, not assumed: I collected 200 random boards that happened to have no
live triple at all, and 200 of 200 had exactly the product of their region
sizes as their answer count. The 72 shipped boards split into 189 groups, 114 of
which are one region holding one circle — the givens — with the rest collapsing
into a single group of up to 48 regions.

Both ways of misquoting the rule delete the puzzle

Nondango's rule is usually written "three circles in a row, column or diagonal".
There are two words people drop, and they are opposite mistakes.

Forgetting the diagonals

The easiest one to make in code: cut the direction list from four to two. Most
certificates vanish with it, and every one of the 72 shipped boards stops
being unique
. The 8×8 boards go to a median of 1,268 answers; all 36 of
the 12×12 boards run past a 20,000-answer counting cap.

Reading "in a row" as "anywhere in the line"

This one over-constrains instead. On a line with L circles the legal black
sets are:

circles in a line consecutive (A000073) anywhere (A000124)
4 13 11
6 44 22
8 149 37
10 504 56
12 1,705 79

Read correctly it is "binary strings of length L with no 111", the
tribonacci numbers, A000073. Read the other way
it is "at most two blacks per line", 1 + L + L(L−1)/2, the lazy caterer's
sequence
, A000124. Exponential collapses to
quadratic — and 72 of 72 shipped boards end up with no answer at all. It
does not make the puzzle harder. It removes it.

While there: counting no-three-in-a-line black sets on a square grid where every
cell carries a circle gives A181218 — 2, 16, 230,
10732, 1495392, … The repository computes it with a transfer matrix over row
pairs and checks it against brute force up to 4×4. It stops at 8×8 because the
9×9 term is past 2^53 and a double would quietly round it.

The ladder

Four rungs over the same per-region domains.

  • region — one black per region, counting only. Decides the regions with a single circle.
  • triple — hyper-arc consistency on the live triples, to a fixpoint. This is the certificate rule read as propagation: once two circles of a live triple are pinned, the third is out.
  • probe — singleton consistency: assume a circle, propagate, drop it if that alone contradicts.
  • search — the complete solver, one component at a time.

The split tracks the amount of choice on the board almost exactly. 8×8 boards
grouped by how many white circles they ended up with:

white circles boards triple probe
1–4 93 92 1
5–8 82 76 6
9–12 100 78 22
13+ 110 60 50

triple is unit propagation over certificates, so it needs somewhere to
start: a certificate whose two black circles are already pinned. It stalls
when the remaining circles certify each other in a loop, which is what 52 of
72
shipped boards do. Even there, triple alone pins 72% of the regions
before getting stuck, leaving a knot of a median 13 regions for probe.
Nothing in the bank needs search.

The generator designs nothing

Answer first. Draw the regions, drop one black circle in each without ever
making three in a row, and the board is already unique — trivially, since every
region holds a single circle.

Then offer a circle to every remaining cell, with exactly one acceptance
test:

board.circle[cell] = true;
if (countSolutions(board, 2).count === 1) keep();
else board.circle[cell] = false;
Enter fullscreen mode Exit fullscreen mode

No difficulty model, no placement check, no heuristics. And the lemma above
predicts precisely which offers can survive: not one uncertified circle was
ever kept
, on any board, which the generator asserts on every run.

The dial is the number of white circles. Take a skeleton, throw in k certified
circles at random, and run no uniqueness check — certification is necessary,
and this measures how often it is also sufficient:

white circles drawn unique rate
0 212 212 100.0%
4 216 201 93.1%
8 213 143 67.1%
12 207 79 38.2%
14 202 38 18.8%

A 12×12 has more room and the same curve, 100% at 0 down to 13.7% at 32. And
note what never happens across 3,276 dial boards: the answer count never
drops to zero. Adding a circle cannot invalidate the answer, only give it
company.

Boards drawn without an answer in mind are hopeless, as usual: of 3,600 random
region-and-circle boards, 2,248 have no answer at all, 27 have exactly one,
and only 23 of those hold more circles than regions. The rest are boards
where every region was handed a single circle and there was nothing to solve.

What I expected and did not find

A certificate needs two black circles in adjacent cells. So the answers ought to
look clustered — black circles leaning on each other everywhere, without ever
making three. Visible structure.

There is none. Share of black circles with at least one black neighbour among
the eight:

  • shipped 8×8 answers: 86%
  • a black circle picked at random in each of the same regions: 87.8%

At 12×12, 91% against 91.4%. No difference. With regions averaging three
cells the geometry hands out adjacent pairs for free and the generator never has
to ask. A dead hypothesis, but I would rather publish the measurement than the
story I expected it to tell.

Two engines

The dead-triple screen and the component split are the load-bearing claims here,
so both are checked against an engine that has neither: a plain backtracker that
picks one circle per region by exhaustion and then walks the finished grid
against every geometric triple, three cells at a time. On boards small enough
for it to finish the two return the same answer set, not just the same
count, and the same holds under both misreadings. The component split gets a
third check: count each group by hand, multiply, compare.

Takeaways

  • A triple with two circles in one region cannot fire — 34.8% of the geometry on the shipped bank.
  • Moving one black inside its region can only break a line with two blacks, so every white circle needs one (2,113 of 2,113 confirmed).
  • A line with two blacks holds one white circle, so circles − regions ≤ certifying lines ≤ live triples: the geometry caps the choice a board can hold.
  • Regions not joined by live triples are independent factors (200 of 200 exact).
  • Drop the diagonals and 72 of 72 boards stop being unique; read "in a row" as "anywhere in the line" and 72 of 72 have no answer. Two opposite misreadings, both fatal.

The 59th solver-backed puzzle in the series. 32 tests, no runtime dependencies,
TypeScript and Vite.

Top comments (0)