Status: done (2026-11-17) Priority: 2 Size: M Arch: crops Phase: implement Design ref: Goods and the farming year, Crops and rotations (design.md, section 8) Goal: The rotation (The rotation), with the simplest head: every holder holds its village’s usual rotation where it has the seed. A village with barley alone farms every year, as now. Acceptance criteria:
ROTATIONS as rules: every year (barley); two courses (barley, fallow); three courses (fallow, rye, barley); barley and peas by turns; peas, rye, barley. A field holds rotation (a key) and step (@state, invariants: a known key, a step inside it, the field’s crop the step’s course).atFarm).fieldsWanted counts sown fields against the hands (FIELDS.perHand) and adds the fallow ones on top.v.rotation, @state, owner: say which module, by target-v2 section 4): the one most of its farms hold, updated at the autumn meeting and at no other time (Kim, 11 Nov), as a step of the meeting’s work, a village a step; a new household starts with it if it has the seed. In this task every holder holds it.node tools/same.js --base REF prints same. Numbers, populous small, seeds 3, 7, 11, 42, 15 years, with every village given rye by a test switch: fields a farm, rations by crop (tools/balance.js reports by crop), hungry household-years, soil; and whether households, not only averages, are better off. (same.js cannot print same once a state field is added: it reports 1,724 leaves added, rotation: "every" and step: 0 on every field and a village’s rotation, and none changed or gone; see the notes.)
Cost: a field a year at its turn; a village a year at its meeting, over its farms (bounded by the village’s households). No daily work.
Notes / questions:QUESTION_ARCHIVE.md, VB-345): its numbers are design.md’s starting values, Agreed.ROTATIONS in sim/rules (a plain table, as CROPS): every, two, three, peas (barley and peas by turns), peasRye, each
{courses, label}. Every field holds rotation and step (sim/layout, sim/fields broken; older saves get barley every year).sim/fields): a field moves on when its last load is taken up (hauled), when its crop is lost (frost, left standing),
when its sowing window closes with it unsown (on the day after, a field a farm on two days a year), and a fallow course on the
autumn’s first day after the summer it stood fallow (its rest mark), so that rye is sown on it that autumn. Barley every year never
moves. The haul task carries its crop, so the last loads are booked as the crop reaped (sim/kinds, sim/lying).holdRotation, at each review of its plan, before the fields wanted): it takes the village’s usual rotation when it has
every crop of it, a field’s seed in store or a field bearing it; short of a crop’s seed when a field at that course is in its window,
it falls back on the rotation without that crop that keeps most of its crops (then one with fallow), logged once at the farm; a change
waits while a field stands under a crop the new rotation has not. Fields are staggered again on a change (restagger), and a new
field takes the step fewest fields are at, the course sown soonest among them (placeField).sim/hunger seedNeed, sim/plans reserveSeed): of each crop of the rotation, the fields that sow it next (a fallow field’s
next sown course); and a field’s seed of a crop no field bears or sows next. Barley’s seed is the plan’s target, as before; rye’s and
peas’ the crop’s own.fieldsWanted(st, hh, workable, bias): the sown fields by the mean net of the rotation’s sown courses, times the head’s bias, capped
by the hands, then the fallow courses on top in their share (three courses: half as many again). The head’s headFields became this
one rule. The village overview’s hands warning counts sown fields.v.rotation (@state): owned by sim/fields (target-v2 4.3: a reading of its farms’ fields), written only by usualRotation,
which sim/meetings calls in each village’s meeting step; the most held among its occupied farms, a tie keeping the one it has. A
settlers’ new village starts with its mother village’s.Sim.seed(w, seed, scenario, null, {rye: true}), --rye in tools/sim.js and tools/balance.js (sim/scenarios
giveRye): every village in three courses, each farm’s fields staggered at the start, the rye course sown the autumn before and
standing, a field’s seed of rye for each fallow field taken from the barley its household brought. Founders’ farms have no field at
the start, so the switch leaves founders as it was. tools/balance.js reports grain by crop (the harvest’s ledger entries name a
crop other than barley) and fallow fields.rotationWalk,
a new counter); unsown walks the fields on two days a year. Nothing daily, nothing over pairs.decision, with the design text it would change): a course also ends when
its crop is lost or its window closes unsown, and fallow ends on the autumn’s first day after its summer; a crop standing in a field
counts as held, the fall-back is made at the sowing and onto a rotation without the crop short (none: the rotation is kept, so barley
every year never falls back); a crop of the rotation no field bears or sows next keeps a field’s seed; v.rotation’s owner is
sim/fields; the stagger’s tie-breaks (a field keeps its course, else rests; a new field the course sown soonest).tests/rotations.js (new, in npm test): the table; the usual rotation taken at the review with the seed, not without;
staggered; seed held back by crop; the fields wanted with fallow on top; the steps (in, lost, unsown, fallow over); the fall-back to two
courses logged once and three courses again with rye; the wait under peas; new fields placed; the meeting. tests/rye.js and
tests/peas.js now run their fields through the rotation (three courses; barley and peas by turns) instead of forcing the crop, and
tests/lib/invariants.js checks rotation and step (and the seed reservation by crop). npm test 64/64; npm run verify passed but
for tests/review-tools.js (village.rotation wanted its place in tools/stocks.js), mended and rerun.node tools/same.js --base 984607d (founders and heirs, seeds 7 and 42, tiny, 2 years) differs only by the leaves
added: 1,724 of them, every one rotation = "every" or step = 0 on a field (and the copies of fields jobs hold) or a village’s
rotation = "every"; no leaf changed or removed. Founders, seeds 7 and 42, small, 15 years, with --rye runs to the base’s numbers
line for line (its farms have no field at the start).Numbers (populous small, 15 years; balance from year 2; rations a household-year, grain net of its seed), barley every year → every
village given rye (--rye):
| seeds 7, 42 | seeds 3, 11 | |
|---|---|---|
| fields a farm (of them fallow) | 4.6 → 5.9 (1.8) | 4.7 → 5.8 (1.8) |
| grain: barley + rye | 344 + 0 → 176 + 137 | 356 + 0 → 179 + 127 |
| food made / need | 2.00 → 1.84 | 2.01 → 1.84 |
| household-years under their need | 8% → 15% | 7% → 17% |
| tenth percentile of made / need | 1.08 → 0.84 | 1.10 → 0.79 |
| hungry household-years (hungry days) | 8 (33) → 6 (22) | 8 (48) → 10 (23) |
| soil, mean of fields | 1.066 → 1.117 | 1.049 → 1.108 |
Growth (principle 2): populous seed 7, 350 → 442 living at year 15 (1.57% a year) → 438 (1.51%); seed 42, 347 → 485 (2.26%) → 485 (2.26%); founders seeds 7 and 42, 10 → 21 (5.1%) both ways. Hungry household-days over the 15 years (tools/sim.js): populous 7, 26 → 25; 42, 10 → 8; founders 0. Every seed grows; none falls.
tuning note; no parameter tried here.sim/plans closing)
read barley’s window alone; both in the follow-up task VB-999. The page shows a field’s crop as before (its rotation is VB-355’s).