Status: done (2026-11-13)
Priority: 2
Size: M
Arch: between
Phase: implement
Design ref: Inheritance, expansion and other bodies (Leaving home: The moving round, A village’s round: Decided, 10 Nov). Survey and cost: backlog/VB-242.md.
Goal: The round’s marriages and handovers (marriageRound, src/sim/lifecycle.js:160-255, the round’s phase 0 at noon of autumn day 11) run in one six-minute step for the whole island: every unmarried man of the island in one list, those with a place first, then the oldest. To stay near 60 ms the step keeps roundHeirs (src/sim/heirs.js:103-147), a view of heir rankings that tracks dependencies and is invalidated by reading the event record (changedSince, lifecycle.js:181-197). The view and the round’s other memos are built by matchRules (src/sim/matching.js:32-68, VB-274), which the player’s wish (matchBar) and its options (sim/opportunities) also call. Kim decided on 10 November that each village holds its own round, a village a step, in the order of village id. A village’s round matches its own unmarried men with the unmarried women of any village, by today’s score, and a lone farm is a village. VB-242’s prototype ranks heirs afresh in each village’s step: the longest step is 6 to 30 ms on the late saves.
Acceptance criteria:
roundPhase(st, n) stays the entry point for each step, so tools/perf.js and tools/bench.js (“Moving round, its call”) read the longest step. In VB-241’s calendar the round is one entry for the day, whose run reads the step of the day. movingRound(st) (the drawer’s button, the tests) runs every village and then the three phases.villageRound(st, v), holds today’s marriageRound for one village. Its households fill the village store (fillStores, for this village only). The pool is the village’s own unmarried men (settlementIdOf is v), under today’s tests (age, single, not retired, fed), and the unmarried women of every village, as today. A woman married in an earlier village’s step is no longer single. A woman held by an open offer (st.offers, VB-293) is taken. The men’s order within the village, the score, minScore, goAhead, the means to marry and the put-off log per village are unchanged.heirRanking(st, hh) by household, together with its other memos (places, handed, means, housed), and clears them all after each marriage or handover it makes. The memos and the roundHeirs call are matchRules’s (src/sim/matching.js:32-33), so the ranking memo goes there, and matchBar (the player’s wish) reads the same fresh rankings; tests/wishes.js passes. Nothing reads the record: changedSince, homes and the sweep of handed by village (lifecycle.js:238-241) go. The marriages no longer call roundHeirs; VB-279 removes it.handover, lifecycle.js:260-269), and for each home in another village that the step’s marriages chose. It is the one function VB-293 made of that rule, which a marriage at an offer’s close also calls (closeOffer).wed clears her push). The reset of kinPush stops walking st.pawns (kinPressure, lifecycle.js:97, Rules for cost, 1). The living’s pushes are cleared at the first village’s step. A pawn’s push is cleared at its death (killPawn). The kin-barred log stays per village.tests/offers.js: a woman held by an offer from village 0’s step is not chosen by a man of village 1 the same day.tests/spread.js checks that each village’s step and each phase runs exactly once, with uneven advances. A run saved between villages 0 and 1, in the middle of the window, and between the last village and 18:00 goes on as the unbroken run. tests/saves.js passes. No progress is saved, since the step of the day says what is due.tools/marriage-demography.js. The means over the seeds of marriages a year and of mean first-marriage age, each within 5%. The share of living women 45 to 54 never married within 2 percentage points. Each seed’s never-married count is reported, and seeds 7 and 42 are reported.tests/counters.json re-recorded, with roundPairs, heirRank, roundRank and walkDaily listed. The tests/record.js anchors, if they move. Customs over 20 populous small years at seeds 7 and 42 (node tools/sim.js --report customs), the marriage limit included, since kin pressure now counts by village.medium-ref and small-y40, against 60 ms: VB-242’s prototype gives 15 to 30 ms at medium-ref (at most 229 rankings a step) and 7 to 24 at small-y40 (at most 188). The round’s rankings in all: about 1,900 at medium-ref against 521 today, and 1,700 against 396 at small-y40. The round’s total time is spread over the window (73 to 132 ms at medium-ref, against 27 to 39 ms in one step today), a few ms a game day over the year. A step walks the living once to build its pool, which is about 26,000 pawn visits a year at medium-ref; count it in VB.count.roundWalk, a declared counter. Time it with node tools/sim.js --load on each fixture --years 1 --report perf.@sys lines, docs/architecture/modules.md and ownership.md follow.
Notes:sim/matching.js (matchRules, which holds the round’s memos and its roundHeirs call since VB-274, and serves matchBar) added to what it edits, and VB-293 (done) dropped from the order notes.backlog/VB-242.md.marry call, inside the matcher’s loop, and that loop moves into villageRound unchanged, so carrying the offer costs nothing here. VB-293 also extracted the handover rule this task needs (handover).sim/clock.js and sim/lifecycle.js. This task also edits sim/matching.js (matchRules). VB-279 follows it.QUESTIONS.md under “VB-242”, for Kim to overturn: demand, claims, plots, settlement and service stay island-wide after the villages’ steps. They reach across villages by design (claims within CLAIMS.farmReach, service within SERVICE.reach, settlers to another village’s land), and each phase is within 60 ms. Nothing here waits for the answer.QUESTION_ARCHIVE.md, VB-242): what reaches between villages will be governed by distance, with the pawn travelling (plan: VB-281). This task leaves demand, claims, settlement and service as they are today, island-wide at their fixed steps; VB-281 says what changes.QUESTIONS.md, “VB-281”, question 2). VB-288 follows this task and narrows the village’s pool to the women within walking reach, with the score’s village term by walking hours; VB-287 (journeys) makes a spouse who moves to another village walk there, which changes where the mover stands, not who moves, so nothing here waits for it. One at a time with VB-287 and VB-288: all three edit the round’s day.src/sim/lifecycle.js: marriageRound became villageRound(st, v); roundPhase(st, n) is the entry for
each of ROUND_STEPS (63) steps: 0 to 59 the villages (village k on step k up to 60 villages, else the villages with floor(k * 60 / n)
equal to the step; the arithmetic checked for 1 to 400 villages, every village once), 60 to 62 the three island-wide phases at 18:00,
18:06 and 18:12. ROUND_PHASES became ROUND_STEPS (the export count unchanged). sim/clock.js: one calendar entry for the round, ticks
0 to 62 from noon of autumn day 11, whose run passes the step. src/sim/matching.js: matchRules holds the fresh ranking memo
(rank(h), heirRanking(st, hh)) with places, handed and means, and clear(); roundHeirs is no longer called by the marriages,
the handovers or closeOffer (only by demand, phase 60, until VB-279). changedSince, homes and the sweep of handed are gone.
src/sim/help.js: fillStores(st, v) for one village (all with no v). kinPressure takes the step’s village, its married couples, and
its pool; the reset walks the living at village 0’s step, inside the pool’s walk; wed and killPawn clear a push. New counter
roundWalk (src/vb.js). lifecycle.js fell from 679 to 646 formatted lines.taken), so a wish still comes first, as it did when the island asked in one list.refreshRoles runs at village 0’s step and at the end of a step that married or handed over (roles change only then); it is a walk of
the living, so not every step.main at 6b03ada, after this branch.
tools/marriage-demography.js’s summarize): marriages a
year 6.194 -> 6.108 (-1.4%, in 5%); mean first-marriage age 20.97 -> 20.89 (-0.4%, in); never-married share of living women 45 to 54
3.37% -> 0.46% (-2.9 points: out of the 2-point band, on the side of fewer women unmarried; against docs/bench/demography-reference.json
6.053, 21.26, 3.08%: +0.9%, -1.7%, -2.6 points). Never married by seed, before -> after: 1 0/19 -> 0/17, 2 0/11 -> 0/9, 3 0/15 -> 0/13,
4 2/21 -> 1/18, 5 0/15 -> 0/17, 6 1/24 -> 0/22, 7 0/8 -> 0/7, 8 0/15 -> 0/15, 9 1/28 -> 0/25, 10 0/15 -> 0/15, 11 1/24 -> 0/23,
12 4/21 -> 0/18; seed 42 3/22 -> 0/20. Seed 7: 6.03 -> 6.23 marriages a year, age 20.86 -> 20.55; seed 42: 6.43 -> 6.43, 20.91 -> 20.98.--report customs): the culture’s customs at year 20 the same before and after
([0,0,1,1,1,0,1,0,0,0,1,0,0,0] at both seeds), the marriage limit included.tests/counters.json, by hand: roundWalk added (0.0653 a living pawn-day on the tiny probe),
heirRank and roundRank 0.0267 -> 0.0203 (fresh rankings are lazy: the tiny probe’s round ranks fewer farms than roundHeirs’s
eager direct heirs); roundPairs and walkDaily unchanged (0.001125 and 5.998 measured before and after). The counters that were
already out on main (routeSearch, routeRefresh, walkPoint, oppAsk, matchBid, occasionAsked) are as on main. tests/record.js
fails on main as here (kinds cartGone, cartBuilt not in HISTORY; not this task’s).main, loaded in both trees): medium-ref (1,012 living, 30
villages): the marriages’ step 251 ms -> longest village step 61 ms; rankings in the marriages 478 -> 2,016 (at most 281 a step);
the marriages’ total 251 -> 419 ms over the window; roundWalk 29,348 pawn visits. small-y40 (763 living, 22 villages): 779 -> 199 ms
(at most 430 rankings a step, 3,586 in all against 468); total 779 -> 881 ms; roundWalk 16,786. The phases from 18:00 are unchanged
(demand 406 and 322 rankings; settlement the longest step at medium-ref, 171 ms under load). tools/sim.js --load --years 1 --report
perf: the moving round’s longest call 745 -> 292 ms at medium-ref, 312 -> 439 ms at small-y40 (noise of the shared machine: the
one-by-one run above gives 779 -> 199), its year 1,651 -> 883 ms and 410 -> 1,782 ms. Rankings are above VB-242’s estimate (1,900 and
1,700): with land residence every woman’s place is ranked again after each marriage. Against 60 ms the longest village step needs a
quiet machine’s measure; the nightly bench reads it (“Moving round, its call”).