DEV Community

SEN LLC
SEN LLC

Posted on

Nawabari: the number doesn't tell you how big the room is — it tells you which seat you're in

Nawabari (Territory) in the browser with a five-rung solver. Cut the
grid into rectangular rooms; every room holds exactly one number; the
number says how many of its own cell's four sides are room walls, with the
outer frame counting. So the number says nothing about the room — it says
which seat of the room the number is sitting in. Which means this genre has
no clue-count dial: the number of numbers is the number of rooms in the
answer, and the only thing left to choose is which cell of each room holds
its number. Measured over the 72 boards I ship and their 633 rooms: 19.5%
of the ways to print a 6×6 answer make a puzzle, 3.3% at 8×8. Slide one
number to another cell of its own room and half the boards break — and
restricting to the 1,360 moves that print exactly the same digit, only
679 (49.9%) survive. Erasing a number is not a weaker hint, it is a
destroyed board: of 633 erasures, 0 leave the intended answer legal and
59.4% leave a board with no answer at all. Puzzle #63 in the solver series.

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

Nawabari

The rules

  • Cut the grid into rectangular rooms.
  • Every room holds exactly one number.
  • The number says how many of that cell's own four sides are room walls. The outer frame counts as a wall.

It is a minor Nikoli genre. The checker in puzz.link's engine (pzprjs) is four
clauses: rooms are rectangles, no room without a number, no room with two, and
a numbered cell's four-side wall count equals its number. I read those off the
engine before writing a line, because on a genre this obscure the rule you
remember is usually a different puzzle's rule.

The number tells you your seat, not the size of the room

Every cut-the-grid genre I have built before — Shikaku, Araf, Fillomino,
Heyawake — grades a region by a number about the region: its area, its cell
count, what its cells add up to. A Nawabari number says nothing about its
region. It is a property of the cell it is printed in, which is another way
of saying it tells you which seat of the room the number is sitting in.

Count every cell of a 6×6 against every rectangle that cell could belong to and
you get the whole alphabet:

number seat rectangles it allows room sizes it allows smallest largest
4 a room of its own 36 1 1 1
3 the end of a 1-wide strip 360 5 2 6
2 a corner of a fat room, or the middle of a strip 1,140 16 3 36
1 along an edge, not at a corner 1,200 13 6 36
0 strictly inside 400 10 9 36

4 is the only letter that pins the size of its room, and it does it by being
the whole room. 2 is consistent with rooms from 3 cells to 36.

Five letters, six seats: 2 is the one letter with two of them, and it
cannot tell you which — the corner of a fat room and the middle of a 1-wide
strip are indistinguishable on paper. That is the entire ambiguity budget of
the genre.

On the shipped boards a single number leaves a median of 6 rectangles open at
6×6 and 8 at 8×8, spanning a median of 4 and 5 different room sizes and up to

  1. Nothing is decided by one number. Everything is decided by how the numbers fence each other in.

The clue count is not a dial

This is the part that made the genre strange to build. In every other puzzle in
this series the generator has a budget to turn: more numbers is easier, fewer is
harder, and what is the smallest clue set that still works is a question with
an answer.

Nawabari does not have that question. One number per room, so the number of
numbers is the number of rooms in the answer
. The 72 boards here carry 633
numbers because their answers have 633 rooms, and there was never a choice.
Print one fewer and you do not have a harder puzzle, you have an illegal board.

What is left is which cell of each room holds its number — and that turns out
to be the whole design space. Take a shipped answer, throw away the printed
board, and drop one number into a random cell of every room. The value follows
from the seat, so the board is always legal and always has that answer. Whether
it has any other answer is the question:

board answers placements per answer (median) largest drawn per answer unique
6×6 36 6,696 103,680 600 4,221 (19.5%)
8×8 36 3,414,528 91,445,760 400 470 (3.3%)

At 6×6 the friendliest answer in the bank is unique in 84.3% of its placements
and the most hostile one in 2.3%, median 15.0%. At 8×8 the median answer is
unique in 2.0% of them. The generator's job here is not choosing what to say.
It is choosing where to stand.

Same number, different cell

The sharp version of that experiment moves one number and leaves everything else
alone: pick a number, slide it to another cell of its own room, rewrite the
value to match the new seat. The answer is untouched and still perfectly legal.
There are 2,967 such moves across the bank and 1,485 of them — 50.1% — leave a
board that is still unique.

And 1,360 of those moves do not change the printed digit at all: the new
seat has the same wall count as the old one, so the board looks like it is
carrying identical information in a slightly different place. Of those, 679 stay
unique — 49.9%.

Nothing about what the board says has changed, and it is a different puzzle.
That is the separation this genre makes easy to see and most genres make
impossible: the position of a clue here is not a delivery mechanism for its
value, it is half of the value.

