Issue #3617891: Seat a party that cannot sit together in as few pieces as possible, across areas if need be
This adds the rung the ladder was missing.
Every rung above it is about how CLOSE the places are, and none of them is about how many PIECES the party ends up in. So spreading a party answered the first question and handed out places in order: six people with no run of six anywhere sat in one row with a stranger between each of them, and two threes in two areas, which is what those six would rather have, could not be preferred.
The rung. Between taking a fresh run and spreading, the party is seated in as few unbroken pieces as the house can be broken into, crossing areas if that is what it takes. Fewest pieces first, then closest: two threes in two areas beat six singles sharing a row, and two threes in one row beat two threes in two areas. The parts of the house are weighed nearest first, the same ones spreading uses, and one only wins by breaking the party into strictly fewer pieces than one already found.
Which stretches to cut the pieces from needs no search: a piece can be any part of one unbroken stretch, so the longest are taken until they cover the ask, and no smaller number of them could.
How long each piece is does need deciding, and evenly is the answer, since a party of six broken in two would rather be two threes than a five and one person on their own. The rule on leaving no place on its own narrows what each piece may take, which is why the lengths are worked out rather than dealt out: a stretch of four, in a house that leaves no place on its own, can give one, two or all four of its seats and never three. Where a number of pieces has no legal split at all, one more piece is tried.
Ranking against a party seated whole in a worse part of the house needed no new rule. Adjacent searches the whole house before this rung, so one run anywhere always wins, and this only ever runs when none exists.
What the booker is told is unchanged. The notice says how far apart the places are, which is true of two threes in a row as much as of six seats on their own, and a count in that sentence is one the booker cannot reconcile with anything on their screen. The strategy's own description did change, because it promised to spread a party where the house has no run long enough, which is no longer what it does.
Also in it. The tail of the ladder is one method now: there were two callers writing the same order out twice. PlaceGeometry answers how long a row's unbroken stretches are, which runsOf() was working out privately and nothing could ask for.
Cost. Nothing new is read. It groups what it was handed by row, by area and by section, which is the same arithmetic spreading does over the same list, and the piece lengths are a handful of sums over single-digit numbers. PlaceHoldCostTest and AvailablePlaceReadCountTest hold their figures.
Tests. Three in SeatTogetherTest and one scenario in PlaceGeometryTest. Each of the three was seen to fail against the unfixed code first, and the headline one failed with exactly the complaint the issue describes: far:A:1, far:A:3, far:A:5, three people each sitting alone in one row.