Hammurabi in 1k

See all articles from SYNC v1 n3
Author(s): Michael Hodgkins
Publication: SYNC
Pub Details: SYNC v1 n3 (Volume 1, Issue 3)
Date: May/June 1981
Pages: 11
2 LET Y=1
4 LET P=100
6 LET A=1000
8 LET G=A*3
10 PRINT "WE HAVE ";G;" BUSHELS"
15 PRINT "POPULATION ";P
20 PRINT "CITY OWNS ";A;" ACRES"
25 LET T=RND(9)+16
30 IF Y=11 THEN GOTO 250
35 PRINT "LAND PRICE ";T;" BUSHELS/ACRE"
40 PRINT "BUY HOW MUCH"
45 INPUT F
50 IF F=0 THEN GOTO 70
55 LET A=A+F
60 LET G=G-F*T
65 GOTO 90
70 PRINT "SELL HOW MUCH"
75 INPUT F
80 LET F=-F
85 GOTO 55
90 CLS
95 LET R=RND(9)
100 LET G=G-R*9
105 PRINT "FEED YOUR ";P;" SUBJECTS--MAX ";G
110 INPUT F
112 IF F>G THEN GOTO 110
115 CLS
120 LET G=G-F
125 LET F=P-R-F/20
135 IF F<0 THEN LET F=0
140 PRINT F;" STARVED"
145 IF F>10 THEN GOTO 245
150 LET P=P-F
155 PRINT "SOW GRAIN"
157 PRINT "CITY OWNS ";A;" ACRES"
160 PRINT "WE OWN SEED FOR ";G
165 PRINT P*9 ;" CAN BE TENDED"
170 INPUT F
175 IF F>P*9 OR F>A OR F>G THEN GOTO 170
180 CLS
185 LET G=G+RND(5)*F-F
190 PRINT "YR ";Y
195 IF R=1 THEN GOTO 225
200 PRINT R;" PEOPLE ENTERED CITY"
205 LET P=P+R
210 PRINT "RATS ATE ";R*9;" BUSHELS"
215 LET Y=Y+1
220 GOTO 10
225 PRINT "PLAGUE"
230 PRINT P-P/2;" DIE"
235 LET P=P/2
240 GOTO 210
245 PRINT "MURDERER"
250 PRINT "END OF REIGN"

To run, press RUN and NEWLINE. Then enter your choices as called for by the computer.

When you reach “END OF REIGN” and want to start again, press any key and then press RUN and NEWLINE.

The game begins by telling the player the state of the economy he is to manage. The lines of the game function as follows:

2-8       Set up variables, year, population, acreage, and
          grain.
10-20     PRINT information on the screen.
25        Sets random land price.
30        Year counter to check for end of reign.
35-45     PRINTs land price and asks how much the
          player wishes to buy.
50        If no land is bought, the program jumps to 70.
55-60     Adjusts acres and grain according to the
          transaction.
70-85     Asks how much land the player wants to sell;
          then goes to 55 to adjust variables as before.
95-100    Chooses a random number to be used for a
          variety of things. First it subtracts the amount of
          grain eaten by rats.
105-145   Tells the player to feed subjects; checks that he
          is not feeding them more grain than he has;
          works out how many people starved and the
          remaining grain. If the number starved is too
          large, it jumps to 245.
155-170   Instructions to sow grain, telling player how
          much grain may be sown, tended, etc.
175       Checks that he is not cheating.
185       Decides crop to be harvested.
190-210   Gives readout of year's events.
215       Increments year number by 1.
220       Returns to beginning of new year.
225-240   Plague routine; approximately half the people
          die.
245       Prints MURDERER if more than 10 people have
          starved.
250       Final statement; game over.

The program uses almost every byte of memory available. The same variable F is used for all INPUT’s to save memory and also a single random number R is used for the number of people entering the city, the number of bushels devoured by rats, and the test for a plague. A plague occurs when R=1, thus avoiding the complications caused by “1 PEOPLE” entering the city.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.