Author Topic: Modified (More Challenging) Version of the Original Hamurabi Game!  (Read 4558 times)

0 Members and 1 Guest are viewing this topic.

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
If you think the original Hamurabi game was hard, I've made it more challenging!

In this revised version from the one created by David Ahl, feeding your kingdom just got harder.

The original game's mechanics have remained the same -  that is you have to plant, feed a growing population of people. The can be hit with a plague and rats have been known to eat parts of your bushels.

You still need to provide each person 20 bushels to feed them, and 1 person can plant 10 acres. And you still need 2 bushels to plant an acre.

Here are the new updates to this classic game:
  • You now have to deal with newborns. Each year, you can have up to 10 newborns. These add to the overall population, but they are not available to plant your fields.
  • Able bodies (Planters) are the people who can plant your harvest. If no plagues (or disasters) hit, there could be a larger population, with less people to plant your harvest.
  • Disasters - The current game still has plagues that wipe out 1/2 of your population. I've now added disasters that wipe out 1/3 of your population. And yes, you can get hit by both a plague and a disaster at the same time. The plague wipes out first, then the disaster takes 1/3 of those remaining. Both not only reduces the total population, but also able-bodied people to plant. This is to ensure some of the newborns survive plagues and disasters.
  • Insects (pestilence) have been added as a force affecting your harvest. This part has changed. You can have rat and insect damage, but they now work differently. Rats only eat bushels in storage, while insects only affect the harvest. And yes, I've seen in my testing insects wipe out entire harvests. Rats can do some damage, but I left the original in this game, and rats in my testing have never eaten an entire storage of grain!
All other parameters of the game, right now, are the same.

Remember, when you allocate bushels to feed, it is your entire population (newborns + planters). I have caught myself using the wrong number and starving a few people.

Also, you can choose whether to play with the QB64 Screen, or change the code to play in a terminal. This game should work on all OS's (Windows, Mac and Linux), or wherever you compile your QB64 programs!

Good Luck!

PS: I am developing an InForm version of this game, where you can see, in real time, what your changes do to your values before you commit them. The original game written back in the 1960's and 70's does not provide that. In the spirit of those of us who played the original game when it first came out, I haven't done those updates to this version. But the InForm game will be even more challenging.

Code: QB64: [Select]
  1. _TITLE "Hamurabi - King of Babylon and Ruler of the Ancient Kingdom of Sumeria"
  2.  
  3. ' *** Choose your console/screen type below (comment/uncomment)
  4. '$CONSOLE:ONLY
  5. 'SCREEN 0
  6. SCREEN _NEWIMAGE(800, 600, 32)
  7.  
  8.  
  9. ' ***
  10. ' *** DISPLAY INTRODUCTION TO THE GAME
  11. ' ***
  12. PRINT TAB(32); "HAMURABI"
  13. PRINT "You are the ruler of the ancient kingdom of Sumeria."
  14. PRINT "Your people call you 'Hamurabi the Wise'."
  15. PRINT "Your task is for the next 10 years is to develop"
  16. PRINT "a stable economy by the wise management of your"
  17. PRINT "resources. You will be beset from time to time"
  18. PRINT "by natural events."
  19. PRINT "The only help I can give you is the fact that it"
  20. PRINT "takes 1 bushel of grain as seed to plant two acres."
  21. PRINT "May you judge well, alknowing Hamurabi!"
  22. PRINT "***********HAMURABI IS HERE***********"
  23.  
  24. HamurabiInit:
  25.     DIM AS DOUBLE STARVED, PEOPLE_DIED, PCT_STARVED, YEAR, POPULATION, BUSHELS, HARVESTED
  26.     DIM AS DOUBLE RATS_ATE, PESTILENCE, PRICE, ACRES, IMMIGRATED, C
  27.     DIM AS DOUBLE PI
  28.     DIM AS INTEGER PLAGUE_PCT, PLAGUE, ACRES_BUY, ACRES_SELL, ACRES_PLANTED, BUSHELS_FEED
  29.  
  30.     STARVED = 0 '*** D=0
  31.     PEOPLE_DIED = 0 '*** D1=0
  32.     PCT_STARVED = 0 '*** P1=0
  33.     YEAR = 0 '*** Z=0
  34.     POPULATION = 95 '*** P=95
  35.     BUSHELS = 2800 '*** S=2800
  36.     HARVESTED = 3000 '*** H=3000
  37.     RATS_ATE = HARVESTED - BUSHELS '*** E=H-S
  38.     PESTILENCE = 0 '*** NEW FIELD
  39.     PRICE = 3 '*** Y=3
  40.     ACRES = HARVESTED / PRICE '*** A=H/Y
  41.     IMMIGRATED = 5 '*** I=5
  42.     C = 1 '*** C=1  VARIABLE USED FOR ALL RANDOM NUMBER GENERATORS
  43.     PI = 0
  44.     NEWBORN = 0
  45.     PLANTERS = 0 '*** The number of people able to plant fields (Excludes New Borns)
  46.  
  47.  
  48. PlayGame:
  49.     CLS
  50.     PRINT: PRINT
  51.     PRINT "HAMURABI, I beg to report to you!"
  52.     PRINT
  53.     YEAR = YEAR + 1
  54.     PRINT "In year "; FORMAT$(STR$(YEAR), "##"); ", "; FORMAT$(STR$(STARVED), "#,###"); " People starved, "; FORMAT$(STR$(NEWBORN), "##"); " New Borns, and "; FORMAT$(STR$(IMMIGRATED), "##"); " migrated into the city."
  55.     POPULATION = POPULATION + IMMIGRATED + NEWBORN
  56.     IF YEAR = 1 THEN PLANTERS = POPULATION ELSE PLANTERS = PLANTERS + IMMIGRATED
  57.  
  58. CheckForPlague:
  59. ' *** check for plague and if found, reduce population by 1/2. (15% chance of plague)
  60.     PLAGUE_PCT = (10 * RND(1))
  61.     DISASTER_PCT = (10 * RND(1))
  62.     PRINT
  63.     IF PLAGUE_PCT >= 8.5 AND YEAR > 1 THEN
  64.         PLAGUE = INT(POPULATION / 2)
  65.         POPULATION = PLAGUE
  66.         PLANTERS = INT(PLANTERS / 2)
  67.         PRINT "A horrible plague struck! Half the people died."
  68.         PRINT "Half, or "; FORMAT$(STR$(PLAGUE), "#,###"); " people died of the plague."
  69.         PRINT
  70.     END IF
  71.  
  72.     PRINT
  73.     IF DISASTER_PCT >= 8.5 AND YEAR > 1 THEN
  74.         DISASTER = INT(POPULATION / 3)
  75.         POPULATION = DISASTER
  76.         PLANTERS = INT(PLANTERS / 3)
  77.         PRINT "A horrible disaster struck! One-Third the people died."
  78.         PRINT "One-third, or "; FORMAT$(STR$(DISASTER), "#,###"); " people died from the disaster."
  79.         PRINT
  80.     END IF
  81.  
  82. Display_Population:
  83.     PRINT "Our Population is now "; FORMAT$(STR$(POPULATION), "#,###")
  84.     PRINT "Able-bodied people to plant the fields is now "; FORMAT$(STR$(PLANTERS), "#,###")
  85.     PRINT "The city owns "; FORMAT$(STR$(ACRES), "#,###"); " acres, "
  86.     PRINT "You havested "; FORMAT$(STR$(PRICE), "#,###"); " bushels per acre"
  87.     PRINT "Rats destroyed "; FORMAT$(STR$(RATS_ATE), "#,###"); " bushels. "
  88.     PRINT "Insects destroyed "; FORMAT$(STR$(PESTILENCE), "#,###"); " bushels."
  89.     PRINT "You have "; FORMAT$(STR$(BUSHELS), "#,###"); " bushels in storage."
  90.     PRINT
  91.     IF YEAR = 11 THEN GOTO PlayEvaluation
  92.     C = INT(10 * RND(1))
  93.     PRICE = C + 17
  94.     PRINT "Land is trading at "; FORMAT$(STR$(PRICE), "#,###"); " bushels per acre."
  95.  
  96. BuyLand:
  97.     INPUT "How much land (in acres) do you wish to buy "; ACRES_BUY
  98.     IF ACRES_BUY < 0 THEN GOTO FedUp
  99.     IF PRICE * ACRES_BUY <= BUSHELS THEN
  100.         IF ACRES_BUY = 0 THEN GOTO SellLand
  101.         ACRES = ACRES + ACRES_BUY
  102.         BUSHELS = BUSHELS - PRICE * ACRES_BUY
  103.         C = 0
  104.         GOTO FeedPopulation
  105.     END IF
  106.     GOSUB NotEnoughGrain
  107.     GOTO BuyLand
  108.  
  109. SellLand:
  110.     INPUT "How many acres of land do you wish to sell "; ACRES_SELL
  111.     IF ACRES_SELL < 0 THEN GOTO FedUp
  112.     IF ACRES_SELL < ACRES THEN
  113.         ACRES = ACRES - ACRES_SELL
  114.         BUSHELS = BUSHELS + PRICE * ACRES_SELL
  115.         C = 0
  116.         GOTO FeedPopulation
  117.     END IF
  118.     GOSUB NotEnoughAcres
  119.     GOTO SellLand
  120.  
  121. FeedPopulation:
  122.     INPUT "How many bushels do you wish to set aside for food "; BUSHELS_FEED
  123.     IF BUSHELS_FEED < 0 THEN GOTO FedUp
  124.     IF BUSHELS_FEED = 0 THEN
  125.         GOSUB NotEnoughGrain
  126.         GOTO FeedPopulation
  127.     END IF
  128. ' *** TRYING TO USE MORE GRAIN THAN IS IN SILOS?
  129.     IF BUSHELS_FEED <= BUSHELS THEN
  130.         BUSHELS = BUSHELS - BUSHELS_FEED
  131.         C = 1
  132.         GOTO AcresToPlant
  133.     END IF
  134.     GOSUB NotEnoughGrain
  135.     GOTO FeedPopulation
  136.  
  137. AcresToPlant:
  138.     INPUT "How many acres do you wish to plant "; ACRES_PLANTED
  139. ' *** TRYING TO PLANT MORE ACRES THAN YOU OWN?
  140.     IF ACRES_PLANTED = 0 THEN GOTO HarvestCrops
  141.     IF ACRES_PLANTED < 0 THEN GOTO FedUp
  142. ' *** ENOUGH GRAIN FOR SEED (TWO BUSHELS PER ACRE)?
  143.     IF ACRES_PLANTED <= ACRES THEN
  144.         IF INT(ACRES_PLANTED / 2) <= BUSHELS THEN
  145. ' *** ENOUGH PEOPLE TO TEND THE CROPS?
  146.             IF ACRES_PLANTED < 10 * PLANTERS + 1 THEN
  147.                 BUSHELS = BUSHELS - INT(ACRES_PLANTED / 2)
  148.                 GOTO HarvestCrops
  149.             ELSE
  150.                 PRINT "But you only have "; FORMAT$(STR$(PLANTERS), "#,###"); " people to tend the fields!, Now then, "
  151.                 GOTO AcresToPlant
  152.             END IF
  153.         ELSE
  154.             GOSUB NotEnoughGrain
  155.             GOTO AcresToPlant
  156.         END IF
  157.     END IF
  158.     GOSUB NotEnoughAcres
  159.     GOTO AcresToPlant
  160.  
  161. HarvestCrops:
  162. ' *** A BOUNTIFUL HARVEST!
  163.     GOSUB Randomizer
  164.     PRICE = C
  165.     HARVESTED = ACRES_PLANTED * PRICE
  166.  
  167. ' *** Provides a 50-50 chance of no damage due to Rats and Insects
  168.     GOSUB Randomizer
  169.     IF C MOD 2 = 0 THEN
  170.         BUSHELS = BUSHELS + HARVESTED
  171.         GOTO PopulationControl
  172.     END IF
  173.  
  174. ' *** Rats eat the existing store of Bushels, before the harvest is added
  175.     RATS_ATE = 0
  176.     RATS_ATE = INT(BUSHELS / C)
  177.  
  178. ' *** Insects eat at the crops in the field, and reduce the harvest, and
  179. ' *** can sometimes wipe out an entire year's harvest!
  180.     GOSUB Randomizer
  181.     PESTILENCE = 0
  182.     INSECTS_PCT = (10 * RND(1))
  183.     IF INSECTS_PCT >= 6 THEN PESTILENCE = INT(HARVESTED / C)
  184.  
  185.     BUSHELS = BUSHELS + HARVESTED - (RATS_ATE + PESTILENCE)
  186.     IF BUSHELS < 0 THEN BUSHELS = 0
  187.  
  188. PopulationControl:
  189. ' *** Determine births and those who moved to the city
  190.  
  191. ' *** LET'S HAVE SOME BABIES (Change to a random-generated number from 0-20)
  192. '   NEWBORN = INT(C * (20 * ACRES + BUSHELS) / POPULATION / 100 + 1)
  193. '    GOSUB Randomizer
  194.     NEWBORN = INT(10 * RND(1)) ' *** No more than 10 newborns in a year
  195.  
  196. ' *** LET'S HAVE SOME IMMIGRATION
  197.     GOSUB Randomizer
  198.     IMMIGRATED = INT(C * (20 * ACRES + BUSHELS) / POPULATION / 100 + 1)
  199.  
  200. ' *** HOW MANY PEOPLE HAD FULL TUMMIES?
  201.     C = INT(BUSHELS_FEED / 20)
  202.     IF POPULATION < C THEN
  203.         STARVED = 0
  204.         GOTO PlayGame
  205.     END IF
  206.  
  207. ' *** STARVED ENOUGH FOR IMPEACHMENT (Greater than 45% of population)?
  208.     STARVED = POPULATION - C
  209.     IF STARVED > .45 * POPULATION THEN GOTO StarvedMSG
  210.     PCT_STARVED = ((YEAR - 1) * PCT_STARVED + STARVED * 100 / POPULATION) / YEAR
  211.     POPULATION = C
  212.     PEOPLE_DIED = PEOPLE_DIED + STARVED '*** D1=D1+D
  213.     GOTO PlayGame
  214.  
  215. ' ***
  216. ' *** Game processing routines
  217. ' ***
  218.  
  219. StarvedMSG:
  220.     PRINT
  221.     PRINT "You starved "; FORMAT$(STR$(STARVED), "###"); " people in this year!!!"
  222.  
  223. ExtremeMismangement:
  224.     PRINT "Due to extreme mismanagement you have been impeached and thrown out of office."
  225.     PRINT "You have failed to honor your promise or lacked courage or commitment."
  226.     PRINT "The people have declared you a National Fink!!!!"
  227.     GOTO endProg
  228.  
  229. FedUp:
  230.     PRINT
  231.     PRINT "HAMURABI: I cannot do what you wish."
  232.     PRINT "Get yourself another steward!!!!!"
  233.     GOTO endProg
  234.  
  235. PlayEvaluation:
  236.     PRINT "In your 10-year term of office, "; FORMAT$(STR$(PCT_STARVED), "##.##");
  237.     PRINT " percent of the population"
  238.     PRINT "starved per year on average,";
  239.     PRINT " or a total of "; FORMAT$(STR$(PEOPLE_DIED), "###");
  240.     PRINT " people died!!"
  241.     PRINT
  242.  
  243. DeterminePlay:
  244.     LAND_PER_PERSON = ACRES / POPULATION
  245.     PRINT "You started with 10 acres per person and ended with "; FORMAT$(STR$(LAND_PER_PERSON), "##.##");
  246.     PRINT " arces per person."
  247.     PRINT
  248.     IF PCT_STARVED > 33 THEN GOTO ExtremeMismangement
  249.     IF LAND_PER_PERSON < 7 THEN GOTO ExtremeMismangement
  250.     IF PCT_STARVED > 10 THEN GOTO HeavyHanded
  251.     IF LAND_PER_PERSON < 9 THEN GOTO HeavyHanded
  252.     IF PCT_STARVED > 3 THEN GOTO MediocurePlay
  253.     IF LAND_PER_PERSON < 10 THEN GOTO MediocurePlay
  254.     PRINT "A fantastic performance! Charlemange, Disraeli, and"
  255.     PRINT "Jefferson combined could not have done better!"
  256.     GOTO endProg
  257.  
  258. HeavyHanded:
  259.     PRINT "Your heavy-handed performance smacks of Nero and Ivan IV."
  260.     PRINT "The remaining people find you an unpleasant ruler, and,"
  261.     PRINT "frankly, hate your guts!!"
  262.     GOTO endProg
  263.  
  264. MediocurePlay:
  265.     PRINT "Your performance could have been somewhat better, but"
  266.     PRINT "really wasn't too bad at all. "; INT(POPULATION * .8 * RND(1)); " people"
  267.     PRINT "would dearly like to see you assassinated but we all have our"
  268.     PRINT "trivial problems."
  269.     GOTO endProg
  270.  
  271. NotEnoughGrain:
  272.     PRINT " HAMURABI: Think again. You have only"
  273.     PRINT BUSHELS; " bushels of grain. Now then,"
  274.     RETURN
  275.  
  276. NotEnoughAcres:
  277.     PRINT "HAMURABI: Think again. You own only "; ACRES; " acres. Now Then,"
  278.     RETURN
  279.  
  280. Randomizer:
  281.     C = INT(RND(1) * 5) + 1
  282.     RETURN
  283.  
  284. endProg:
  285.     PRINT
  286.     FOR N = 1 TO 10
  287.         PRINT CHR$(7);
  288.     NEXT N
  289.     PRINT "So long, for now."
  290.     PRINT
  291.     END
  292.    
  293. FUNCTION FORMAT$ (text AS STRING, template AS STRING)
  294. '-----------------------------------------------------------------------------
  295. ' *** Return a formatted string to a variable
  296. '
  297.     d = _DEST: s = _SOURCE
  298.     n = _NEWIMAGE(80, 80, 0)
  299.     _DEST n: _SOURCE n
  300.     PRINT USING template; VAL(text)
  301.     FOR i = 1 TO 79
  302.         t$ = t$ + CHR$(SCREEN(1, i))
  303.     NEXT
  304.     IF LEFT$(t$, 1) = "%" THEN t$ = MID$(t$, 2)
  305.     FORMAT$ = _TRIM$(t$)
  306.     _DEST d: _SOURCE s
  307.     _FREEIMAGE n
  308.  
 
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #1 on: December 05, 2021, 02:17:22 pm »
Oh... You could also throw in extra 'natural' events. Storms. Which could include hail damage; Lightning strikes - Fire; and flooding. Oh. Let's not forget the ever popular drought... I had thought of earthquakes and volcanoes... but its meant to be fun... lol  Tribal raids and or thieves. On the plus side: Introduce natural rodent and pest protection. Cats and hawks (accounting for their upkeep); Levees for flooding - takes time a workers to build...  I think I will stop there... After all... It's meant to be a game... Unless you were going for the 'simulation' feel?
Logic is the beginning of wisdom.

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #2 on: December 05, 2021, 06:08:48 pm »
The disasters encompasses all natural events: storms, earthquakes, floods, etc. It is just a catch-all for any kind of disaster that isn't caused by a plague or pandemic.

