Skip to content

Share the grain

Make food and planting compete for the same stock.

  • Sinclair ZX Spectrum
  • BASIC

One acre needs one grain for seed. Food and seed come from the same store, so checking each against the original stock separately would allow us to spend the same grain twice.

Replace line 2020.

Add lines 240, 2060, 2070, 2160, 2200.

yearfall.bas
  10 BORDER 0: PAPER 0: INK 7: CLS
 200 LET pop=60: LET grain=360: LET land=100: LET yr=1: LET lost=0
 220 LET feed=180
 240 LET plant=100
 270 GO SUB 2000
 280 STOP
2000 LET fed=INT (feed/3)
2010 IF fed>pop THEN LET fed=pop
2020 LET left=grain-feed-plant
2030 LET ok=1: LET m$="All fed. Ready for harvest."
2040 IF fed<pop THEN LET m$=STR$ (pop-fed)+" people will starve."
2045 IF feed>3*pop THEN LET m$="Extra food gives no bonus."
2050 IF left<0 THEN LET ok=0: LET m$="Grain short by "+STR$ (-left)
2060 IF plant>2*fed THEN LET ok=0: LET m$="Too few fed workers."
2070 IF plant>land THEN LET ok=0: LET m$="Planting exceeds your land."
2090 CLS
2100 PRINT AT 0,1; INK 6; BRIGHT 1;"YEARFALL";AT 0,20;"YEAR ";yr
2110 PRINT AT 2,1; INK 5;"PEOPLE ";pop;AT 2,17;"LAND ";land
2120 PRINT AT 3,1; INK 5;"GRAIN  ";grain
2130 PRINT AT 5,1; INK 4;"PLAN";AT 5,17;"AMOUNT";AT 5,25;"COST"
2150 PRINT AT 8,1;"F  Feed grain";AT 8,17;feed;AT 8,25;feed
2160 PRINT AT 9,1;"P  Plant acres";AT 9,17;plant;AT 9,25;plant
2170 PRINT AT 11,1; INK 6;"Grain left: ";left
2180 PRINT AT 12,1;"Food needed: ";3*pop
2200 PRINT AT 14,1;"Fed workers can plant: ";2*fed
2210 PRINT AT 16,1; INK 6;m$
2250 RETURN

RUN the program. The proposed food costs 180 and the proposed 100 planted acres cost another 100. The balance should now be 80. This is still an inspectable plan with a deliberate STOP; no harvest or population change happens yet.

Three limits on planting

The balance is now grain-feed-plant. Planting must also fit the owned land and the available workforce. Each fed person can work two acres, so the labour limit is 2*fed.

Use fed rather than pop here. With food for forty people, only eighty acres can be worked. Allowing all sixty opening residents to supply labour and then removing twenty through starvation would make the year’s explanation inconsistent.

The land and labour checks are separate IF statements. They can fail for different reasons, even when grain remains. A screen with one warning is not a list of every problem: after repairing the displayed problem, another may become visible. ok remains zero if any check rejects the plan.

With 60 people, 100 acres and 360 grain, can you feed 120 and plant 100?

Show the explanation

The grain budget fits: 360−120−100 leaves 140. But only forty people receive complete rations, giving capacity for eighty acres. The plan fails its worker check.

Try that by changing feed in line 220 to 120. Restore it, then change plant in line 240 to 101. There are enough fed workers for 101 acres, but only 100 acres of land. Restore plant to 100 before continuing.

These rules define this game’s economy. They are not agricultural measurements. Their purpose is to create relationships the player can read: less food reduces labour; fewer planted acres reduce the next harvest; more seed spends grain that could have remained in reserve.

Sources

Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapter 3, chapter 7, chapter 13.

Run it here

This unit's program, built for you.

Program
yearfall.tap
Machine
ZX Spectrum 48K (PAL)

Download yearfall.tap