diff --git a/BACKLOG.md b/BACKLOG.md
index 222bb00f..b9eb2843 100644
--- a/BACKLOG.md
+++ b/BACKLOG.md
@@ -40,7 +40,7 @@ The order tasks are taken in, the first first (`node tools/backlog.js next`). So
| [VB-1709](backlog/VB-1709.md) | Fix: a herd standing away for a household with a farm is never led home (populous small seed 11) | - | 2 | M | VB-1682 found herd 155 standing at farm 0 for household 19 from year 12 on, its drove job never done |
| [VB-1738](backlog/VB-1738.md) | Tuning and design review of Stories | talk | 2 | L | With Kim: why old stories sharpen to ±1 and never fade (VB-1681's measure), the Stories model and numbers reviewed, the fix chosen, built and measured |
| [VB-1764](backlog/VB-1764.md) | One view of every plan: Sim.strip at four zooms, in place of the timetable and the agenda | plans | 2 | M | sim/timetable and sim/agenda made one view: a body's hours at a zoom (today, the days ahead, the season, the year), past days exact by part, what is to come as the levy in force and what is committed, each estimate a range by the looking pawn's estimate. |
-| [VB-1770](backlog/VB-1770.md) | A holder proposes a routine or a change of the custom of lots to the meeting | plans | 2 | S | The verb propose: any holder of the village puts a routine, or the custom of lots, on its meeting's agenda; the decision stays the meeting's by its procedure, and no controller has a ballot. |
+| [VB-1771](backlog/VB-1771.md) | Duties of the days ahead: one member sees to a type of recurring work without a window | plans | 2 | M | A duty, given by the head at its review, puts its holder first for one type of recurring work without a window (the wood, the water, the beasts, the cooking) in each day's allotment and nothing more; work with a window is never a duty. In place of VB-1553's removed mechanism. |
| [VB-1808](backlog/VB-1808.md) | A firewood goal keeps the timber a building counts on | - | 2 | S | VB-1775 review F3: one firewood task cuts all the timber home up to the season's goal, the timber a barn or cottage step counts on with it |
| [VB-1815](backlog/VB-1815.md) | A household's last load of sheaves cut on the road is posted again before the frost | - | 2 | S | the haul re-posted after its last carrier is cut |
| [VB-1836](backlog/VB-1836.md) | The owner cache left on another farmstead's tiles in the played populous seed 7 run | - | 2 | S | checkState fails at year 2 of populous small seed 7 with household 0's head played: farmsteads[61] owner cache 63, expected 62 (pre-existing at 79c22dd7) |
@@ -257,9 +257,8 @@ By arch, in the order of the Archs table, then priority and ID. Each waits for t
| [VB-828](backlog/VB-828.md) | Wrap-up: the round as offers, measured | acts | 3 | M | [VB-694](#VB-694), [VB-695](#VB-695), [VB-696](#VB-696), [VB-825](#VB-825), [VB-827](#VB-827) | long runs and the nightly band for marriages, service, land and settling by offers; the cost early and on a late save; `roundPairs` retired; who never got a yes |
| [VB-1556](backlog/VB-1556.md) | A member's voice: a duty asked of the head | plans | 2 | S | [VB-1771](#VB-1771) | A member asks its head for a type of work as its duty, an offer answered by the head; the played member's lever on the day |
| [VB-1765](backlog/VB-1765.md) | The page: the strip coloured by whose the hours are, and sovereignty on the pawn's card | plans | 2 | M | [VB-1764](#VB-1764) | One presentation for every plan of every body: the day strip, the agenda and the Plan tab's views drawn from Sim.strip at four zooms, each hour in the colour of whose it is (a breach hatched), the levy's line across each day to come, and the pawn's sovereignty on its card. |
-| [VB-1771](backlog/VB-1771.md) | Duties of the days ahead: one member sees to a type of recurring work without a window | plans | 2 | M | [VB-1770](#VB-1770) | A duty, given by the head at its review, puts its holder first for one type of recurring work without a window (the wood, the water, the beasts, the cooking) in each day's allotment and nothing more; work with a window is never a duty. In place of VB-1553's removed mechanism. |
| [VB-1772](backlog/VB-1772.md) | Dated steps: work from a day and by a day, taken up on its day, with further hands when its window will be missed | plans | 2 | M | [VB-1771](#VB-1771) | A step of the days ahead with from and by (reap the rye from day 5, by day 9) is taken up by the day's allotment on its day; one its hands cannot finish by its window's end is given further hands at the head's review; leave and an outer levy's named day are dated steps. |
-| [VB-1773](backlog/VB-1773.md) | Wrap-up: plans at four scales: the gate on long runs, the predictions measured, the tuning named | plans | 2 | M | [VB-1764](#VB-1764), [VB-1765](#VB-1765), [VB-1770](#VB-1770), [VB-1771](#VB-1771), [VB-1772](#VB-1772), [VB-1780](#VB-1780), [VB-1556](#VB-1556) | The arch checked as a whole: the gate over 10 and 30 years, the predictions Q1 to Q13 against what was built, cost on a late save against today's line plus 7 ms, bands added, and the parameters a tuning run of Kim's would move (LEVY first). |
+| [VB-1773](backlog/VB-1773.md) | Wrap-up: plans at four scales: the gate on long runs, the predictions measured, the tuning named | plans | 2 | M | [VB-1764](#VB-1764), [VB-1765](#VB-1765), [VB-1771](#VB-1771), [VB-1772](#VB-1772), [VB-1780](#VB-1780), [VB-1556](#VB-1556) | The arch checked as a whole: the gate over 10 and 30 years, the predictions Q1 to Q13 against what was built, cost on a late save against today's line plus 7 ms, bands added, and the parameters a tuning run of Kim's would move (LEVY first). |
| [VB-1780](backlog/VB-1780.md) | The page: outer levies, the alderman's year, and the doors of the ladder, the meeting and the duties on the strip | plans | 2 | M | [VB-1772](#VB-1772) | Steps 7 and 8 build verbs the player cannot yet reach: the strip shows outer levies in their windows with their terms, the alderman's year (levied, named, worked, lapsed, breached), and the doors for name, substitute, commute, breach, release and transfer, propose, a duty's assign and a dated step. |
| [VB-1803](backlog/VB-1803.md) | A lodger's harvest days: a member taken in owes an adult-day in summer and one in autumn | plans | 3 | S | [VB-1772](#VB-1772) | the lodger's two adult-days, waiting for a lodger to exist |
| [VB-1123](backlog/VB-1123.md) | Page: plan mode: the household's season planned on the map, in place of the Plan tab | - | 2 | L | [VB-1765](#VB-1765) | Plan mode replaces the Plan tab: a bar of the season a member with the actions on it, actions chosen from a tile's menu, problems marked where they are, and the outcome read on the needs (survival's thresholds, by the head's estimate); no target is stepped. Requirements, walks and Kim's decisions of 17 and 18 Nov; mocks A to L. |
diff --git a/BACKLOG_ARCHIVE.md b/BACKLOG_ARCHIVE.md
index 72ccca8e..c41d5d22 100644
--- a/BACKLOG_ARCHIVE.md
+++ b/BACKLOG_ARCHIVE.md
@@ -901,3 +901,4 @@ Done tasks and closed archs, moved out of `BACKLOG.md` so its tables list only o
| [VB-083](backlog/VB-083.md) | Seasons on the map | roads | 3 | M | Seasonal tints and winter snow on the painted map. |
| [VB-034](backlog/VB-034.md) | Splitting land between heirs | debt | 3 | M | Under "land split between heirs" the fields are divided, so the custom stops behaving like a buy-out. |
| [VB-1964](backlog/VB-1964.md) | The ice key: two swatches, words one tap in | roads | 1 | S | The ice key beside the calendar is two swatches; their words show one tap in (Kim's icons-first rule). |
+| [VB-1770](backlog/VB-1770.md) | A holder proposes a routine or a change of the custom of lots to the meeting | plans | 2 | S | The verb propose: any holder of the village puts a routine, or the custom of lots, on its meeting's agenda; the decision stays the meeting's by its procedure, and no controller has a ballot. |
diff --git a/backlog/VB-1770.md b/backlog/VB-1770.md
index fe765e24..6d39be99 100644
--- a/backlog/VB-1770.md
+++ b/backlog/VB-1770.md
@@ -1,5 +1,5 @@
# VB-1770: A holder proposes a routine or a change of the custom of lots to the meeting
-Status: ready
+Status: done (2026-11-28)
Priority: 2
Size: S
Arch: plans
@@ -8,12 +8,14 @@ Design ref: design.md section 15, The meeting decides, a holder proposes; sectio
Touches: sim/meetings; sim/routines (chooseRoutines, rankRoutines); sim/customs; tests/routines.js
Goal: A pawn acts on its village's work through the meeting, as every holder may, and the played holder has no more
Acceptance criteria:
-- [ ] The verb `propose` (a holder of the village; the check: a holder, the meeting not yet held this year, one proposal a holder a year) puts a routine or the lots practice on its village's next meeting's agenda; the meeting weighs it by its procedure (sim/decisions) beside the routines it ranks today; the record tells the proposal and its fate.
-- [ ] A holder's default author proposes by its own judgement (a routine it needs and lacks hands for; lots that weigh on its household) at its year's review, a decision point.
-- [ ] A test: a proposed routine is chosen when the meeting would weigh it highest and refused otherwise, for a played and an unplayed holder alike.
-- [ ] The gate (`docs/plans/four-scales/README.md`, 3.10), by one command: `npm run verify` green (a test that asserted the old behaviour updated on purpose, never skipped or quarantined, and named in the PR), and `node tools/gate.js --base ` passing (VB-1774): no settlement extinct by hunger or collapsed (VB-1774's bound), no more tasks held over 48 hours than the base, the stocks' `unexplained` no larger.
-- [ ] Reported in the PR from the same output, not gated: hungry household-days and deaths by hunger in the six runs, before and after, and the work counters (`node tests/counters.js`, `--update` with the entries listed); the result kept (`--out`) as the next task's base.
+- [x] The verb `propose` (a holder of the village; the check: a holder, the meeting not yet held this year, one proposal a holder a year) puts a routine or the lots practice on its village's next meeting's agenda; the meeting weighs it by its procedure (sim/decisions) beside the routines it ranks today; the record tells the proposal and its fate.
+- [x] A holder's default author proposes by its own judgement (a routine it needs and lacks hands for; lots that weigh on its household) at its year's review, a decision point.
+- [x] A test: a proposed routine is chosen when the meeting would weigh it highest and refused otherwise, for a played and an unplayed holder alike.
+- [x] The gate (`docs/plans/four-scales/README.md`, 3.10), by one command: `npm run verify` green (a test that asserted the old behaviour updated on purpose, never skipped or quarantined, and named in the PR), and `node tools/gate.js --base ` passing (VB-1774): no settlement extinct by hunger or collapsed (VB-1774's bound), no more tasks held over 48 hours than the base, the stocks' `unexplained` no larger.
+- [x] Reported in the PR from the same output, not gated: hungry household-days and deaths by hunger in the six runs, before and after, and the work counters (`node tests/counters.js`, `--update` with the entries listed); the result kept (`--out`) as the next task's base.
Notes:
- 27 Nov 2026, VB-1766: no criterion moved; "lots that weigh on its household" reads its lots under the custom against those under another (design.md, Outer levies, Lots).
- 25 Nov 2026: Path step 7. The head's match for a member is the verb `match` (VB-1744): `propose` is the meeting's.
- 25 Nov 2026, after the review of the arch's tasks: rewritten to its findings (the review's IDs and outcomes are in the arch's summary).
+- 28 Nov 2026, VB-1770: `propose` is in sim/meetings (agenda `plan.proposed`, one a holder a year, refused once the year's meeting is held). A routine goes to a vote kind `routine` (taken up where the village has the work, refused where it has none; holders' words add 1 each to its rank); lots go to a vote kind `lots` of the households, each for the rule giving its own lot (of a reference levy of 2 days a household) least, margin the practice's malleability. The village's custom is `plan.lotsRule`, read by `Customs.lotsRule` (levies' layLots), else its culture's practice. The default author proposes at the meeting's step, as the agenda closes (a routine not yet chosen where the farm has over 2 fields an adult, else lots lighter by a day).
+- Every available routine is already chosen today (4 routines, cap 4), so a routine proposal changes only the order; it matters once more routines exist. Counters: tests/counters.js has 1 out (route counters, not this task's); baseline not updated. Gate holds against docs/gate/base.json (hungry-days: populous 262>183, 219>119, 304>228; founders 42 0>6; no hunger deaths); result kept at the scratchpad, for the orchestrator.
diff --git a/backlog/VB-1771.md b/backlog/VB-1771.md
index 86e1103b..55e72e01 100644
--- a/backlog/VB-1771.md
+++ b/backlog/VB-1771.md
@@ -1,6 +1,5 @@
# VB-1771: Duties of the days ahead: one member sees to a type of recurring work without a window
-Status: blocked
-Waits for: VB-1770
+Status: ready
Priority: 2
Size: M
Arch: plans
diff --git a/backlog/VB-1773.md b/backlog/VB-1773.md
index 3121141e..a1e21714 100644
--- a/backlog/VB-1773.md
+++ b/backlog/VB-1773.md
@@ -1,6 +1,6 @@
# VB-1773: Wrap-up: plans at four scales: the gate on long runs, the predictions measured, the tuning named
Status: blocked
-Waits for: VB-1764, VB-1765, VB-1770, VB-1771, VB-1772, VB-1780, VB-1556
+Waits for: VB-1764, VB-1765, VB-1771, VB-1772, VB-1780, VB-1556
Priority: 2
Size: M
Arch: plans
diff --git a/backlog/VB-1807.md b/backlog/VB-1807.md
index a7df8f7f..c12ed107 100644
--- a/backlog/VB-1807.md
+++ b/backlog/VB-1807.md
@@ -36,6 +36,7 @@ Acceptance criteria:
- [ ] From VB-1768: section 9, Outer levies: Lots: A routine whose tasks are not yet posted at the season's first review is sized and laid at the first later review of the season that finds them, its window from that day to the season's end
- [ ] From VB-083: Climate and travel beyond walking: The map's look by band: autumn colours from 8 game days before the band's normal frost until snow lies; fresh green from the thaw to 10 game days after normal open water; ice that does not bear (frost to lakeBears, soundShut to soundBears, thaw to open) drawn slate, ice that bears near white, with a key.
- [ ] From VB-034: Inheritance, Handover and shares (Splitting land): An heir given split fields who dies before its house is built: its title ends and the fields go back to the farm they came from. Only grown siblings in the farm's village with no farm or plot of their own want land; a child takes its share in goods.
+- [ ] From VB-1770: section 9, Outer levies: Lots: a village meeting may change its own custom of lots (plan.lotsRule) by a vote of its households, each for the rule giving it the lightest lot of a reference levy, margin 0.4
A line a finding, added by `node tools/backlog.js collect design` (tools/lib/collect.js): findings of a kind are collected, not given a task each.
diff --git a/src/sim/customs.js b/src/sim/customs.js
index adadc981..91f1f0ab 100644
--- a/src/sim/customs.js
+++ b/src/sim/customs.js
@@ -339,6 +339,13 @@ VB['sim/customs'] = (() => {
// The culture's practice of key k: its own, or the one every culture starts with (a save made before VB-257).
const practiceOf = (c, k) => (c && c.practices && c.practices[k] !== undefined ? c.practices[k] : PRACTICES[k].base);
+ // A village's custom of lots (VB-1770): the option its meeting chose (plan.lotsRule), else its culture's practice.
+ function lotsRule(st, vid) {
+ const plan = st.plans && st.plans.villages.get(vid),
+ s = st.cenv && st.cenv.settlements[vid];
+ return plan && plan.lotsRule ? plan.lotsRule : practiceOf(s && st.cenv.cultures[s.culture], 'lots');
+ }
+
// ---- the door: the option of a custom in force ----
// `at` is a settlement id (a village id). With no culture seeded, no such settlement, or a practice array
// shorter than the catalogue (a save made before the custom was added), the option is the one of the archetype every
@@ -396,6 +403,7 @@ VB['sim/customs'] = (() => {
ARCHETYPES,
PRACTICES,
practiceOf,
+ lotsRule,
fromArchetype,
inForce,
inForceAt,
diff --git a/src/sim/levies.js b/src/sim/levies.js
index 9df393f6..18120782 100644
--- a/src/sim/levies.js
+++ b/src/sim/levies.js
@@ -7,7 +7,8 @@ VB['sim/levies'] = (() => {
const { cal, DAY, WORK, AGES, TICKS } = VB['sim/rules'],
{ CHILD, MATCH } = VB['sim/roles'];
const { age, spouseOf, villageOf } = VB['sim/records'];
- const { levyNorm, practiceOf } = VB['sim/customs'];
+ const Customs = VB['sim/customs'],
+ { levyNorm } = Customs;
const Routines = VB['sim/routines'],
Steps = VB['sim/steps'];
const { planOf } = VB['sim/plans'];
@@ -1509,7 +1510,7 @@ VB['sim/levies'] = (() => {
at = Math.floor(window[0] / SEASON_DAYS),
had = hadIn(plan, at),
s = st.cenv && st.cenv.settlements[v.id],
- rule = practiceOf(s && st.cenv.cultures[s.culture], 'lots'),
+ rule = Customs.lotsRule(st, v.id), // the village's custom: its meeting's choice, else its culture's (VB-1770)
[lots, rest] = split(st, v.id, D, rule, (id) => OUTER.lotMax - (had[id] || 0)),
step = Routines.stepOf(plan, k),
why = step ? { step: step.id, of: `village:${v.id}` } : null;
@@ -1618,6 +1619,7 @@ VB['sim/levies'] = (() => {
leviesOf,
lotsOf,
split,
+ split,
costOf,
keepDay,
unnamed,
diff --git a/src/sim/meetings.js b/src/sim/meetings.js
index 64aea1fa..f89f1338 100644
--- a/src/sim/meetings.js
+++ b/src/sim/meetings.js
@@ -11,9 +11,10 @@ VB['sim/meetings'] = (() => {
const { opinionOf } = VB['sim/relations'];
const { setAlderman } = VB['sim/membership'];
const { chooseRoutines, VILLAGE_ROUTINES } = VB['sim/routines'];
+ const { living, villageOf } = VB['sim/records'];
const { refreshRoles } = VB['sim/heirs'];
const { updateTie, refreshStanding, refreshInterests, hooks } = VB['sim/society'];
- const { issue } = VB['sim/commands'];
+ const { issue, register } = VB['sim/commands'];
const { defineKind, setPresider, ask } = VB['sim/decisions'];
const { VILLAGE_STEPS } = VB['sim/occasions'];
const { chooseGathering, settleGatherings } = VB['sim/gathering'];
@@ -236,6 +237,7 @@ VB['sim/meetings'] = (() => {
const held = st.occasions.find(
(o) => o.kind === 'meeting' && o.village === s.id && o.start <= st.t && st.t < o.end,
);
+ holdersPropose(st, s); // the year's review, at the agenda's closing (VB-1770)
const txt = routinesMeeting(st, s, held, people);
if (txt) out.push({ year: c.year, text: txt });
if (people.length) chooseGathering(st, s, quorumAt(st, s, held, people), people); // VB-294: its choice of gathering
@@ -335,11 +337,180 @@ VB['sim/meetings'] = (() => {
village: v.id,
});
}
+ // ---- a holder proposes (VB-1770; design.md section 15, The meeting decides, a holder proposes) ----
+ // @state plan.proposed (a village's): [{by (a holder's pawn), year, what: 'routine' | 'lots', value (a routine's key, or a custom of lots's
+ // option)}], the agenda of the next meeting, one a holder a year; written by the verb `propose` and cleared by the meeting, which tells
+ // each and its fate in the record. plan.lotsRule: the village's custom of lots once its meeting has changed it (sim/customs lotsRule).
+ // The meeting weighs a proposal by its procedure (sim/decisions): a routine is taken up where the village has the work (the need and
+ // the work left over, and the holders' words), refused where it has none; the custom of lots by a vote of the households, each for the
+ // rule under which its own lot of a reference levy is least (the one in force on a tie). The proposal puts the question; no pawn has a ballot.
+ defineKind('routine', {
+ procedure: 'vote',
+ evaluate: (st, q) => ({ support: q.support, need: [0, 0] }),
+ fallback: (st, q) => q.current,
+ });
+ defineKind('lots', {
+ procedure: 'vote',
+ evaluate: (st, q) => ({ support: q.support, need: q.support.map(() => Customs.PRACTICES.lots.malleability) }),
+ fallback: (st, q) => q.current,
+ });
+ const LOTS = Customs.PRACTICES.lots.opts.map((o) => o[0]);
+ const holdersOf = (st, vid) => {
+ const out = [];
+ for (const fid of st.villages[vid].farmsteads) {
+ const hh = st.farmsteads[fid].household === null ? null : st.households[st.farmsteads[fid].household];
+ if (hh && !hh.dissolved && hh.holder !== null && st.pawns[hh.holder].died === null) out.push(hh);
+ }
+ return out;
+ };
+ // Has village v's meeting of this year been held: its routines set since the founders'.
+ const heldThisYear = (st, plan) => plan.routinesBy !== 'founded' && plan.routinesYear === cal(st.t).year;
+ // propose(village, {what: 'routine', routine} | {what: 'lots', rule}): a holder of the village puts it on the next meeting's agenda.
+ register('propose', {
+ check: (st, c) => {
+ const vid = c.target,
+ plan = Number.isInteger(vid) ? st.plans.villages.get(vid) : undefined,
+ a = c.args || {};
+ if (!plan) return `village ${vid} has no plan`;
+ if (living(st, c.actor)) return living(st, c.actor);
+ const p = st.pawns[c.actor];
+ if (!isHolder(st, c.actor) || p.household === null || villageOf(st, p) !== vid)
+ return `pawn ${c.actor} is not a holder of village ${vid}`;
+ if (heldThisYear(st, plan)) return `the meeting of ${st.villages[vid].name} has been held this year`;
+ const y = cal(st.t).year;
+ if ((plan.proposed || []).some((x) => x.by === c.actor && x.year === y)) return 'a holder proposes once a year';
+ if (a.what === 'routine')
+ return Object.hasOwn(VILLAGE_ROUTINES, a.routine) ? null : `there is no routine ${a.routine}`;
+ if (a.what === 'lots') return LOTS.includes(a.rule) ? null : `there is no custom of lots ${a.rule}`;
+ return 'a holder proposes a routine or the lots';
+ },
+ run: (st, c) => {
+ const plan = st.plans.villages.get(c.target),
+ a = c.args;
+ (plan.proposed = plan.proposed || []).push({
+ by: c.actor,
+ year: cal(st.t).year,
+ what: a.what,
+ value: a.what === 'routine' ? a.routine : a.rule,
+ });
+ },
+ });
+ // The lots each household of village vid would bear of a reference levy under each custom, [Map household id -> lot] by option.
+ function lotsUnder(st, vid) {
+ const D = Math.max(1, holdersOf(st, vid).length * 2),
+ split = VB['sim/levies'].split;
+ return LOTS.map((rule) => new Map(split(st, vid, D, rule)[0]));
+ }
+ // The default author of each holder's year's review (a decision point, sim/points; its deadline the agenda's closing, as the meeting
+ // begins): one proposal a holder who has made none, by its own judgement: a routine it needs and lacks hands for (the village's work not
+ // yet its routine, a farm with more than two fields to each adult), else the custom of lots under which its lot is lighter by a day.
+ function holdersPropose(st, s) {
+ const v = st.villages[s.id],
+ plan = st.plans.villages.get(s.id),
+ y = cal(st.t).year;
+ if (!plan || heldThisYear(st, plan)) return;
+ let lots = null;
+ for (const hh of holdersOf(st, s.id)) {
+ if ((plan.proposed || []).some((x) => x.by === hh.holder && x.year === y)) continue;
+ const adults = hh.members.filter((id) => st.pawns[id].died === null && st.pawns[id].age >= 18).length,
+ fields = hh.farmstead === null ? 0 : st.farmsteads[hh.farmstead].fields.length;
+ let best = null;
+ if (fields > 2 * adults)
+ for (const k of Object.keys(VILLAGE_ROUTINES)) {
+ const R = VILLAGE_ROUTINES[k];
+ if (plan.routines.includes(k) || !R.available(st, v)) continue;
+ const n = R.need(st, v);
+ if (n > 0 && (best === null || n > best[0])) best = [n, k];
+ }
+ const cmd = { actor: hh.holder, verb: 'propose', target: s.id, source: 'pawn' };
+ if (best) {
+ issue(st, { ...cmd, args: { what: 'routine', routine: best[1] } });
+ continue;
+ }
+ lots = lots || lotsUnder(st, s.id);
+ const now = LOTS.indexOf(Customs.lotsRule(st, s.id)),
+ own = (j) => lots[j].get(hh.id) || 0;
+ let j = now;
+ for (let i = 0; i < LOTS.length; i++) if (own(i) < own(j)) j = i;
+ if (j !== now && own(now) - own(j) >= 1) issue(st, { ...cmd, args: { what: 'lots', rule: LOTS[j] } });
+ }
+ }
+ // The agenda's proposals of this year weighed at the meeting of village s (`decides`: it has a quorum), each told in the record with its
+ // fate; returns {routine: holders who proposed it} of those taken up, for the choice's weighing. The agenda is cleared.
+ function weighProposals(st, s, decides) {
+ const v = st.villages[s.id],
+ plan = st.plans.villages.get(s.id),
+ y = cal(st.t).year,
+ list = (plan.proposed || []).filter((x) => x.year === y),
+ taken = {},
+ said = (x, fate) =>
+ log(
+ st,
+ `${fullName(st.pawns[x.by])} proposed to the ${s.name} meeting ${
+ x.what === 'routine'
+ ? VILLAGE_ROUTINES[x.value].label.toLowerCase()
+ : `that levy lots be split: ${Customs.PRACTICES.lots.opts[LOTS.indexOf(x.value)][1].toLowerCase()}`
+ }; ${fate}.`,
+ { kind: 'proposal', village: s.id, pawn: x.by, what: x.what, value: x.value },
+ );
+ plan.proposed = [];
+ for (const x of list) {
+ if (!decides) {
+ said(x, 'the meeting did not decide');
+ continue;
+ }
+ if (x.what !== 'routine') continue;
+ const R = VILLAGE_ROUTINES[x.value],
+ n = list.filter((z) => z.what === 'routine' && z.value === x.value).length,
+ avail = R.available(st, v),
+ left =
+ plan.routineLeft && plan.routineLeft.by === plan.routinesBy + plan.routinesYear ? plan.routineLeft.days : {},
+ w = avail ? R.need(st, v) + (left[x.value] || 0) + n : 0,
+ take = ask(st, { kind: 'routine', body: s.id, current: 0, options: 2, support: [avail ? 0 : n, w] });
+ if (take === 1) taken[x.value] = n;
+ said(x, take === 1 ? 'the meeting took it up' : 'the meeting refused it: the village has no such work');
+ }
+ const lotsList = list.filter((x) => x.what === 'lots');
+ if (decides && lotsList.length) {
+ const lots = lotsUnder(st, s.id),
+ now = LOTS.indexOf(Customs.lotsRule(st, s.id)),
+ support = LOTS.map(() => 0);
+ for (const hh of holdersOf(st, s.id)) {
+ let j = now;
+ for (let i = 0; i < LOTS.length; i++) if ((lots[i].get(hh.id) || 0) < (lots[j].get(hh.id) || 0)) j = i;
+ support[j]++;
+ }
+ // the question is put once for each rule proposed, the best supported first
+ const rules = [...new Set(lotsList.map((x) => LOTS.indexOf(x.value)))].sort(
+ (a, b) => support[b] - support[a] || a - b,
+ );
+ let chosen = now;
+ for (const j of rules) {
+ const sup = support.map((n, i) => (i === now || i === j ? n : 0));
+ if (ask(st, { kind: 'lots', body: s.id, current: now, options: LOTS.length, support: sup }) === j) {
+ chosen = j;
+ break;
+ }
+ }
+ for (const x of lotsList)
+ said(x, LOTS.indexOf(x.value) === chosen ? 'the meeting adopted it' : 'the meeting kept the custom of lots');
+ if (chosen !== now) {
+ plan.lotsRule = LOTS[chosen];
+ log(
+ st,
+ `At the ${s.name} meeting: levy lots are now split “${Customs.PRACTICES.lots.opts[chosen][1].toLowerCase()}”.`,
+ { kind: 'custom', village: s.id },
+ );
+ }
+ }
+ return taken;
+ }
function routinesMeeting(st, s, o, people = membersOf(st, s.id)) {
const v = st.villages[s.id];
if (!v || !people.length) return null;
const { voices, came, quorum } = attendance(st, s, o, people),
- list = quorum ? chooseRoutines(st, v) : null;
+ taken = weighProposals(st, s, quorum),
+ list = quorum ? chooseRoutines(st, v, false, taken) : null;
neglected(st, v); // the work the routines left undone, heard before the choice (VB-1768)
if (list) {
issue(st, {
diff --git a/src/sim/records.js b/src/sim/records.js
index 7eaf0243..217327f8 100644
--- a/src/sim/records.js
+++ b/src/sim/records.js
@@ -128,6 +128,7 @@ VB['sim/records'] = (() => {
helped: SHORT, // helped another household of the village with its work (VB-106)
workday: SHORT, // a village's work day: who turned out and who stayed away (VB-120)
workLeft: SHORT, // a village's routine work left undone at its seasons' ends, heard at its meeting (VB-1768)
+ proposal: SHORT, // a holder's proposal to its village's meeting and its fate (VB-1770)
levyBreached: SHORT, // a household's levied day not worked, booked as goodwill its head owes (sim/levies, VB-1768)
courting: GENERATION, // a courtship begun, and ended unmarried (sim/courting, VB-036)
courtingEnded: GENERATION,
diff --git a/src/sim/routines.js b/src/sim/routines.js
index 683b7e4b..e5e1c879 100644
--- a/src/sim/routines.js
+++ b/src/sim/routines.js
@@ -83,7 +83,9 @@ VB['sim/routines'] = (() => {
// meeting sets (`meeting`).
// A meeting weighs besides the work a routine left undone at its windows' ends since the routines were set (plan.routineLeft, sim/levies,
// in days, VB-1768).
- function chooseRoutines(st, v, founders = false) {
+ // `proposed` ({routine: holders who proposed it}, VB-1770): what the meeting took up of the holders' proposals weighs that much more, each
+ // holder's word being one.
+ function chooseRoutines(st, v, founders = false, proposed = null) {
const cands = [],
plan = st.plans.villages.get(v.id),
R = plan && plan.routineLeft,
@@ -91,7 +93,7 @@ VB['sim/routines'] = (() => {
for (const k of Object.keys(VILLAGE_ROUTINES)) {
const R = VILLAGE_ROUTINES[k];
if (!(founders && R.meeting) && R.available(st, v))
- cands.push([R.need(st, v) + (founders ? 0 : left[k] || 0), k]);
+ cands.push([R.need(st, v) + (founders ? 0 : left[k] || 0) + (proposed && proposed[k] ? proposed[k] : 0), k]);
}
return rankRoutines(cands);
}
diff --git a/tests/lib/invariants.js b/tests/lib/invariants.js
index 93ed6359..5e1de15c 100644
--- a/tests/lib/invariants.js
+++ b/tests/lib/invariants.js
@@ -621,6 +621,22 @@ function checkState(st) {
for (const [h, n] of Object.entries(by))
if (!Number.isInteger(n) || n < 1 || n > lotMax)
bad.push(`plans: village ${id} season ${s}: household ${h} has ${n} days of lots`);
+ // VB-1770: the agenda: a holder's proposal, one a year, of a known routine or custom of lots; the village's own custom of lots
+ const seen = new Set(),
+ LOTS = VB['sim/customs'].PRACTICES.lots.opts.map((o) => o[0]);
+ for (const x of plan.proposed || []) {
+ const key = `${x.by}:${x.year}`;
+ if (
+ seen.has(key) ||
+ !Number.isInteger(x.by) ||
+ !Number.isInteger(x.year) ||
+ !(x.what === 'routine' ? Object.hasOwn(VB['sim/routines'].VILLAGE_ROUTINES, x.value) : x.what === 'lots' && LOTS.includes(x.value))
+ )
+ bad.push(`plans: village ${id} has a proposal ${JSON.stringify(x)}`);
+ seen.add(key);
+ }
+ if (plan.lotsRule !== undefined && !LOTS.includes(plan.lotsRule))
+ bad.push(`plans: village ${id} has the custom of lots ${plan.lotsRule}`);
for (const [k, n] of Object.entries((plan.routineLeft && plan.routineLeft.days) || {}))
if (!VB['sim/routines'].VILLAGE_ROUTINES[k] || !Number.isInteger(n) || n < 0)
bad.push(`plans: village ${id} left ${n} days of ${k}`);
diff --git a/tests/routines.js b/tests/routines.js
index ba228ed3..37d40cf9 100644
--- a/tests/routines.js
+++ b/tests/routines.js
@@ -199,4 +199,44 @@ function green(st, v, ids) {
}
assert.deepStrictEqual(checkState(st).filter((x) => /plans|obligation|levy/.test(x)), [], 'invariants');
}
+{ // a holder proposes (VB-1770): to the next meeting's agenda, once a year; the meeting weighs it; played and unplayed alike
+ const { st, v, s, plan, voices } = setUp();
+ const holders = st.households.filter((h) => !h.dissolved && h.holder !== null && villageOf(st, st.pawns[h.holder]) === v.id).map((h) => h.holder);
+ assert.ok(holders.length >= 2, 'holders to propose');
+ const [played, other] = holders, propose = (actor, args, source) => issue(st, { actor, verb: 'propose', target: v.id, args, source });
+ assert.ok(/not a holder/.test(propose(Sim.membersOf(st, v.id).find((p) => !holders.includes(p.id) && p.household !== null).id, { what: 'routine', routine: 'fence' }, 'pawn')), 'only a holder');
+ assert.ok(/no routine/.test(propose(played, { what: 'routine', routine: 'gaol' }, 'pawn')), 'a known routine');
+ assert.strictEqual(propose(played, { what: 'routine', routine: 'workdays' }, 'player'), true, 'the played holder proposes');
+ assert.ok(/once a year/.test(propose(played, { what: 'routine', routine: 'commons' }, 'player')), 'one a year');
+ assert.strictEqual(propose(other, { what: 'routine', routine: 'green' }, 'pawn'), true, 'an unplayed holder proposes');
+ assert.deepStrictEqual(plan.proposed.map((x) => [x.by, x.value]), [[played, 'workdays'], [other, 'green']]);
+ assert.deepStrictEqual(checkState(st).filter((x) => /plans/.test(x)), [], 'invariants');
+ const Rt = VB['sim/routines'];
+ assert.ok(Rt.VILLAGE_ROUTINES.workdays.available(st, v), 'work days have work');
+ assert.ok(!Rt.VILLAGE_ROUTINES.green.available(st, v), 'the green has none (a well is dug)' );
+ plan.routines = []; // lint-allow: owner the test starts from a year without village work
+ L.routinesMeeting(st, s, green(st, v, voices.map((p) => p.id)));
+ const fates = st.record.filter((e) => typeof e === 'object' && e.kind === 'proposal');
+ assert.strictEqual(fates.length, 2, 'the record tells each proposal');
+ assert.ok(plan.routines.includes('workdays') && /took it up/.test(fates.find((e) => /work days/.test(e.text)).text), 'weighed highest: chosen');
+ assert.ok(!plan.routines.includes('green') && /refused/.test(fates.find((e) => /green/.test(e.text)).text), 'no such work: refused');
+ assert.deepStrictEqual(plan.proposed, [], 'the agenda cleared');
+ assert.ok(/held this year/.test(propose(other, { what: 'routine', routine: 'fence' }, 'pawn')), 'not once the meeting is held');
+ // a proposal weighs its routine up in the ranking
+ const base = Rt.chooseRoutines(st, v), last = base[base.length - 1];
+ assert.strictEqual(Rt.chooseRoutines(st, v, false, { [last]: 1000 })[0], last, 'the holders\' words weigh');
+ // the custom of lots: put to the households, each for the rule that lightens its own lot
+ const st2 = setUp(); st2.plan.routines = []; // lint-allow: owner the test starts from a year without village work
+ const vid = st2.v.id, hs = st2.st.households.filter((h) => !h.dissolved && h.holder !== null && villageOf(st2.st, st2.st.pawns[h.holder]) === vid);
+ assert.strictEqual(issue(st2.st, { actor: hs[0].holder, verb: 'propose', target: vid, args: { what: 'lots', rule: 'equal' }, source: 'pawn' }), true);
+ L.routinesMeeting(st2.st, st2.s, green(st2.st, st2.v, st2.voices.map((p) => p.id)));
+ const said = st2.st.record.find((e) => typeof e === 'object' && e.kind === 'proposal');
+ assert.ok(said && /the meeting (adopted it|kept the custom of lots)/.test(said.text), said && said.text);
+ assert.strictEqual(Customs.lotsRule(st2.st, vid), /adopted/.test(said.text) ? 'equal' : Customs.practiceOf(st2.st.cenv.cultures[st2.s.culture], 'lots'));
+ // the default author: at the meeting, a holder with no proposal makes one by its own judgement
+ const st3 = setUp(), P3 = st3.plan;
+ L.meetingStage(st3.st, 0); L.holdMeetings(st3.st);
+ for (const e of st3.st.record.filter((x) => typeof x === 'object' && x.kind === 'proposal')) assert.ok(e.pawn !== undefined, 'a proposal is told in the record');
+ assert.deepStrictEqual(checkState(st3.st).filter((x) => /plans/.test(x)), [], 'invariants after the meetings');
+}
console.log('routines ok: founded, chosen by the meeting, posted on the villager basis; no quorum with nothing and asLastYear; ties; the verb\'s refusals; the routines\' lots laid, released and their work left told');