Droughts I believe was figured into the original game by the random number of harvests per acre. If you only get 1 bushel per acre, that could be your drought.

People dying of starvation is due to mis-management. 

I will be going for both a simulation and a game that is fun to play. The very final version will allow you to control many factors for more than 10 years. It will also be part historical, as Hammurabi ruled for 42 years, so the game will simulate 42 years, and may even compare your rule to how he did.

But for now, I just want the game to be both fun, challenging, and interesting, without making it impossible to play. Tough, yes.

I do like some of your suggestions, like rodent and insect protection measures. That could be a cost of X number of bushels if you have enough. I will consider it.

Oh... You could also throw in extra 'natural' events. Storms. Which could include hail damage; Lightning strikes - Fire; and flooding. Oh. Let's not forget the ever popular drought... I had thought of earthquakes and volcanoes... but its meant to be fun... lol  Tribal raids and or thieves. On the plus side: Introduce natural rodent and pest protection. Cats and hawks (accounting for their upkeep); Levees for flooding - takes time a workers to build...  I think I will stop there... After all... It's meant to be a game... Unless you were going for the 'simulation' feel?
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #3 on: December 08, 2021, 07:18:01 am »
Hi
I like Hammurabi game. Someone else has posted a version of the original game  some time ago on this forum.
A console text game challenging.

