Skip to content

An old walled city: twenty years on, its founding quarter behind a wall - #6

Merged
Fengzdadi merged 7 commits into
mainfrom
state/old-walled-city
Nov 3, 2026
Merged

Fengzdadi merged 7 commits into
mainfrom
state/old-walled-city

Conversation

@Fengzdadi

@Fengzdadi Fengzdadi commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Builds on #4 (scan/births-before-window), now merged into main (b462ff1), and main is merged into this branch. Without it the 20,000-commit cap dates every file from before the window to the window's start, so no big old repo would ever show its founding files. This PR no longer waits on anything, and its diff is only this change.

What

A new state, walled, that can sit on any city plan, like ruins or ghost. It is not an archetype.

  • Signal (src/classify.mjs): the repo is ageYears >= 20 and foundingShare >= 0.2. foundingShare is the share of the core files still alive that were born in the repo's first five years. It counts from the real founding day (city.firstCommit when truncated, else city.start) over the same core file set as the other metrics.
    Reason: old walled city: 34% of files date from its first five years, 22 years ago.
  • Page (web/walls.js, web/studio.js): a wall around the quarter where the founding files cluster (or around the whole city when they're spread all through it), with towers and red roofs along it and four gates. It rises when the founding years end. The README's list of conditions mentions it.

How the wall is placed

walls.js is pure and runs on the finished layout, so it works the same on every plan. The studio builds the meshes.

  1. Old core: the round patch of lots with the most founding files above the city's average share, capped at a quarter of the city. Blocks then go in or out whole, so the wall keeps to the streets. Only a block too big for that, such as a Factory Town compound, is split between its buildings.
  2. Wall line: a chamfer distance field labels each patch of ground with its nearest lot. The wall runs where the old town's ground meets the rest, down the middle of the street, so it never cuts a building. Only the largest connected piece is kept, so there are no stray bits across a canal, and holes are filled, so a yard inside the town isn't walled off.
  3. Towers and gates: a gate sits on each side where the wall crosses the widest street, with a tower on either side of it. More towers stand every few lots along the wall, only where nothing under a tower's full width touches a lot.
  4. Deleted buildings: files deleted lately stand for most of the timeline. They have no say in where the old town is, but they block the wall like any other building, so it goes down the street past them.
  5. Whole city: when no distinct old quarter stands out (founding files spread evenly, or too few files for a quarter), the whole city is the old town. The wall follows the convex hull around every building, deleted ones included, with four gates. A city on islands is one walled town, its wall standing in the water between them. So whenever the terminal says "old walled city", the page draws a wall.

The distance field covers only the old town plus a margin, with cells sized by area (at most 3 million), so long thin plans like Manhattan get as fine a wall as square ones. At 30,000 files it takes 117–216 ms with an old quarter and 53–75 ms for a whole-city wall.

Who gets it

repo age founding share state
postgres 30.3 y 25% ✅ walled
vim 22.4 y 34% ✅ walled
git 21.5 y 36% ✅ walled
django 21.3 y 48% ✅ walled
gson 17.6 y 60% —
express 16.9 y 86% —
flask 15.9 y 72% —
jq 13.8 y 91% —
uuid 12.4 y 71% —

Young repos have high founding shares too, so age is what separates them. The share then stops a 20-year-old repo that has been rewritten from getting the state.

Snapshots: all 11 pinned repos move by one line, the new metrics.foundingShare. None of them gains the state, since none is 20 years old.

Hosted site

SCANNER goes 8 → 9 (deploy/cloudflare/container/version.mjs): classify output changes, so cities cached under 8 must be scanned again to get the state. Still needs npm run deploy after merging.

Not in this PR

  • Ring roads by era. The first version is only walls and gates.
  • In dense, tall plans (Tokyo, Factory Town) the inner stretch of the wall hides between buildings in the hero shot. It reads where it runs along open ground and along the city's edge, with its towers.

Checks

  • npm test passes (preload, layout, history, snapshot), also merged together with Chip: a hidden style that draws any city as a circuit board #7.
  • A harness ran planWall on every snapshot city × all 18 plans, with deleted files, at four founding cut-offs (including all-founding and none): a wall in all 792 runs (was 584 with none), and no wall or tower on any lot, live or deleted (was 181 runs).
  • --still of vim, postgres, git and django draws the wall. Flask (no state) and vim in --style maquette render without errors. The pixel wall colour is #968a6e, from the pixel palette.
  • The circuit-board style (Chip: a hidden style that draws any city as a circuit board #7) draws no wall: whichever of the two merges second skips it for style=chip.

🤖 Generated with Claude Code

Fengzdadi and others added 6 commits October 26, 2026 20:45
… an old walled city

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The walled state gets drawn: the round patch of the city where files
from the first five years are thickest, snapped to whole blocks where
the plan has small ones, is walled off down the middle of the streets
(a nearest-lot distance field, so the wall never cuts a building).
Towers along it, four gates at the widest streets, up when the
founding years end. Works on every plan; walls.js is pure, the studio
builds the meshes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wall now stands wherever the classifier says the city is walled, and
never on a building:

- Deleted buildings stand in its way. The files deleted lately stand for
  most of the timeline, so they're in the distance field like any other
  lot: they take no part in choosing the old town, they go on the side of
  the street their ground was on, and the wall goes down the street past
  them. Each lot also takes every cell it touches, not only the ones
  whose middle it covers, and a tower stands only where none of the ground
  under it touches a lot (towers are wider than the wall).
- No old quarter, the whole city. When the founding files are spread
  evenly (every file founding, say) or the city is too small for a
  quarter of its own, the old town is the whole city: the wall follows the
  hull round all its buildings, deleted ones too, so a city on islands is
  one town, with a gate on each side. The wall stands from the ground up,
  so where it crosses water it stands in it, not over it. planWall returns
  null only for a city with no lots.
- Long cities keep fine cells. The grid covers only the ground round the
  old town, and its cells are capped by area (three million), not by the
  longest side over 1,600, which made them wider than a lot on a long
  Manhattan or Mountain City of 10,000 files and lost the wall.
- Fast on big cities: lots are counted in rings round each candidate
  centre instead of sorted, blocks and towers are filed on a coarse grid,
  and wall cells stack into boxes along the columns too. On a 30,000-file
  city, 120-220 ms for an old quarter and 50-75 ms for the whole city
  (was 1-1.7 s).
- The studio skips an empty wall, as it does other merged meshes, and the
  pixel wall is #968a6e, palette stone that reads against grass and
  road.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The classifier now measures foundingShare and can set `walled`, so a city
kept in R2 from before has neither. SCANNER goes to 9: each repo is
scanned afresh the next time it's opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now has the chip style (#7). Both changes pass a new value to the
studio, so it takes both, chip and wall. The circuit board isn't a city
and has no old town, so a walled city's wall is planned for every style
but chip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fengzdadi
Fengzdadi merged commit b9d47a3 into main Nov 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant