Status: done (2026-11-10)
Priority: 2
Size: M
Arch: life
Phase: implement
Design ref: Inheritance, expansion and other bodies (Marriage as a negotiation: The offer, Who negotiates, Consent, The player’s doors; Leaving home); The player and what they see (Marriage). Survey and plan: backlog/VB-233.md.
Goal: The moving round’s matcher (marriageRound, src/sim/lifecycle.js) marries each pair it finds at once, so the player has no say. Make each match an offer that the two who marry and their spokesmen answer. A side that is not the player answers yes at once, so a run with no player is unchanged. An offer the player must answer waits up to 7 game days, as plain data with a due time in st.offers, and the world goes on meanwhile. This is the first question answered through Decisions.answer (here Sim.answer; slice 5’s Decisions module takes it over).
Acceptance criteria:
spokesmanOf(st, id) in src/sim/records.js: the holder of the pawn’s household when the pawn lives there as a son or daughter of the house (a child of the holder, of the holder’s spouse or of the holder’s parent, not in service, and not the holder); otherwise the pawn itself.st.offers: the open offers, sorted by due, each {id, man, woman, home, village (the man's), made, due (made + 7 × DAY), answers: [{key: 'man' | 'woman' | 'manSide' | 'womanSide', by (pawn id), yes: null | true | false}]}. A spokesman who is also the one to marry gives one answer. Ids come from a counter in st and are never reused. Owner: sim/lifecycle (in src/owners.json; planned to move to Decisions in slice 5). @state line, invariants in tests/lib/invariants.js (sorted by due; due at most 7 days after made; no pawn in two open offers; each answer’s by is the man, the woman or their spokesman at the time the offer was made), and saved with the run.marriageRound, where it issues marry today (lifecycle.js:255), the pair becomes an offer. Every answer whose by is not the played pawn is yes at once. If every answer is yes, the round marries them there and then, as today. Otherwise the offer goes into st.offers, the woman stays in taken, and the matcher goes on. A pawn in an open offer is not free to any man of the round, nor counted as unmatched by kinPressure. A refused offer leaves both unmarried until the next round.answer in src/sim/commands.js (source player): target the offer’s id, args {yes}. It checks that the offer is open and that the played pawn has an unanswered answer in it, and sets all of that pawn’s answers. Sim.answer(st, offerId, yes) issues it.st.offers[0].due, so nothing is polled between rounds (Rules for cost, 4). Once VB-241’s calendar exists, this is one daily entry, guarded by an open offer. A marriage made at the close goes through the marry verb (source round). The round’s handover for the home household then follows it, as at the round: the rule of lifecycle.js:272-285 moves into one function that both call, and refreshRoles runs. If the verb refuses (one of them has died or married), the offer lapses, and its reason is logged.tests/record.js): offered when an offer is stored, in the records of both who are to marry, naming the home’s farm; matchRefused when one is refused, naming who refused; offerLapsed. A marriage at the close is the married event as today. Matches answered at once write nothing new.SOCIAL.memories.refusedMatch (Refused the match I made, v -0.2, cap -0.4, 3 years), in the spokesman’s record of the pawn. When the player refuses as a spokesman, nothing is remembered.skipStop (src/sim/notable.js) stops on an offer that waits for the played pawn’s answer (a new SKIP reason, offer), and skipFrom notes the open offers, so a skip that begins with one open does not stop on it at once.tests/offers.js in npm test). With no player, the golden file and tests/counters.json are unchanged (roundPairs included). When the played pawn is the man, his match waits: the woman is not married to anyone else in that round; yes marries them at once in the round’s home, and the handover follows as it would have; no leaves both unmarried and logs the refusal; no answer marries them at the due time. When the player is head, a son’s match waits for its answer, and the son’s own answer is yes. When the played young pawn refuses its head’s match, the head’s opinion of it falls by 0.2. When the man dies with an offer open, it lapses. A save made with an offer open loads and plays the same as the unbroken run.medium-ref and small-y40 after 1 year: unchanged, since there is no player (13 and 7 at 74ee065). A scripted played run (founders, seed 7, small, 30 years, inhabiting the first holder and going on as heir): offers stored, answered yes, no and unanswered, and marriages of the played household against unplayed households.medium-ref that is 13 matches a year over 211 households, about 0.06 a household a year, and at most the played household’s unmarried adults. Each match adds four spokesmanOf calls (O(1): the household’s holder and two parents) to the round’s 1,455 pair scorings at medium-ref. Name it measured: node tools/sim.js --load medium-ref --years 1 --report perf before and after.
Notes:st, a woman held by an offer in one village’s round is not free in a later village’s round the same day.marry call inside the matcher’s loop, and VB-277 moves that loop into a village’s step unchanged. The function this task makes of the round’s handover rule (lifecycle.js:273-285) is the one VB-277 calls for a village’s farms and its marriages’ homes, so write it for one household, taking a ranking function. Until VB-277 lands, the man’s village’s round is the island’s round, and nothing here needs to know villages.refusedMatch memory is a memory of something that happened, which VB-240 keeps. Whichever lands second adds it to the other’s list.src/page/play.js.tests/golden.json and tests/counters.json unchanged, and the only golden change allowed is the presence of the new always-empty state fields; nothing is polled between rounds (the day’s end reads only the first offer’s due time).Impact note (for the PR). Size M, two new state fields. Reads: the round’s pool, places and homes (unchanged), st.player (the played pawn), the household’s holder, its spouse and parents (spokesmanOf). Writes: st.offers and st.offerSeq (owner sim/lifecycle, in src/owners.json; planned to move to slice 5’s Decisions), the record (offered, matchRefused, offerLapsed), a spokesman’s relation record (refusedMatch, through sim/relations’ remember). New coupling: sim/clock’s day’s end calls dueOffers (sim/lifecycle) after the daily life and births; sim/commands’ verb answer calls sim/lifecycle’s cannotAnswer and answerOffer through later, as marry calls wed; sim/notable’s skip reads st.offers. No new module: the offer is the round’s (the matcher’s marry call), and its close is the marriage and the handover the round already makes, so it stays beside them; lifecycle.js is at 397 of its 400 lines. The round’s handover rule is one function, handover(st, hh, rank), called by the round for every household and by an offer’s close for its home (VB-277 calls it for a village’s farms).
Implementation (10 Nov 2026, VB-293):
spokesmanOf(st, id) (src/sim/records.js): the holder when the pawn lives in its household, not in service, as a child of the holder, of the holder’s spouse or of one of the holder’s parents; otherwise itself.marriageRound: at the marry call, with a pawn played, the match’s answers are made (answersOf: the man’s and the woman’s, and a manSide/womanSide answer only when another speaks for them); every answer not by the played pawn is yes. All yes: the round marries them as before. Otherwise makeOffer stores it (sorted by due, id from st.offerSeq), the man joins the woman in taken, and the matcher goes on. At the round’s start the pawns of open offers are put in taken and their men skipped, so they are free to no one and count as matched in kinPressure. With no player none of this runs: no spokesmanOf call, no answer is made, the round is the old round (so the cost criterion’s “four spokesmanOf calls a match” is zero without a player).answer (src/sim/commands.js, source player): refused unless the actor is the played pawn, living, args.yes a boolean, the offer open and the pawn with an answer still to give in it; Sim.answer(st, offerId, yes) issues it. answerOffer sets all the pawn’s answers; a no as the one to marry, with another as spokesman on its side, makes that spokesman (if living) remember refusedMatch of the pawn (SOCIAL.memories.refusedMatch: -0.2, cap -0.4, 3 years). The offer closes at a no or when all are yes.closeOffer: a no logs matchRefused (the text names who refused); otherwise the marry verb (source round), then handover for the home with a fresh roundHeirs(st).rank and refreshRoles; a refused verb logs offerLapsed with its reason. dueOffers(st), called at the day’s end (hour 0, after dailyLife and dailyBirths), closes the offers whose due time has passed, their unanswered answers yes; it reads only st.offers[0]. MARRIAGE.offerDays is 7.offered in both pawns’ lives (as married is, a self telling each and one log line naming the home’s farm), matchRefused, offerLapsed; all three notable (kept, HISTORY 0) and in the chronicle’s Marriages filter.SKIP.offer; skipFrom notes offer: st.offerSeq (the next offer’s id), and skipStop stops once on each offer from that id on that waits for the played pawn. A note of the next id rather than a list of the open ids keeps tools/writes.js able to place the writes (a list’s push was two unresolved writes, over the test’s 20).st.offers is saved with the state; a save without it (all saves before this task) loads with none open and offerSeq 0, so the save format stays 3 and the fixtures load.tests/lib/invariants.js): sorted by due, made no later than now, due after made and at most 7 days on, ids unique and below offerSeq, man and woman pawns of their sex, no pawn in two open offers, the answers man and woman by them and at most one spokesman’s answer a side by another pawn, none a no and not all yes (an offer closes then). Who spoke for whom when the offer was made is checked in tests/offers.js (a spokesman may change while it is open).Validation (10 Nov 2026):
node tests/golden.js differed only by the two new keys, offers ([]) and offerSeq (0), added to each of the 16 state entries (founders and heirs, seeds 7 and 42, seed and years 1 to 3), and by apiKeys.Sim, which hashes the names of Sim and changes with Sim.answer (the criteria ask for it); every other hash is as before. Re-recorded with --update. tests/counters.json unchanged (node tests/counters.js: 0 counters out, roundPairs included).npm test: 89 scripts pass (with the new tests/offers.js), 2 targets out as at the base (scaling.routeRefresh +0.1147, scaling.roundPairs +0.85). npm run verify: 104 scripts pass, 6 targets out: the two above and history.routeExpand +0.4405, history.routeRefresh +0.5579, history.roundPairs +2.128, history.recordFold +1.511, from the fixtures; none is this task’s, since with no player nothing here counts work or changes the run (golden and counters unchanged). The fixtures (format 3) loaded; no fixture check was skipped.tests/offers.js (populous tiny, seed 7, every household given the means, chances forced for the round): the round’s first marriage is a son (his father speaks for him) and a woman who speaks for herself, with the farm handed to him. Played as the man, the match waits with answers man (his), manSide (yes) and woman (yes), due 7 days on; the woman stays unmarried, and a second round does not match her; yes marries them in the home and hands him the farm as the unplayed round did; no leaves both unmarried, logs the refusal naming him, and his father’s opinion of him falls by 0.2; unanswered, they marry at the first day’s end after the due time and the handover follows; played as the head, the son’s answer is yes and the head’s waits, and the head’s no costs no one’s opinion; the man killed with it open, it lapses at its due time (“pawn N is not a living pawn”); a save with it open loads and plays 8 days as the unbroken run (every state key equal); a skip stops on it, and one begun with it open does not.medium-ref 18 before and after (the criterion’s 13 was at 74ee065), after small-y40 5 before and after; every column of tools/sim.js’s line is the same.node tools/sim.js --load tests/fixtures/medium-ref.gz --years 1 --report perf: the moving round 131.4 ms before, 52.4 ms after (4 calls; the whole run 238.4 and 135.5 ms a day): the difference is the machine’s load (other agents ran beside the first measurement), not this change, which with no player adds one length test a day and nothing in the round. With a player: one stored offer for each match that touches the played pawn or a member it speaks for, and one roundHeirs build at each marriage made at an offer’s close.handover(st, hh, rank) and moves the offer into the man’s village’s round unchanged; a refusal made between two villages’ rounds of the same day would let the two be matched in a later village’s round that day, which the design’s “the round does not look again for the two that year” forbids: VB-277 should keep the refused pair out until the next year (e.g. a refused offer’s pawns noted for the year). VB-273 reads st.offers (an offer waits for the played pawn when an answer by it is null) and calls Sim.answer; skipStop gives why: 'offer'. VB-274’s wish “not this year” leaves the played pawn out of the pool before any offer; a wished partner should become an offer like any other (all its answers yes but the other side’s).