Status: done (2026-11-11)
Priority: 3
Size: S
Arch: life
Phase: wrap-up
Design ref: The player and what they see (VB-079); Commands, time steps and views; Systems overview (findings 4 and 6); docs/review-life.md.
Goal: Check slice 2 as a whole once its implement tasks are done. A line can be played over three generations through the player’s doors. A played run that is saved and loaded many times plays exactly like one that never was. Commands carry out all pawn work, and the slice costs the simulation nothing.
Acceptance criteria:
tools/sim.js --player SCRIPT, or a test helper) plays the founders scenario at seeds 7 and 42 for 75 years. It inhabits the first holder, queues work from Sim.opportunities on some days, argues one cause, sets one wish at a moving round, and goes on as a successor at each death. It answers each offer of marriage that waits for it (VB-293), refusing one, and wishes for a match once (VB-274). Report the pawns played and how each followed the last (heir, kin, household, tie, or a break), the causes argued and the meetings’ outcomes, the offers answered, refused and left to their due time, and how the line’s households fared against unplayed households (hungry days, farms held, children).st.player), ends with the same golden hashes as the unbroken played run. The same holds for populous medium over 5 years, saved every year, with no player.Sim.opportunities is reported in ms a call there (target under 1 ms; at medium-ref), with the residual. Report save sizes and times (VB-214) and the record’s size per decade, and propose limits for any that grows faster than linearly.docs/bench/budget.md) gains slice 2’s line: 0 ms a game day of simulation.
Notes:docs/roadmap.md, section 3.2; the slices Decided by Kim): moved to slice 2, arch life (from core).tests/lib/line.js is the scripted player (playLine: seeds, years, saveEvery, player); tools/player.js makes the full
runs (node tools/player.js is the played line at seeds 7 and 42 for 75 years, unbroken and saved every 5 years, and unplayed; --medium the no-player
save check; --cost the cost lines, from the fixtures); tests/line.js is the reduced check in npm run verify (populous tiny, 3 years, seed 7: hashes
with and without the player, saved yearly; jobs against work commands; the auto-off day). The refused-matches band joins tests/lib/bands.js (below).
src/ is untouched: golden file and counters are as on the integration branch. The player’s choices read only the state (and its own tallies), so a
loaded run chooses as the unbroken one. Commands are counted by wrapping each verb’s run in the script; no counter was added to src/.Sim.opportunities on every third day; one cause; one wish; one match wish; offers: the first
refused, every third left to its due time, the rest yes; at a death the first of Sim.successors, or any adult for a break):
debug. Seed 42: the same kinds, player work 424, answer 2, round marry 14, claim 9, handOn 2.work command: 99 taken, 99 commanded, 0 stray at seed 7
and 117, 117, 0 at seed 42. The reduced test (populous tiny) took 756 and found 0 stray. The sources are planner, player, round, meeting, talk, help,
construction and restoration (the script’s tally names whichever it sees; debug appears only in tests).haltForTalk pauses an idle pawn: not an act of its own.)st.player) ends with identical golden hashes (all 48 state keys, wear included) to the
unbroken played run at both seeds. Populous medium, 5 years, no player, saved every year: 895 living, hashes identical; 5 saves, total 33.4 MB of JSON,
the largest 7.7 MB, 1.4 s of encode and stringify in all.src/ change, so golden and counters are as before the slice. The game day with a player against without, 20 days from each fixture, three alternate
runs, median (node tools/player.js --cost): small-y40 unplayed 122.3 ms / played 109.8 ms, and the same unplayed run twice differing by 2.1%; medium-y5 154.9 /
143.4, the unplayed twice differing by 8.2%. The machine was shared by five agents, so the spread is 2 to 10 times the 1% target and no overhead can be read from it
(the played run came out faster, which is noise). Residual: not measured to 1%. The cause is the machine; the cost is argued instead: with a player the day adds
one Sim.opportunities call every third day (0.17 to 0.24 ms, below) and a queue check each step, about 0.07 ms a day of the 110 to 150, 0.05%. To measure
it to 1%, run --cost on a quiet machine (--days 48).
Sim.opportunities at medium-ref: 0.17 to 0.24 ms a call (600 calls over 200 housed pawns; target under 1 ms; in); the largest list is a holder’s, with the work
kinds of its farm and village.node tools/save-times.js, 2 runs, medium-ref, year 10, 1,019 living): encode 89 ms, stringify 72 ms, gzip 173 ms, gunzip 57 ms, parse 46 ms, decode 84 ms; JSON
9.4 MB, gzip 2.3 MB (budget 10 MB); main thread to save 161 ms and to load 130 ms, against 0.5 s. In Chromium: encode 77 + stringify 74 ms (the gzip, 787 ms, is async
CompressionStream, off the main thread). small-y40: JSON 8.1 MB, gzip 2.0 MB. The tool’s world regeneration is outside these numbers (a loop of
playLine reload spends about 0.9 s a load, nearly all in generating the small map).events of the stamps): small-y5 2,991 events with 359 living, small-y40 27,058 with 691 living, medium-y5 7,408 with
895, medium-ref (year 10) 12,984 with 1,019. A decade adds about 6,900 events at small (35 years: +24,067), Per living pawn:
8.3 events at year 5, 39 at year 40, 12.7 at medium year 10: growing with age, not with the square of the population, and less than linearly in years (the yearly fold
of routine events, VB-199). The save’s JSON per living pawn grew from 7.9 KB (small-y5) to 11.8 KB (small-y40), 1.5 times in 35 years. Nothing grows faster than linearly
in what it counts, so no new limit is proposed beyond the existing: save under 10 MB JSON and 10 MB gzip at medium-ref (now 9.4 and 2.3). The JSON size is 94% of its
10 MB mark at medium-ref already, which a later slice’s state will pass: a task for the save’s size (drop the pawn’s ties of far kin? gzip stays at 23%) is the follow-up
Kim might want; it is not added tonight.docs/bench/budget.md and tools/bench.js (which writes it) say “slice 2’s 0 ms, VB-078”; the shares still sum to 192.1 ms. docs/roadmap.md section 3.2 has a
line for the wrap-up.refused-matches (refusedMatchShare: matches refused over refusals and marriages after year 3, range 0 to 0.2, kind watched) is added to tests/lib/bands.js, as a
report on the full runs and an assert on the reduced one; sample counts matchRefused events a year. The full runs of tools/bands.js (15 to 20 minutes) are not run
tonight (night-run rules), so the band is not yet reported on populous or founders at small; run node tools/bands.js or npm run nightly for it.tests/offers.js, section 10: with opinions set through remember, (a) MARRIAGE.liking moves matchScore by the
mean of the two opinions (and by nothing else; a one-sided opinion counts half), (b) an unplayed young man at enmity answers no and the match closes at once with the
refusedMatch of his spokesman paid (his father’s opinion of him falls by at least 0.15), (c) an unplayed father at enmity with the bride answers no and pays nothing, and a
control with dislike above SOCIAL.enemy marries. It found VB-275’s code doing what backlog/VB-275.md says; nothing to fix.tools/sim.js --player SCRIPT was not added: the criterion allows a test helper, and tools/player.js runs it.