Status: done (2026-11-16) Priority: 1 Size: M Design ref: docs/review-blocks.md; design.md section 7 (A leg, and its end, to The timetable); docs/mocks/blocks/README.md Goal: Work costs an event at its start, its end and a change of hands, not a step every 6 minutes (Rules for cost 3, 4). Acceptance criteria:
done, the step it was reckoned at, the summed rate of its hands at work; doneOf is the only read of progress outside its owner. Reckoned, and its end queued again, when a hand joins or leaves, when a hand’s rate changes (the meal), at the end of work and at a cut.st, sorted by step, bounded by the tasks under work, saved; a loaded run goes on as the unloaded one (tests/saves.js).worked (a stake renewed, a claim worked, a plot’s hours by pawn, grazing by whole hours) run at the reckoning with the hours since, and give the same totals over a day as today.a.work (the rows) is no longer simulation state; the page draws the rows from the task and the time (tests/smoke.js, the browser tests it touches).walkStep falls).--report perf and the counters early and on a late save.
Notes / questions:docs/review-blocks.md, section 4, step 2). Kim, 15 Nov: scheduled blocks, a breaking change allowed.tools/same.js cannot show this step: the state’s shape changes. It is shown by VB-471’s invariant, the island’s numbers and the counters.sim/agents, a section “work as a block”: a task holds done (at its last reckoning), at (the tick reckoned at), rate (its hands’
hours a game hour, manning: rateOf, the ox team, the cart in carting) and due (the step whose work ends it). settle brings done
up to now and runs the kind’s worked for each hand at work with the hours since (a plot’s hours by pawn too); rerate reckons the rate
again and moves the end in st.workDue. Called before and after every change of hands: start, arrived (go to work), release,
freeHands, deposit of an again-task, hold/unhold, a task’s end (dueWork/ended, the tail of the old stepWork); at the end
of work and after the meal (reckonAll, two calendar entries, so a hand’s hunger, health or an ox team come or gone are taken up within
the day); a change of hands on a task under the ox team reckons the household’s other team tasks (withOxen moves the team).st.workDue: the tasks of full attention under work, sorted by due then id, each once (binary search, splice): bounded by the tasks
under work; plain data (job references, saved with their sharing); absent until the first. stepAgents takes what is due before its
loop (dueWork); a pawn at work is no longer in st.awake, and the hands a task’s end frees are woken.workTick is the tick while the agents’ step has begun, the one before until then,
so a hand released at the calendar’s hour (16:00) does not work that step and one arriving mid-loop works from the next, as stepped.
A loaded run sets the marker (loaded, from sim/saves), and reckons the tasks of an older save (its job.cast, agent.work dropped).due. Grazing’s hook adds a pressure for each whole hour crossed since (from).agent.leg also marks the start of a work leg ({t, x, y}); the page (page/animate rowPlace) walks a field’s rows from it
at the drawn time (the row’s start is read back from the leg’s place), with the facing (drawFacing) the ox team and the rig use.doneOf(st, j): read by sim/jobs (hoursLeft, the head’s allotment and call), the facade’s plotProgress (a page view), tests.
kinds.isOpen and the copies of a stage’s hours in sim/expansion and sim/farmclaims load before sim/agents and keep reading
j.done, which is now the hours at the last reckoning: exact whenever no hand is at work, and below the task’s hours while one is (an
invariant), which are the cases they test (work left; a stage dropped once its hands are gone). See decisions.workReckon (tasks reckoned with hours since). tests/counters.json: only walkStep (its fall) and workReckon (new)
recorded; every other counter is left at the run branch’s baseline.0.1 × 8 falls short of 0.8, so a
task of whole tenths took one step more than its hours (water 0.5 h took 0.6). The closed form ends at its hours. A formula that computes
something other than it says is a fix (principle 3): water fetching fell about a tenth of its hours (below).isOpen and the two copies read the reckoned done rather than doneOf (load order: they come before sim/agents; moving the closed
form under them is a restructuring the task does not ask). Close call.tests/head.js: the template’s hay was below three winters only because the fourth meadow’s mowing was left 0.9 h short at nightfall
by the tenths and taken down; ended at its hours it is mown. The assertion now holds the template at two winters or more and no more
than the head’s choice. Close call.st.jobs without its hands freed (only tests do this) ends it as the stepping did.npm test 55/55; npm run verify (all hard checks pass; targets as on the run’s branch); node tests/smoke.js, tests/browser.js,
tests/browser-speed.js pass (the speed and between-steps checks hold a pawn on its rows within its field). Screenshot:
docs/img/vb472-work-blocks.jpg (founders 7, small, hands at work at their spots, 8 h in).tests/legs.js (VB-471’s, rewritten): over 12 days of the probe, 1,125 walk steps with placeOf within 3e-13; 295 tasks under work,
248 ended at the step their last reckoning foretold, none past it, 158 reckoned again in between; doneOf the closed form of the last
reckoning at every step. New invariants (tests/lib/invariants.js): the queue (posted, full attention, rate > 0, due after now and as
its done and rate give, sorted, once), each task’s at/rate/done (a hand at work has a rate, none none; done below its hours while
worked), every task under work queued, no a.work.tests/oxen.js, tests/attention.js, tests/health.js, tests/hunger.js, tests/hands.js read the rate or the reckoned progress
in place of stepWork.populous small, 3 years; founders small, 10 years; --report hours and --report counts:
| Run | Living (end) | Hungry household-days | Mean grain (end) | Idle share of workers’ hours |
|---|---|---|---|---|
| populous 7 | 374 -> 374 | 29 -> 22 (6/23/0 -> 4/18/0) | 575.9 -> 563.3 | 51.7% -> 52.4% |
| populous 42 | 368 -> 368 | 0 -> 0 | 474.4 -> 465.1 | 48.3% -> 48.8% |
| founders 7 | 19 -> 19 | 0 -> 0 | 683.8 -> 685.5 (year 9: 612.0 -> 642.8) | 22.9% -> 22.7% |
Hours a household-year by kind (work and walking, mean over the groups by household-years), the ones that moved: water 58 -> 53 (populous 7), 62 -> 57 (42), 40 -> 35 (founders): the whole tenths; wood 68 -> 66, 86 -> 84; mow 71 -> 70, 62 -> 60; fish, thresh, reap, plow, cook, grind, weed within 1 to 2 hours. Hours freed go to idling (the idle share up half a point in populous). Households: in populous 7 the hungry days of year 2 fell from 23 to 18; no household is worse off in a way the summary shows (living the same in all).
Counters a living pawn-day: walkStep 94.6 -> 66.3 (populous 7), 98.1 -> 68.4 (42), 104 -> 62.5 (founders 7), 97.5 -> 67.2 (the late
save, populous 7 at year 20, one year on); workReckon (new) 2.0, 2.15, 3.06, 2.21; walkAwake 24 unchanged; walkPoint, talkWeighed,
dayTake, companyWeighed, idleStroll within 1 to 4% (the earlier ends free hands sooner). tests/counters.js probe, on the run’s
branch with VB-468 and VB-254 merged: walkStep 74.9 -> 52.8, workReckon 2.1.
--report perf (a description: the machine was shared, the before runs under heavier load): “agents: walking and working” 29.8% -> 19.9%
of simulation time at populous small year 3, 32.6% -> 22.7% on the late save; the times are left to the nightly bench.
counters/walkStep (the probe): 74.9 -> 52.8 a pawn-day, in; the change’s aim (re-recorded).counters/helpBid 0.2487 -> 0.2925 against a ceiling of 0.2921 (out by 0.00045), and counters/pastureTiles 4.619 -> 4.863 against
4.812 (out by 0.051): caused by this change, the hands a task’s end frees are woken at once and reach the help round and the herding
more often in the probe’s 30 days. Left out, not re-recorded.scaling.helpBid 1.248 against 1.15 (out by 0.098): the same cause, the help bids of the larger run grow faster than the smaller’s.counters/heirRank, counters/roundRank, and scaling roundPairs,
roundWalk, heirRank, takeInWeighed, frontTile, roundRank).complete or deposit) and a cart come home or
left reckon the household’s tasks under work that the team or a cart speeds (retune), as the stepping did at its next step.
tests/oxen.js: two team tasks of one household, the first completed, the second rated with the team at once (it failed without).loaded reckons every task with hands and no reckoning, whether the save had job.cast or not (tests/legs.js: a stripped task
under work is reckoned and queued at load).tests/head.js: the template’s hay is held below three winters and one meadow’s hay (3.71 in the scene; 3.15 measured).rateOf cannot reach 0 for a hand at work: hunger slows by at most HUNGER.slow 0.4, health by HEALTH.slow 0.3, and a child works from
CHILD.from (7) at CHILD.base 0.3, so the least rate is 0.3 x 0.6 x 0.7 = 0.126; the invariant stands as it is.walkStep 80.9 -> 51.8 (populous 7),
84.1 -> 54.4 (42), 94.3 -> 52.2 (founders 7), 84.5 -> 53.5 (the late save); workReckon 2.11, 2.23, 3.28, 2.31; helpBid
0.634 -> 0.689, 1.09 -> 1.16, 0.053 -> 0.062, 1.08 -> 1.09; pastureTiles within 3% but founders 2.18 -> 2.43. Living at the end:
375 -> 374 (populous 7), 364 -> 369 (42), 19 -> 19, 486 -> 486.