Status: done (2026-11-10)
Priority: 2
Size: S
Arch: life
Phase: implement
Design ref: Exchange, goodwill and obligations (The gift: The player’s gift, Decided 3 Nov and Agreed 8 Nov); The player and what they see (What the player sees); docs/architecture/target-v2.md, section 4.7 (offers in Exchange, the player’s fourth door); VB-182’s plan.
Goal: The player’s fourth door: while it plays a holder, the pawn panel lets it give grain to any household, by the verb give with source player, as any pawn’s gift goes. Its pawn’s allowance does not bind it; below the floor it is warned, by name, who goes hungry.
Acceptance criteria:
give (VB-216), source player, and settles as any gift: through sim/stores, with the gift’s events, booked as goodwill to the giver’s credit when both households have a holder (VB-217).sim/hunger without writing; the player confirms or cancels.tests/exchange.js): a give of source player passes the floor and the allowance and settles; the names in the warning match the feed order’s last group.npm run verify passes; index.html rebuilt. (The screenshot is docs/img/vb-221-give-warning.png; the golden file changed in apiKeys / Sim only; npm run verify as a whole is left to the PR’s Checks: Kim, 10 Nov, the code first.)
Notes:sim/exchange’s
assessGift already lets source player pass the floor and the allowance, and the verb give takes any household as its target, so
the simulation side needs only the test; the warning and the panel are this task’s. As built, a gift to a household without a holder
books nothing (The gift, Who books), so the panel should say so rather than show a balance that will not appear.design.md (The player and what they see) still
describes the pawn panel.Implementation (10 Nov 2026).
sim/hunger’s feedGroups(st, hh, mem) is the feed order that feedHousehold had inline (one rule, two readers), and
servedLast(st, hh) the last group with anyone in it. sim/exchange’s giftWarning(st, from, n) gives null, or {below, days,
hungry}: rations under the floor after the gift, the floor’s days, and servedLast. It reads only. Sim exports giftWarning and
kinHouseholds. No state field, no verb and no rule changed: assessGift already let source player pass.#actionSheet, bottom bar’s Actions, shown while a living pawn is played; src/page/play.js, renderActions):
the played pawn’s top part, the gift’s box, then what it may do and the wishes. It is rebuilt only while open. A pawn’s card keeps
one line (#cardPlay): “You play this pawn” with a button to its actions, or after the played pawn’s death “Go on as”. Taking the
new game’s offer, going on as a successor and loading a save with a played pawn open the sheet. Debug has “Play as them” and “Stop
playing” for the selected person.kinHouseholds), then the rest of its village, or “Choose on the map”: the next click takes the
household of a pawn, of a farm’s name, of a farm’s house or of land a household owns (Sim.ownerOf). Whole rations from 1 to the
grain above the seed reserve. Give asks Sim.giftWarning; with a warning the player confirms or cancels; then Sim.queue with the
verb give. A household without a holder is said to be owed no goodwill. The box is its own element, not redrawn while the player
types in it.Not built: who else than the holder may give for a household (the kind’s rule; today the holder only). The warning names the whole household where the feed order is “equal”, as the rule says: everyone is served last together.
Numbers: no behaviour of the simulation changes for a run without a player’s gift (node tests/golden.js: the state hashes match;
the one changed entry is apiKeys / Sim, for the two new exports).
Validation (10 Nov 2026): npm test (86 scripts), node tests/golden.js, and tests/smoke.js, tests/browser.js and
tests/browser-mobile.js run one by one pass; the two browser tests now play and stop through the Debug panel and find the played
pawn’s buttons in the Actions sheet. tests/exchange.js has the simulation side: no warning down to the floor; 20 rations below it,
the warning’s names are the feed order’s last group; asking writes nothing; the player’s gift below the floor settles. By hand, once,
in real Chromium on populous tiny seed 7 (a script not kept): a gift of 5 is queued and settles, the receiver 5 richer; the draft
survives the card’s refresh; giving all above the seed shows the warning, Cancel queues nothing and “Give all the same” gives it; a
household of another village picked on the map is listed under “Chosen on the map”; no console errors. Not checked: the sheet on a
phone beyond the mobile test’s fit and switch, and a gift to a household without a holder.