About improvements and variants of the game :
the dark side (difficulties) has had too much contributes...

I suggests these features for the light side (improvements, tools, science, faith and technologies)
1 /20 of newborns grow as superhealth so at adult stage he works like 3 normal adult

1/20 of newborns grow as genius and inventor (creative feature) so at adult stage he creates new useful things  at a rate half than normal adult

1/20 of newborns has psicological feature so in adult stage he is psicologist /priest and he can give faith to other adult that gives superhealth for a short time,  he can teach knowledge for becoming genius or psicologist/priest  to the normal adult

Scientists (genius or creative) can develop tools for increasing crops (hoe, spade, wheelbarrow, sickle, ,bucket, irrigation channels, irrigation pump and so on)  or defeat rats (traps, cats, poison) , or  reduce disasters' effects (stronger buildings, roads to escape, fireman with sand) , or store bushels in the years ( drying, silos) , or let use less bushels for plantations ( for example 1 bushel gives plants for 2 acres)

Superhealth adult works harder and longer and restore themselves quickly but they uses double of bushels to survive.

At starting stage Hammurabi must spend bushels to research (or to ask to Ra God) the features Superhealth, Genius, Psicologist/Priest. One research for one feature.
Only normal and superhealth adults can work in fields.

Newborns need double of resources to survive.