the number lands on moves still unique
the end of a strip 337 174 (51.6%)
the middle of a strip 353 190 (53.8%)
a corner 900 409 (45.4%)
an edge 1,202 603 (50.2%)
strictly inside 175 109 (62.3%)

One row came out backwards from what I expected. The weakest letter in the
alphabet is the strongest place to land
: a number that ends up strictly inside
a room — a 0, which only says "my room is at least 3×3" — leaves the board
unique 62.3% of the time, the best row in the table. A number landing on a
corner does worst at 45.4%. Informative letters in obvious places are not what
makes a board tight.

Erasing a number doesn't make a harder puzzle. It makes a non-board.

Every other genre in this series gets the same local-minimum test: remove any one
clue, check that a second answer appears, so no clue is decoration. The test
cannot be run here. Erase a number and the answer it belonged to becomes
illegal, because one of its rooms now holds no number.

board numbers board is dead afterwards still has answers and is still unique
6×6 239 140 (58.6%) 99 52
8×8 394 236 (59.9%) 158 92

Of 633 erasures, the intended answer stays legal exactly 0 times. The board
dies outright 59.4% of the time, and the other 40.6% of the time it still has
answers — 144 of which are perfectly good unique puzzles with a different
answer
. In this genre a clue is not evidence about the answer. It is part of
the specification of what an answer is allowed to be.

The dots without the numbers

The complementary experiment: keep every position, erase every value, so the
board only says "there is one number in each room and here is where they are".
That is a real genre — Shikaku with the areas rubbed out — and the transfer
matrix counts it exactly, with no cap, however big the count gets.

board boards unique answers (median) fewest most
6×6 36 0 564 24 30,844
8×8 36 0 369,090 5,872 109,011,159

0 of 72. Knowing one cell of every room — knowing where every number is —
is not remotely knowing the answer.

Eight of the sixteen ways walls can meet

Every clause except "one number per room" is a condition on a single lattice
point
. Four wall-stubs meet at an interior point, and of the sixteen ways they
can be walls, eight are legal: nothing, a straight crossing, any of the four
Ts, and the plus. A lone stub is a wall that borders nothing. Two perpendicular
stubs make a reflex corner, so the room wrapped around it is not a rectangle.

That is the entire geometry of the genre, and npm test checks it the hard way:
over all 2^12 wall patterns of a 3×3, all 2^13 of a 2×5 and all 2^17 of a 3×4,
"legal at every lattice point" and "every room is a rectangle and every wall
borders something" agree on every single pattern, and the survivors match the
published dissection counts.

what meets at the point times in the shipped answers share
nothing 1,109 41.6%
a straight crossing 1,016 38.1%
a T 528 19.8%
a plus 11 0.4%
an elbow (illegal) 0 0.0%
a lone stub (illegal) 0 0.0%

Being local is what makes the genre countable. It is a vertex model, so a
transfer matrix can walk it column by column: the state at a column boundary is
how the rows are cut into the rooms crossing it, plus, per room, what its number
still owes — no number yet, satisfied, the room may not end here, or the room
must end here
.

The ladder

Two rungs live on the edges, two live on the rectangles, and the handover
between them is where all the strength is.

  • count — a numbered cell has as many walls around it as it says, frame included. Arithmetic on four bits.
  • vertex — the eight legal lattice patterns, propagated.
  • room — an answer is one rectangle per number, chosen so they tile the board: an exact cover. Filter each number's candidate rectangles against the known walls, read back whatever every survivor agrees on, and hand any cell only one number can still reach to that number.
  • probe — assume a rectangle, run the three rungs below, drop it if that alone contradicts.
  • search — fewest surviving rectangles first.
rung 6×6 walls settled 6×6 finished 8×8 walls settled 8×8 finished
count 8.5% 0/36 7.6% 0/36
vertex 14.5% 0/36 12.1% 0/36
room 98.3% 35/36 89.4% 28/36
probe 100% 36/36 100% 36/36

Easy to claim, so here is the price. Run the complete search but only let it use
the rungs up to a given level between branches, and count branch points:

propagation allowed 6×6 median 6×6 worst 8×8 median 8×8 worst
up to count 269 9,382 101,701 past the 200,000 cap on 15 boards
up to vertex 260 8,318 98,164 past the 200,000 cap on 13 boards
up to room 0 4 0 3

With only the two edge rungs the median 8×8 board costs 98,164 branch points.
Add the rectangle rung and it costs 0. The whole solver is that one change
of view: stop asking which edges are walls, ask which rectangle each number
belongs to.

Four ways to misread the rule, and they don't fail alike

