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

The Years

Wrap the single turn in a ten-year loop where population grows and every choice compounds — the simulation that makes one decision matter five years later.

67% of Yearfall

One year proves nothing — a good harvest can carry a bad decision. The test is ten years in a row, each starting from what the last one left behind. Wrapping the turn in a loop is what turns Yearfall from a sum into a simulation, and it is the second new idea of the game.

  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
 280 INPUT "Acres to plant: "; plant
 290 IF plant < 0 OR plant > land THEN GO TO 280
 300 IF plant > grain - feed THEN GO TO 280
 310 IF plant > pop * 10 THEN GO TO 280
 400 LET grain = grain - feed - plant
 410 LET starved = 0
 420 IF feed < pop * 20 THEN LET starved = pop - INT (feed / 20)
 430 LET pop = pop - starved
 440 LET yield = INT (RND * 5) + 1
 450 LET harvested = plant * yield
 460 LET grain = grain + harvested
 470 LET births = 0
 480 IF starved = 0 THEN LET births = INT (RND * 6) + 1
 490 LET pop = pop + births
 500 IF pop <= 0 THEN PRINT AT 14, 2; "Everyone perished!": STOP
 600 PRINT AT 8, 2; "Starved: "; starved
 610 PRINT AT 9, 2; "Harvest: "; harvested; " ("; yield; "/acre)"
 620 PRINT AT 10, 2; "Births: "; births
 630 PRINT AT 11, 2; "Population: "; pop; "  Grain: "; grain
 750 PRINT AT 14, 2; "Press any key..."
 760 PAUSE 0
 770 LET yr = yr + 1
 780 IF yr > 10 THEN PRINT AT 16, 2; "10 years complete! Pop: "; pop: STOP
 790 GO TO 130

9000 PRINT AT y, (32 - LEN a$) / 2; BRIGHT 1; a$
9010 RETURN
Yearfall year results: 'Starved: 0', 'Harvest', 'Births', the new population and grain, and a 'Press any key...' prompt
Each year resolves and pauses before the next — population grows when no one starves.

A counted loop with a way out

Lines 770–790 run the years: bump yr, stop once yr > 10, otherwise GO TO 130 back to the top for a fresh turn. This is a manual counter with GO TO, not a FOR/NEXT loop, and the reason is control — line 500 can end the game the instant the population hits zero, which a FOR loop could not do cleanly. The state variables are never reset inside the loop, so each year genuinely begins where the last ended. That persistence is the engine of compounding: underfeed in year three and the smaller population plants fewer acres in year four, which shrinks the harvest in year five.

A growing population

Lines 470–490 add births: if nobody starved this year, births = INT(RND * 6) + 1 newcomers arrive and join pop. A well-run year is rewarded with more people — and more people means both more mouths to feed and more hands to plant, so growth raises the stakes in both directions. With population now rising and falling on your choices, the loop closes: every year you read the state, spend it, take the harvest, and hand the result to the next year. The pause at line 760 lets you take in each outcome before the next begins.

Next: a third lever — buying and selling land.