_TITLE "Hamurabi - King of Babylon and Ruler of the Ancient Kingdom of Sumeria"
' *** Choose your console/screen type below (comment/uncomment)
'$CONSOLE:ONLY
'SCREEN 0
' ***
' *** DISPLAY INTRODUCTION TO THE GAME
' ***
PRINT "You are the ruler of the ancient kingdom of Sumeria." PRINT "Your people call you 'Hamurabi the Wise'." PRINT "Your task is for the next 10 years is to develop" PRINT "a stable economy by the wise management of your" PRINT "resources. You will be beset from time to time" PRINT "by natural events." PRINT "The only help I can give you is the fact that it" PRINT "takes 1 bushel of grain as seed to plant two acres." PRINT "May you judge well, alknowing Hamurabi!" PRINT "***********HAMURABI IS HERE***********"
HamurabiInit:
DIM AS DOUBLE STARVED
, PEOPLE_DIED
, PCT_STARVED
, YEAR
, POPULATION
, BUSHELS
, HARVESTED
DIM AS DOUBLE RATS_ATE
, PESTILENCE
, PRICE
, ACRES
, IMMIGRATED
, C
DIM AS INTEGER PLAGUE_PCT
, PLAGUE
, ACRES_BUY
, ACRES_SELL
, ACRES_PLANTED
, BUSHELS_FEED
STARVED = 0 '*** D=0
PEOPLE_DIED = 0 '*** D1=0
PCT_STARVED = 0 '*** P1=0
YEAR = 0 '*** Z=0
POPULATION = 95 '*** P=95
BUSHELS = 2800 '*** S=2800
HARVESTED = 3000 '*** H=3000
RATS_ATE = HARVESTED - BUSHELS '*** E=H-S
PESTILENCE = 0 '*** NEW FIELD
PRICE = 3 '*** Y=3
ACRES = HARVESTED / PRICE '*** A=H/Y
IMMIGRATED = 5 '*** I=5
C = 1 '*** C=1 VARIABLE USED FOR ALL RANDOM NUMBER GENERATORS
PI = 0
NEWBORN = 0
PLANTERS = 0 '*** The number of people able to plant fields (Excludes New Borns)
PlayGame:
PRINT "HAMURABI, I beg to report to you!" YEAR = YEAR + 1
PRINT "In year "; FORMAT$
(STR$(YEAR
), "##");
", "; FORMAT$
(STR$(STARVED
), "#,###");
" People starved, "; FORMAT$
(STR$(NEWBORN
), "##");
" New Borns, and "; FORMAT$
(STR$(IMMIGRATED
), "##");
" migrated into the city." POPULATION = POPULATION + IMMIGRATED + NEWBORN
IF YEAR
= 1 THEN PLANTERS
= POPULATION
ELSE PLANTERS
= PLANTERS
+ IMMIGRATED
CheckForPlague:
' *** check for plague and if found, reduce population by 1/2. (15% chance of plague)
PLAGUE_PCT
= (10 * RND(1)) DISASTER_PCT
= (10 * RND(1)) PLAGUE
= INT(POPULATION
/ 2) POPULATION = PLAGUE
PLANTERS
= INT(PLANTERS
/ 2) PRINT "A horrible plague struck! Half the people died." PRINT "Half, or "; FORMAT$
(STR$(PLAGUE
), "#,###");
" people died of the plague."
DISASTER
= INT(POPULATION
/ 3) POPULATION = DISASTER
PLANTERS
= INT(PLANTERS
/ 3) PRINT "A horrible disaster struck! One-Third the people died." PRINT "One-third, or "; FORMAT$
(STR$(DISASTER
), "#,###");
" people died from the disaster."
Display_Population:
PRINT "Our Population is now "; FORMAT$
(STR$(POPULATION
), "#,###") PRINT "Able-bodied people to plant the fields is now "; FORMAT$
(STR$(PLANTERS
), "#,###") PRINT "The city owns "; FORMAT$
(STR$(ACRES
), "#,###");
" acres, " PRINT "You havested "; FORMAT$
(STR$(PRICE
), "#,###");
" bushels per acre" PRINT "Rats destroyed "; FORMAT$
(STR$(RATS_ATE
), "#,###");
" bushels. " PRINT "Insects destroyed "; FORMAT$
(STR$(PESTILENCE
), "#,###");
" bushels." PRINT "You have "; FORMAT$
(STR$(BUSHELS
), "#,###");
" bushels in storage." PRICE = C + 17
PRINT "Land is trading at "; FORMAT$
(STR$(PRICE
), "#,###");
" bushels per acre."
BuyLand:
INPUT "How much land (in acres) do you wish to buy "; ACRES_BUY
IF PRICE
* ACRES_BUY
<= BUSHELS
THEN ACRES = ACRES + ACRES_BUY
BUSHELS = BUSHELS - PRICE * ACRES_BUY
C = 0
SellLand:
INPUT "How many acres of land do you wish to sell "; ACRES_SELL
ACRES = ACRES - ACRES_SELL
BUSHELS = BUSHELS + PRICE * ACRES_SELL
C = 0
FeedPopulation:
INPUT "How many bushels do you wish to set aside for food "; BUSHELS_FEED
' *** TRYING TO USE MORE GRAIN THAN IS IN SILOS?
IF BUSHELS_FEED
<= BUSHELS
THEN BUSHELS = BUSHELS - BUSHELS_FEED
C = 1
AcresToPlant:
INPUT "How many acres do you wish to plant "; ACRES_PLANTED
' *** TRYING TO PLANT MORE ACRES THAN YOU OWN?
' *** ENOUGH GRAIN FOR SEED (TWO BUSHELS PER ACRE)?
IF ACRES_PLANTED
<= ACRES
THEN ' *** ENOUGH PEOPLE TO TEND THE CROPS?
IF ACRES_PLANTED
< 10 * PLANTERS
+ 1 THEN BUSHELS
= BUSHELS
- INT(ACRES_PLANTED
/ 2) PRINT "But you only have "; FORMAT$
(STR$(PLANTERS
), "#,###");
" people to tend the fields!, Now then, "
HarvestCrops:
' *** A BOUNTIFUL HARVEST!
PRICE = C
HARVESTED = ACRES_PLANTED * PRICE
' *** Provides a 50-50 chance of no damage due to Rats and Insects
BUSHELS = BUSHELS + HARVESTED
' *** Rats eat the existing store of Bushels, before the harvest is added
RATS_ATE = 0
RATS_ATE
= INT(BUSHELS
/ C
)
' *** Insects eat at the crops in the field, and reduce the harvest, and
' *** can sometimes wipe out an entire year's harvest!
PESTILENCE = 0
INSECTS_PCT
= (10 * RND(1)) IF INSECTS_PCT
>= 6 THEN PESTILENCE
= INT(HARVESTED
/ C
)
BUSHELS = BUSHELS + HARVESTED - (RATS_ATE + PESTILENCE)
IF BUSHELS
< 0 THEN BUSHELS
= 0
PopulationControl:
' *** Determine births and those who moved to the city
' *** LET'S HAVE SOME BABIES (Change to a random-generated number from 0-20)
' NEWBORN = INT(C * (20 * ACRES + BUSHELS) / POPULATION / 100 + 1)
' GOSUB Randomizer
NEWBORN
= INT(10 * RND(1)) ' *** No more than 10 newborns in a year
' *** LET'S HAVE SOME IMMIGRATION
IMMIGRATED
= INT(C
* (20 * ACRES
+ BUSHELS
) / POPULATION
/ 100 + 1)
' *** HOW MANY PEOPLE HAD FULL TUMMIES?
C
= INT(BUSHELS_FEED
/ 20) STARVED = 0
' *** STARVED ENOUGH FOR IMPEACHMENT (Greater than 45% of population)?
STARVED = POPULATION - C
IF STARVED
> .45 * POPULATION
THEN GOTO StarvedMSG
PCT_STARVED = ((YEAR - 1) * PCT_STARVED + STARVED * 100 / POPULATION) / YEAR
POPULATION = C
PEOPLE_DIED = PEOPLE_DIED + STARVED '*** D1=D1+D
' ***
' *** Game processing routines
' ***
StarvedMSG:
PRINT "You starved "; FORMAT$
(STR$(STARVED
), "###");
" people in this year!!!"
ExtremeMismangement:
PRINT "Due to extreme mismanagement you have been impeached and thrown out of office." PRINT "You have failed to honor your promise or lacked courage or commitment." PRINT "The people have declared you a National Fink!!!!"
FedUp:
PRINT "HAMURABI: I cannot do what you wish." PRINT "Get yourself another steward!!!!!"
PlayEvaluation:
PRINT "In your 10-year term of office, "; FORMAT$
(STR$(PCT_STARVED
), "##.##");
PRINT " percent of the population" PRINT "starved per year on average,";
PRINT " or a total of "; FORMAT$
(STR$(PEOPLE_DIED
), "###");
DeterminePlay:
LAND_PER_PERSON = ACRES / POPULATION
PRINT "You started with 10 acres per person and ended with "; FORMAT$
(STR$(LAND_PER_PERSON
), "##.##");
PRINT " arces per person." IF LAND_PER_PERSON
< 7 THEN GOTO ExtremeMismangement
PRINT "A fantastic performance! Charlemange, Disraeli, and" PRINT "Jefferson combined could not have done better!"
HeavyHanded:
PRINT "Your heavy-handed performance smacks of Nero and Ivan IV." PRINT "The remaining people find you an unpleasant ruler, and," PRINT "frankly, hate your guts!!"
MediocurePlay:
PRINT "Your performance could have been somewhat better, but" PRINT "really wasn't too bad at all. ";
INT(POPULATION
* .8 * RND(1));
" people" PRINT "would dearly like to see you assassinated but we all have our" PRINT "trivial problems."
NotEnoughGrain:
PRINT " HAMURABI: Think again. You have only" PRINT BUSHELS;
" bushels of grain. Now then,"
NotEnoughAcres:
PRINT "HAMURABI: Think again. You own only "; ACRES;
" acres. Now Then,"
Randomizer:
endProg:
PRINT "So long, for now."
'-----------------------------------------------------------------------------
' *** Return a formatted string to a variable
'