Skip to content
Game 15 Unit 2 of 6 1 hr learning time

Feeding

Spend grain to feed your people — the first allocation under a constraint, and the starvation that follows underfeeding.

33% of Yearfall

The kingdom is on screen; now you spend from it. The first decision is food — each person needs 20 grain a year — and it introduces the game's core mechanic: allocation under a constraint. You choose how much grain to feed, you cannot feed more than you have, and underfeeding kills people.

  10 BORDER 0: PAPER 0: INK 7: CLS
 100 RANDOMIZE
 110 LET pop = 100: LET grain = 2800
 120 LET land = 1000: LET yr = 1
 130 CLS
 140 LET a$ = "*** YEARFALL ***": LET y = 0: GO SUB 9000
 150 PRINT AT 1, 4; "Year "; yr; " of 10"
 160 PRINT AT 3, 2; "Population: "; pop
 180 PRINT AT 4, 2; "Grain: "; grain
 190 PRINT AT 5, 2; "Land: "; land; " acres"
 260 INPUT "Grain to feed: "; feed
 270 IF feed < 0 OR feed > grain THEN GO TO 260
 400 LET grain = grain - feed
 410 LET starved = 0
 420 IF feed < pop * 20 THEN LET starved = pop - INT (feed / 20)
 430 LET pop = pop - starved
 600 PRINT AT 8, 2; "Starved: "; starved
 610 PRINT AT 9, 2; "Population: "; pop
 620 PRINT AT 10, 2; "Grain left: "; grain
 630 STOP

9000 PRINT AT y, (32 - LEN a$) / 2; BRIGHT 1; a$
9010 RETURN
Year-1 result after feeding 1500 grain: 'Starved: 25', 'Population: 75', 'Grain left: 1300'
Feed 1500 grain to 100 people and 25 starve — each 20 grain keeps one person alive.

Spend only what you have

Line 260 asks how much grain to feed, and line 270 is the constraint: IF feed < 0 OR feed > grain THEN GO TO 260 — you cannot feed a negative amount, and you cannot feed grain you do not have. This validate-and-retry guard is the one you used for menu choices and coordinates, now policing a budget. It enforces solvency, not wisdom: feeding 0 is perfectly legal, and starves everyone. The game lets you make the bad choice and then shows you the result.

The consequence

Lines 400–430 resolve it. Line 400 deducts the grain. Then starved = pop - INT(feed / 20) (line 420): each 20 grain keeps one person alive, and everyone you could not cover dies. The integer divide is deliberately harsh — 19 grain feeds nobody — so you can read exact survival straight off the numbers. Feed 1500 to 100 people and INT(1500/20) = 75 live, 25 starve. The cost of underfeeding is not a warning; it is people gone from the population you carry into next year.

Next: the other way to spend grain — planting it, and hoping for a harvest.