Hammurabi

(Analysis by Jaxon Simmons)

The Rules:

1. The game lasts 10 years, with a year being one turn.

2. Each year, enter how many bushels of grain to allocate buying (or selling) acres of land, feeding your population, and planting crops for the next year.

3. Each person needs 20 bushels of grain each year to live and can till at most 10 acres of land.

4. Each acre of land requires one bushel of grain to plant seeds.

5. Each year, there is a random chance that a plague happens killing half of your population, or rats infest your stores and eat a random number of bushel.

6. Additionally, each year there is a random chance that new people come to the city in random amounts. Also the amount of bushels generated from planting crops should be random as well.

7. The price of each acre of land fluctuates from 17 bushels per acre to 26 bushels.

8. If the conditions in your country ever become bad enough (half of your population starves in a year), the people will overthrow you and you won't finish your 10 year term.

9. If you make it to the 11th year, your rule will be evaluated and you'll be ranked against great figures in history.
 
 

The Basic Strategy:

1. Start with trying to feed all, or most, of your population 20 bushels of grain per person

2. Try to plant seeds on all of your land, assuming you have enough people and enough grain.

3. Last, if you have grain remaining, you might spend some buying additional acres of land, especially if the price is right. If you didn't have enough grain for food and seed, you may need to sell some of your land, hopefully, at a good price.

Along the way, you'll deal with famine, plagues, fluctuating crop yields and varying prices for land. The object of the game is to last 10 years to the end of your term and to leave the city better off than how you found it. Leaders are evaluated based on how many people starved during one's leadership, and how much land per person remains after the end of the 10 year term.
 
 

Overview

Set initial variables.

Display year 1 message and current state of city.

While loop that loops for 10 years:

Within While loop:
 Calculate resources.
 Inform player of state of city and take input.
 Increment year variable.
 At year 10; judge player and ask if they want to play again.
 Repeat.

Your code will likely feature a while loop that checks whether the year variable is equal to 10, (after 10 years, your program judges the player how well they commanded their city).
 

First draft, 2023 April 11