misreading board intended answer still legal answers (median) still unique
don't count the outer frame 6×6 / 8×8 0/72 0 0/72
read the number as the room's area 6×6 / 8×8 0/72 0 0/72
a room may hold several numbers 6×6 36/36 1 24/36
a room may hold several numbers 8×8 36/36 1 21/36
a room may hold no number 6×6 36/36 122,637 0/36
a room may hold no number 8×8 36/36 21,823,026,293 0/36

The two tightenings fail loudly: forget the frame, or read the number as an area
the way every Shikaku-shaped genre would, and the intended answer is illegal on
72 of 72 boards and the board goes blank. You cannot ship that mistake.

The loosenings are the dangerous ones, and the two halves of "exactly one
number per room" are not worth the same
. Dropping at most one costs
uniqueness on 27 of 72 boards — real, survivable, median still 1. Dropping at
least one
— allowing a room with no number, which is exactly what the
neighbouring genres allow — takes the median 8×8 board from one answer to
21,823,026,293 and the worst to 336,544,355,664,414. Half of one clause is
holding the entire genre up.

Counting against numbers somebody else published

With every number erased, a Nawabari board is a bare rectangular dissection, and
those are in the literature. The transfer matrix reproduces
A333476 as a triangle — all 28 entries — and then
keeps going down A182275, far past anything a search
could enumerate:

grid dissections vs published transfer matrix
6×6 535,236,230,270 agrees 6 ms
7×7 18,100,579,400,986,674 agrees 33 ms
8×8 3,250,879,178,100,782,348,462 agrees 199 ms
9×9 3,097,923,464,622,249,063,718,465,240 agrees 1,170 ms

The rows are published separately too (A034999,
A208215, A220297,
A220298), and two searches that have never heard of
the transfer matrix — one that lays rectangles down from the first uncovered
cell, one that decides internal edges one at a time and only asks what the board
looks like at the end — reproduce the corner of it they can reach.

And one count nobody has published: which answers can be printed at all

A dissection is an answer. Whether it is a puzzle depends on whether some way
of writing one number into each of its rooms leaves it alone — a question about
the dissection, not about any board.

grid dissections legal boards of which unique answers that cannot be printed
1×7 64 377 331 0
2×6 2,864 64,520 42,505 0
3×3 322 3,232 2,224 0
3×4 3,164 71,624 43,436 0

The legal-boards column down the 1×n strips is 1, 3, 8, 21, 55, 144, 377 =
F(2n), A001906 — the boards on a strip are the
compositions of n weighted by the product of the parts, so that one is pinned
from outside. The column beside it, the ones that are unique, is 1, 3, 8, 21,
53, 133, 331, and searching the OEIS for it in September 2026 returns nothing.
Nor for the 2×n row, 17, 122, 879, 6169, 42505, nor for 3×3 and 3×4 at 2,224 and
43,436.

The last column is the one I expected to go non-zero much earlier. Checking
printability only needs one unique placement, so it stops early, which makes
bigger grids reachable:

grid answers checked cannot be printed worst placement hunt
4×4 70,878 (every dissection) 12 288
3×6 314,662 (every dissection) 0 322
4×5 1,613,060 (every dissection) 267 1,152
6×6 60 (drawn the way the generator draws) 0 3,241

The first unprintable answers show up at 4×4 — 12 of 70,878, one in 5,907 —
while a 3×6, with four and a half times as many dissections to go wrong in, has
none. Size is not what does it; shape is. Every one of those 12 dead answers has
exactly 6 rooms, every one is made entirely of 1-wide strips, and every one
contains two parallel dominoes filling a 2×2 square. At 4×5 it stays nearly
true: 247 of 267 are all strips, 260 contain the domino pair.

That domino pair is the smallest ambiguity the genre has. Two dominoes side by
side fill a 2×2, and in a domino every cell is an end, so all four cells print
3 whichever way the square is split. The numbers cannot tell the two splits
apart; only which cells carry them can, since one number per room means one
per row in one split and one per column in the other. On its own that is
resolvable — which is why a 3×6 never dies. It is when the board is nothing but
strips, and every escape from one ambiguity walks straight into the next, that an
answer runs out of places to stand.

The repository

  • src/nawabari.ts — the rules, the five rungs, the exact-cover search
  • src/brute.ts — two independent enumerators (by rectangle, by edge)
  • src/count.ts — the transfer matrix (BigInt, no cap) and uniform sampling
  • src/generate.ts — draw the answer first, then hunt for a placement
  • tools/{generate,ledger,stats,notes}.mts — bank, ledger, measurements, page

Every number on the page and in the readme is generated from src/stats.json
and src/ledger.json; none of them is typed in by hand. 23 tests, which
re-derive the bank's uniqueness and grades from the shipped file rather than
trusting the generator.

TypeScript, no runtime dependencies, MIT.

Top comments (0)