The ratio between  superhealth or genius or priest  vs total population is 1 to 10 (in other words for every ten adult can be 1 superhealth + 1 genius + 1 priest.

Just to launch some positive ideas in the game.
Now I'm going to run your code George.
See later.
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #4 on: December 08, 2021, 06:12:17 pm »
@George McGinn
hey but Hammurabi cheats!
see here how this casual step over destroyed my project of long life!
 
Hammurabi cheats.PNG
Programming isn't difficult, only it's  consuming time and coffee

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #5 on: December 08, 2021, 08:06:20 pm »
EDIT: You had almost 5,000 bushels in storage ??? (who's cheating?)

I ran a game where the insects destroyed my entire harvest for the year!

I never said it would be easy - what fun would that be??? You can change or limit the damage done by modifying the code that determines how much of a percentage each destroys.

I've never seen rats eat that much, but I did change it to eat only what is in storage, rather than the entire stockpile (storage + harvest), as I added insects to destroy the harvest!

I'm looking at what would happen if the initial population and larger amount of land owned would do to the challenge. If you can plant and harvest more at the start, you might last longer than 4 years!

Better luck in your next re-incarnation!

@George McGinn
hey but Hammurabi cheats!
see here how this casual step over destroyed my project of long life!
 
Hammurabi cheats.PNG

____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #6 on: December 08, 2021, 08:15:04 pm »
@TempodiBasic,

The code below shows how each (rats & insects) damage your stores and harvest.

The way it works is that there is a 50-50 chance that you'll encounter damage. If so, then it calculates a random percentage from 10 to 100 percent damage for each.

I would agree that rats should not eat more than say 20 percent, but insects, especially if they are a plague, can destroy an entire harvest.

It will be something I look at when I improve the game some more (I plan to add a revolt factor next, along with adding more initial land, etc. to compensate for the increased damages that can occur). That will have to be balanced, maybe I can add a difficulty indicator. You can choose between an easy game or a difficult/near impossible game.

Code: QB64: [Select]
  1. HarvestCrops:
  2. ' *** A BOUNTIFUL HARVEST!
  3.     GOSUB Randomizer
  4.     PRICE = C
  5.     HARVESTED = ACRES_PLANTED * PRICE
  6.  
  7. ' *** Provides a 50-50 chance of no damage due to Rats and Insects
  8.     GOSUB Randomizer
  9.     IF C MOD 2 = 0 THEN
  10.         BUSHELS = BUSHELS + HARVESTED
  11.         GOTO PopulationControl
  12.     END IF
  13.  
  14. ' *** Rats eat the existing store of Bushels, before the harvest is added
  15.     RATS_ATE = 0
  16.     RATS_ATE = INT(BUSHELS / C)
  17.  
  18. ' *** Insects eat at the crops in the field, and reduce the harvest, and
  19. ' *** can sometimes wipe out an entire year's harvest!
  20.     GOSUB Randomizer
  21.     PESTILENCE = 0
  22.     INSECTS_PCT = (10 * RND(1))
  23.     IF INSECTS_PCT >= 6 THEN PESTILENCE = INT(HARVESTED / C)
  24.  
  25.     BUSHELS = BUSHELS + HARVESTED - (RATS_ATE + PESTILENCE)
  26.     IF BUSHELS < 0 THEN BUSHELS = 0
« Last Edit: December 08, 2021, 11:39:15 pm by odin »
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #7 on: December 09, 2021, 01:19:32 am »
As a farmer myself, I can give you a few ideas on a few features to add to the game.

1) A variety of crops.  Potatoes, beans, corn, wheat, whatnot.  Each has to have it's own unique seed and plant amount, and each will produce and feed a different number of people, as well as having different lifetime preservation times.  Just because rats got into your cellar and ate your potatoes, that doesn't mean they got into your pottery and ate your dried beans.

2) With a variety of crops comes a variety of predators.  Some of these predators can (and are) naturally edible as well, if you kill them.  Example:  Deer love to eat my corn fields.  I love to eat deer.  The natural cycle of nature makes us both get fatter with a good harvest.   

