10 REM ORIGINAL HAMURABI IN IMSAI 4K BASIC
20 REM FROM REVISION REWRITTEN 12/11/77
310 PRINT "HAMURABI - ";
320 PRINT "WHERE YOU GOVERN THE ";
321 PRINT "ANCIENT KINGDOM OF SUMERIA."
330 PRINT "THE OBJECT IS TO FIGURE ";
331 PRINT "OUT HOW THE GAME WORKS!!"
340 PRINT "(IF YOU WANT TO QUIT, ";
341 PRINT "SELL ALL YOUR LAND.)"
400 LET A1 = 100
410 LET A2 = 5
420 LET A3 = 0
430 LET B1 = 2800
440 LET B2 = 200
450 LET B3 = 3
460 LET B4 = 3000
470 LET C1 = 1000
480 LET J = 1
1010 PRINT
1020 PRINT "HAMURABI, I BEG TO REPORT ";
1021 PRINT "THAT LAST YEAR "
1040 PRINT A3;"PEOPLE STARVED AND ";A2;
1041 PRINT "PEOPLE CAME TO THE CITY."
1050 IF J > 0 THEN GOTO 1100
1060 LET A1 = A1-INT(A1/2)
1070 PRINT "THE PLAGUE KILLED ";
1071 PRINT "HALF THE PEOPLE."
1100 PRINT "THE POPULATION IS NOW ";A1
1120 PRINT "WE HARVESTED ";B4;"BUSHELS ";
1121 PRINT "AT ";B3;"BUSHELS PER ACRE."
1130 PRINT "RATS DESTROYED ";
1131 PRINT B2;" BUSHELS LEAVING ";B1;
1140 PRINT "BUSHELS IN"
1141 PRINT "THE STOREHOUSES."
1160 PRINT "THE CITY OWNS ";C1;
1161 PRINT "ACRES OF LAND."
1170 LET C2 = 17+INT(6*RND(1))
1180 PRINT "LAND IS WORTH ";C2;"BUSHELS ";
1181 PRINT "PER ACRE."
1210 PRINT "HAMURABI . . ."
1310 PRINT
1320 PRINT "BUY HOW MANY ACRES";
1330 INPUT I
1335 PRINT
1340 LET I = INT(ABS(I))
1350 IF I = 0 THEN GOTO 1510
1360 LET J = I*C2
1370 IF J <= B1 THEN GOTO 1400
1380 GOSUB 9000
1390 GOTO 1310
1400 LET B1 = B1-J
1410 LET C1 = C1+I
1510 PRINT "SELL HOW MANY ACRES";
1520 INPUT I
1525 PRINT
1530 LET I = (ABS(I))
1540 IF I = 0 THEN GOTO 1710
1550 IF I < C1 THEN GOTO 1600
1560 IF I = C1 THEN END
1570 GOSUB 9000
1580 GOTO 1510
1600 LET C1 = C1-I
1610 LET B1 = B1+C2*I
1710 PRINT "HOW MANY BUSHELS SHALL ";
1711 PRINT "WE DISTRIBUTE AS FOOD? ";
1720 INPUT I
1725 PRINT
1730 LET I = INT(ABS(I))
1740 IF I <= B1 THEN GOTO 1770
1750 GOSUB 9000
1760 GOTO 1710
1770 LET B1 = B1-I
1780 LET A3 = A1-INT(I/20)
1790 LET A2 = 0
1800 IF A3 >= 0 THEN GOTO 1910
1810 LET A2 = -A3/2
1820 LET A3 = 0
1910 PRINT "HOW MANY ACRES SHALL ";
1911 PRINT "WE PLANT? ";
1920 INPUT I
1925 PRINT
1930 LET I = INT(ABS(I))
1935 IF I > C1 THEN GOTO 1960
1940 LET J = INT(I/2)
1950 IF J <= B1 THEN GOTO 1980
1960 GOSUB 9000
1970 GOTO 1910
1980 IF I > 10*A1 THEN GOTO 1960
1990 LET B1 = B1-J
2010 LET B3 = INT(5*RND(1))+1
2020 LET B4 = B3*I
2030 LET B2 = INT((B1+B4)*0.07*RND(1))
2040 LET B1 = B1-B2+B4
2050 LET J = INT(10*RND(1))
2060 LET A2 = INT(A2+(5-B3)*B1/600+1)
2070 IF A2 <= 50 THEN GOTO 2100
2080 LET A2 = 50
2100 LET A1 = A1+A2-A3
2110 GOTO 1010
9000 REM***ERROR ROUTINE
9010 PRINT "HAMURABI, THINK AGAIN - ";
9011 PRINT "YOU ONLY HAVE "
9020 PRINT A1;"PEOPLE,";C1;"ACRES, AND ";
9030 PRINT B1;"BUSHELS IN STOREHOUSES."
9040 RETURN

