A live TCP service: the "Zoning Board" prints a graveyard map, you hand back a burial plan. Twelve boards in a row, growing from 6x6 to 12x12, twenty seconds each - one rejected plan and the session ends.
The grid: . is open ground (the only thing that can become a grave or a footpath), T is a
yew tree, C a chapel, a digit a bell tower whose number is a clue. Each board also lists exact
grave counts per row and column. Five rules: exact row/column counts; no two graves touch
(diagonals included); a bell sees orthogonally until blocked (tree/chapel/bell/wall) and its
digit is the count of graves it sees; every grave needs an orthogonal footpath neighbour; and -
the one that actually makes this hard - every non-grave open cell, plus chapels and bells, must
form a single orthogonally-connected region. Trees are walls, not footpath.
The trap is rule 4
Ignore connectivity and the rest is a packing puzzle - Statue-Park/Temple territory, every other rule local, solvable with a hand-rolled backtracker on the small grids.
Pitfall
Connectivity is global: a decision in the top-left corner can disconnect a pocket of footpath in the bottom-right, invisible until the board is nearly full. My first version treated it as a final validation step only - solve for counts and spacing, flood-fill, reject and retry on failure. Fine on 6x6; on 10x10+ it's a lottery, because the solver has no reason to prefer connected boards, and most count-and-spacing solutions are disconnected. Throwing 14 seconds of search at a model that ignores rule 4 and hoping the flood-fill passes isn't a strategy.
Making connectivity a local constraint
One boolean per open cell ("grave here"), fixed false on trees/chapels/bells. Row/column sums, no-touch pairs, bell-ray sums, and the adjacent-footpath rule all translate directly into a CP-SAT model - the awkward part is "all footpath cells are joined," which isn't expressible locally on its own.
Insight
The trick Nurikabe-style solvers use: give every cell a rank, pin exactly one footpath cell to rank zero as the root, and require every other footpath cell to have at least one orthogonal footpath neighbour with a strictly smaller rank. That's one implication per cell - pure local constraint - and it's equivalent to full connectivity: following decreasing ranks from any footpath cell can't cycle, so it must terminate at the rank-zero root, meaning every footpath cell is reachable. Chapels and bells are always footpath and never graves, so the first one on the board is a free, guaranteed-valid anchor.
With that encoding, each board solves in a fraction of a second, all the way up to 12x12.
Pitfall
The first client I wrote deadlocked on itself: the banner ends with the same Your plan: prompt
that precedes every reply, so my code read the banner, then waited for the next prompt before
sending anything - while the server waited for board one. Reading the banner itself as board one
fixed it.
Result
RxR{2031cc4f-9961-4281-ac57-8e74683de74d}
solve.py: the CP-SAT model, the rank-based connectivity encoding, a local re-checker that
validates a plan against all five rules before it's sent, and the client. Twelve boards, all
accepted.