Other animals are just pest animals.  They honestly have no redeeming qualities to them, rather than to make a farmer's life hell.  Crows, for example, are one of these species.  Honestly, I'd rather have a whole swarm of rats invade my storage, than to have a murder of crows show up around my farm.  Berries and such can, and do, end up stripped completely bare by a single flock of crows -- and often they destroy the harvest in as short of a period of time as overnight.  I've personally seen whole orchards of cheery trees picked clean in just a few hours by a wave of crows that cawed and shit everywhere.

3) Pest prevention.  Many of these pest animals can be controlled by the simple introduction of natural predators.  One of the biggest deterrents to reduce insect damage to your crops is the introduction of free range chickens.  Believe it or not, a chicken eats a ton of insects on a regular basis, and they absolutely love to wander around the loose soil of a garden/field.  You have to keep them away from the crops until they're of suitable size to not damage them, but by the point that the plants have gotten large enough to leaf and bloom to draw insects, it's generally safe to allow chickens to wander amongst the crops.

Rats can be contained by adding cats.  Crows can be contained by judicious use of a shotgun.  (Just don't tell PETA or Uncle Sam.  In North America, American crows are protected by the Migratory Bird Treaty Act.   /CRY!!)  Dogs do a good job of keeping many varmints away.  (Which is why we domesticated dogs and cats to be our companions in the first place.)

Pesticides, fertilizers, lime and acidity are all things which you could add to a "can you feed your populace" simulation.  Invasive species and species incompatibility should be keep in mind as well.  For example, a walnut tree comes immediately to my mind, as my land is infested is thousands of the things.  There's a lot of acidity in raw, unhulled walnuts, and when they fall from the tree, they turn the soil around it acidic.  Any type of plant/grass that needs an alkaline base to grow good isn't going to grow near walnuts -- not without a lot of soil maintenance with adding lime to replenish the balance.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #8 on: December 09, 2021, 02:41:20 pm »
Great suggestions. Some I have considered, and will be adding to the game.

Since I want this to keep to the period it is set in, the main crops grown back then were wheat, barley and dates. Barley became a main crop as the soil started to become more saline. But having a variety was necessary for both feeding the population and for trade outside. I also want this game to be a learning experience as well as something fun and hard to play. It has to be educational as well as playable (My next large project after I finish my Baseball/Softball Statistical System, with complete Sabermetrics, and be free and open source to all - and is written in QB64!)

As a teen, I spent my summers (and part of my winters) on a cattle farm in update New York (Liberty, NY in the Catskills), working a heard of about 200+ poll Herefords and a small string of horses (mostly used by us) on about 900 acres. we grew several kinds of grass for hay and 35+ acres of corn for winter feed (made for great pheasant hunting in the fall, as we left most of the stalks up with some corn on them for the deer). Even had chickens.

I remember when crows changed from being a bird we could shoot anytime of the year to having its own hunting season in NY. However, like problem deer, any animal that threatened the well-being of the farm, we were able to shoot year round. Some years we would instead of riding the fence line spend a week or two camping on the ranch on crow duty. My shoulder would be sore by the end of the day just from shooting at them. We even rigged M-80's in tree tops and lit them to scare them away! Those were the days. We never had luck using plastic owls. The crows sit on top of them and crap all over it.

Back to the game, I have done quite extensive research into the time period, so I will be introducing preventive measures for all kinds of pestilences based on how they did it during Hammurabi's time. I will even introduce a simplified version of their actual monetary system, as there has to be a cost of goods as it was back then, including costs of preventive measures. 

I also have to do some work on the issue you bring up about rats. Yes, if the grain is sealed in clay jars, they are more protected from being destroyed, and I will be factoring that in. A good point.

But you know as well as I that introducing other animals to control others have their own problems. Chickens are easy, as if there are too many, they make a fine meal. Not so for cats, as their populations can get out of hand, and then they wind up wiping out all your free-ranging chickens! But such factors can be built into the game. I will have to reread my research on the methods they used to control pestilence as its been a while since I last looked at it.

We had plenty of dogs on the farm. I am partial to Australian Shepherds, and Daphne, my service dog, is an Aussie.

Thanks, great ideas, and I will be considering them.


As a farmer myself, I can give you a few ideas on a few features to add to the game.

1) A variety of crops.  Potatoes, beans, corn, wheat, whatnot.  Each has to have it's own unique seed and plant amount, and each will produce and feed a different number of people, as well as having different lifetime preservation times.  Just because rats got into your cellar and ate your potatoes, that doesn't mean they got into your pottery and ate your dried beans.

2) With a variety of crops comes a variety of predators.  Some of these predators can (and are) naturally edible as well, if you kill them.  Example:  Deer love to eat my corn fields.  I love to eat deer.  The natural cycle of nature makes us both get fatter with a good harvest.   

Other animals are just pest animals.  They honestly have no redeeming qualities to them, rather than to make a farmer's life hell.  Crows, for example, are one of these species.  Honestly, I'd rather have a whole swarm of rats invade my storage, than to have a murder of crows show up around my farm.  Berries and such can, and do, end up stripped completely bare by a single flock of crows -- and often they destroy the harvest in as short of a period of time as overnight.  I've personally seen whole orchards of cheery trees picked clean in just a few hours by a wave of crows that cawed and shit everywhere.

3) Pest prevention.  Many of these pest animals can be controlled by the simple introduction of natural predators.  One of the biggest deterrents to reduce insect damage to your crops is the introduction of free range chickens.  Believe it or not, a chicken eats a ton of insects on a regular basis, and they absolutely love to wander around the loose soil of a garden/field.  You have to keep them away from the crops until they're of suitable size to not damage them, but by the point that the plants have gotten large enough to leaf and bloom to draw insects, it's generally safe to allow chickens to wander amongst the crops.

Rats can be contained by adding cats.  Crows can be contained by judicious use of a shotgun.  (Just don't tell PETA or Uncle Sam.  In North America, American crows are protected by the Migratory Bird Treaty Act.   /CRY!!)  Dogs do a good job of keeping many varmints away.  (Which is why we domesticated dogs and cats to be our companions in the first place.)

Pesticides, fertilizers, lime and acidity are all things which you could add to a "can you feed your populace" simulation.  Invasive species and species incompatibility should be keep in mind as well.  For example, a walnut tree comes immediately to my mind, as my land is infested is thousands of the things.  There's a lot of acidity in raw, unhulled walnuts, and when they fall from the tree, they turn the soil around it acidic.  Any type of plant/grass that needs an alkaline base to grow good isn't going to grow near walnuts -- not without a lot of soil maintenance with adding lime to replenish the balance.
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #9 on: December 09, 2021, 03:12:13 pm »
@George McGinn
hey but Hammurabi cheats!
see here how this casual step over destroyed my project of long life!
  [ Invalid Attachment ]  
Quote
EDIT: You had almost 5,000 bushels in storage ??? (who's cheating?)
LOL  , no George I haven't cheated.
I don't like to win easily...

but as you can see from screenshot I have sold 300 acres (I remember at the price of 21 or 23 for acre) and of the starting 2800 bushels I have spent the more to save crops and cruelly the less to save citizens. (population 74 of those  15 migrants and 6 newborns...21 people joining the population in that year that rats take all my bushels!).
....
going out of joke...
as strategy game we start with 2800 bushels  100 citizens that need 20 bushel for each of theme = 2000 bushel for save 100 citizens...you can plant 100 acres using 3 bushel for acre so 300 bushels... so in perspective
100 citizens saved = 2000 bushels
800/3 = 266,666.... acres  that can be planted...--> if fortune kisses you, it is possible that you gain 5 bushel for acre harvesting  1330 bushels... and from here you must take away the food for rats and insects...
at the end you must choose to sacrifice some citizens... also selling at a good price some acres... (I sold at 21 or 23 bushels for acre  just 300 acres) your acres go down quickly and you need almost 700 to let survive 100 citizens (700 x 3 = 2100 bushels).

So at the start point Hammurabi has too many citizens and acres and few bushels.
If rats and insects can get all his bushels... from a strategy game IMHO it becomes a fortune game in with the case /fate draws the main line of the game.

Glad to talk about a strategy game so fine also if in textual state.
Programming isn't difficult, only it's  consuming time and coffee

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Modified (More Challenging) Version of the Original Hamurabi Game!
« Reply #10 on: December 09, 2021, 07:38:29 pm »
I was only joking about you cheating --- I figured you saved more in your stores, because the rats only eat what is stored, and not what comes out of the fields. That's the insects' job! But that you indeed were unlucky that year. I still have fine-tuning to do there. Be aware the original game knocks you down in status at the end if you do not maintain 10 acres per person!

I kind of figured when I added another way to deplete crops/harvests, I added disasters to try and mitigate the extra damages, giving the player twice as many ways to reduce the population, but I always knew that I would have to adjust the starting parameters, as I said or implied in my response to SMcNeill. In my notes on my research of the period, I have the actual population and size of land Hammurabi had at the start of his reign, and may start with that. The final version will have some chances or fate (being at the mercies of their gods!), with ways to help mitigate losses. But that period of time was a very perilous one. So some of that has to play into your future decision-making.

I had planned to, as in one of your posts, break up the population into the actual class-structure that existed back then. The five main classes were: The Ruling Class, Servant Class, Upper Class, Working Class, and Lower Class. Not everyone worked the land. The Servant Class was made up mainly of military members (Generals were in the Ruling Class), master craftsmen and palace/upper class servants, like cooks, etc.) I have three pages of a tree-diagram I created showing the hierarchy within each class. Not all will appear in the game, and I am still trying to figure out the ratio, as historical information about this is pretty vague, but I'll make it so the game is playable.

I do know how many people are needed to work a field, between the overseer to the oxen teams to field hands, it took at least 40 people to work one field (one field = 38.88 ha, or 96 acres, if my math is right that 1 hectare = 2.47 acres).

It will be a strategy game, one based on the real period 1800-1700 BCE, with the real dangers and gains. Besides making it enjoyable to play, I'd like to make it educational as well, so the more you play it, the greater knowledge you will gain from that period of time. A pretty tall order, but I love these kind of coding challenges.

Anything else you can think of, just let me know. I'm always open to suggestions and improvements. I'll probably have a rough program (the skeleton of the game engine) done by end of January next year, with some of these features working. It will use InForm for the GUI, to allow it to run on all platforms.


LOL  , no George I haven't cheated.
I don't like to win easily...

but as you can see from screenshot I have sold 300 acres (I remember at the price of 21 or 23 for acre) and of the starting 2800 bushels I have spent the more to save crops and cruelly the less to save citizens. (population 74 of those  15 migrants and 6 newborns...21 people joining the population in that year that rats take all my bushels!).
....
going out of joke...
as strategy game we start with 2800 bushels  100 citizens that need 20 bushel for each of theme = 2000 bushel for save 100 citizens...you can plant 100 acres using 3 bushel for acre so 300 bushels... so in perspective
100 citizens saved = 2000 bushels
800/3 = 266,666.... acres  that can be planted...--> if fortune kisses you, it is possible that you gain 5 bushel for acre harvesting  1330 bushels... and from here you must take away the food for rats and insects...
at the end you must choose to sacrifice some citizens... also selling at a good price some acres... (I sold at 21 or 23 bushels for acre  just 300 acres) your acres go down quickly and you need almost 700 to let survive 100 citizens (700 x 3 = 2100 bushels).

So at the start point Hammurabi has too many citizens and acres and few bushels.
If rats and insects can get all his bushels... from a strategy game IMHO it becomes a fortune game in with the case /fate draws the main line of the game.

Glad to talk about a strategy game so fine also if in textual state.
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)