Hammurabi Game Online

'>

Kongregate free online game Hamurabi Reloaded - The classic city building game Hamurabi, upgraded with upgrades. (I realize Hammurabi is miss. Play Hamurabi Reloaded.

A port of the classic 1968 resource management sim.

This port is adapted from the 1973 BASIC version port.

Rules

You must manage the resources of a region of Ancient Sumeria for 10 consecutive years.

You must make 3 decisions per round:

  1. How much land to buy or sell.
  2. How much grain (or bushels) to feed your people.
  3. How many acres of land to plant seed in.

Two Ways To Play

  • Easy Mode - Rules Are Explained
  • Tough Mode - Rules Must Be Discovered By Trial And Error.

Hammurabi is a cool management game with a twist – you are the mighty King Hammurabi and you must manage the ancient city of Babylon and guide its ambitious ministers. This game of decisions is challenging and you must first choose your three ministers – a minister of agriculture (who oversees the production of crops), a minister of territory (who directs your armies) and a minister of. Kebab World - Chef Kitchen Restaurant Cooking Game. Have a delicious journey across Turkey! Develop your restaurant cooking game skills through an epic exploration of traditional Turkish food cuisine in this time-management game. Prepare, cook, serve and satisfy your customers, keep them happy in your world kitchen to earn more coins and diamonds!

Credits

  • Original Author (1968) : Doug Dyment
  • BASIC Port (1973) : David Ahl (printed in BASIC Computer Games, 1973).
  • Adventuron Port (2019) : Chris Ainsley.
  • New Graphics (2019) : Steve Horsley
  • Mode Seven Font : Andrew Bulhak.

About Hamurabi (Wikipedia):

https://en.wikipedia.org/wiki/Hamurabi_(video_game)

https://en.wikipedia.org/wiki/BASIC_Computer_Games

Code adapted from the BASIC Port by David Ahl:

Video Interview With David Ahl:

https://archive.org/details/DigibarnBasic-computer-games-by-david-ahl

Hammurabi Game Online

Initial Release

1.0.0 - Initial Release - 13th March 2019.

StatusReleased
PlatformsHTML5
Rating
AuthorAdventuron
GenreStrategy
TagsManagement, Retro, Text based

Download

Log in with itch.io to leave a comment.

Hey, I love the aesthetics of your remake!

Is there a way to download your games (I'm a bit old-fashioned and like my games offline, so I'd really love to download your three games).

I have added an offline version to the page. I'll add offline versions of the other games a little later on.

CIT 591 Assignment 3: Hammurabi
Fall 2010, David Matuszek

  • To get you started using Java.

Hammurabi is a very old computer game. Your job is to bring it into the 21st century by writing it in Java.

Here are the standard instructions for the game:

Congratulations, you are the newest ruler of ancient Samaria, elected for a ten year term of office. Your duties are to dispense food, direct farming, and buy and sell land as needed to support your people. Watch out for rat infestiations and the plague! Grain is the general currency, measured in bushels. The following will help you in your decisions:

  • Each person needs at least 20 bushels of grain per year to survive
  • Each person can farm at most 10 acres of land
  • It takes 2 bushels of grain to farm an acre of land
  • The market price for land fluctuates yearly

Rule wisely and you will be showered with appreciation at the end of your term. Rule poorly and you will be kicked out of office!

Define a single class named Hammurabi. Use the following skeleton (but leave out the // comments):

Here is what you start the game with:

  • 100 people
  • 2800 bushels of grain in storage
  • 1000 acres of land
  • Land value is 19 bushels/acre

Each year, print out a summary similar to the following:

The above summary represents the initial state, at the beginning of the first year--that is, when you first take office, and before you do any of the computations below). So, for example, the previous year (under a different ruler) must have started with 95 people; none starved, and 5 entered the kingdom, so as you enter office you rule 100 people.

Here's what your playGame method needs to do each year, for up to 10 years:

Ask the player the following questions. These questions should be asked in this order. Do not give the player a chance to 'back up' and change a previous answer. Each question should be asked in a separate method, and the answer returned as the value of the method, as specified below:

int askHowManyAcresToBuy(int price, int bushels)
Asks the player how many acres of land to buy, and returns that number. You must have enough grain to pay for your purchase.

int askHowManyAcresToSell(int acresOwned)
Asks the player how many acres of land to sell, and returns that number. You can't sell more than you have.
Do not ask this question if the player is buying land; it doesn't make sense to do both in one turn.

int askHowMuchGrainToFeedPeople(int bushels)
Ask the player how much grain to feed people, and returns that number. You can't feed them more grain than you have. You can feed them more than they need to survive.

int askHowManyAcresToPlant(int acresOwned, int population, int bushels)
Ask the player how many acres to plant with grain, and returns that number. You must have enough acres, enough grain, and enough people to do the planting. Any grain left over goes into storage for next year.

For each question, do 'sanity checking'; that is, test whether the answer is possible (you have enough grain, you have enough people to do the planting etc.), and keep asking until you get a possible value. (For example, O Great Hammurabi, surely you jest! We have only 3415 bushels left!)

Then the method needs to determine:

  1. If there is a plague, and how many people die from it.
  2. How many people starved.
  3. How many people came to the city.
  4. How good the harvest is.
  5. If you have a problem with rats, and how much grain they eat.
  6. How much land costs (for deciding what to do next).

These can all be local variables of your playGame method.

Use the following methods, in this order, to make the necessary calculations:

int plagueDeaths(int population)
Each year, there is a 15% chance of a horrible plague. When this happens, half your people die. Return the number of plague deaths (possibly zero).

int starvationDeaths(int population, int bushelsFedToPeople)
Each person needs 20 bushels of grain to survive. If you feed them more than this, they are happy, but the grain is still gone. You don't get any benefit from having happy subjects. Return the number of deaths from starvation (possibly zero).

boolean uprising(int population, int howManyPeopleStarved)
Return true if more than 45% of the people starve. (This will cause you to be immediately thrown out of office, ending the game.)

int immigrants(int population, int acresOwned, int grainInStorage)
Nobody will come to the city if people are starving (so don't call this method). If everyone is well fed, compute how many people come to the city as: (20 * number of acres you have + amount of grain you have in storage) / (100 * population) + 1.

int harvest(int acres, int bushelsUsedAsSeed)
Choose a random integer between 1 and 6, inclusive. Each acre that was planted with seed will yield this many bushels of grain. (Example: if you planted 50 acres, and your number is 3, you harvest 150 bushels of grain). Return the number of bushels harvested.

int grainEatenByRats(int bushels)
There is a 40% chance that you will have a rat infestation. When this happens, rats will eat somewhere between 10% and 30% of your grain. Return the amount of grain eaten by rats (possibly zero).

int newCostOfLand()
The price of land is random, and ranges from 17 to 23 bushels per acre. Return the new price for the next set of decisions the player has to make. (The player will need this information in order to buy or sell land.)

Do these computations, in this order, for each of ten years. Each computation should be done in a separate method, and none of these methods should read anything or print anything. Since most methods change the amount of grain available, you will need to keep this information in a variable so it is available to the next method that needs it.

When the computations are finished, call a method printSummary to print the summary for the year. This method will take several parameters.

When the game ends , use a method finalSummary to print out a final summary, and to tell the player how good a job he/she did. I'll leave the details up to you, but the usual evaluation is based on how many people starved, and how many acres per person you end up with.

Your playGame method will be quite long, but very straightforward; it does very little but call other methods.

Hammurabi Game Online Full

All the required arithmetic in this program should be integer. You do not need doubles.

I suggest that you first get the simplest possible version of the program running and tested out (that is, leave out things like rats, plagues, and immigration), then add these things one at a time to a working program, testing as you go.

Random numbers

To get a random number generator, you first need to import java.util.Random (or java.util.*). Then, you can create a random number generator with a statement such as:

static Random rand = new Random();

Hammurabi

To get a new random number in the range 0..n-1, where n is an int, call rand.nextInt(n). To get a new random number in the range min..max, use the expression rand.nextInt(max - min + 1) + min. You can use the rand method in statements such as

myNewNumber = rand.nextInt(5);
if (rand.nextInt(100) < 15) { ... }

To do something that happens p percent of the time, use

if (rand.nextInt(100) < p) { ...do something... }

See Full List On Mobygames.com

Getting input

To get a number from the player, add this method to your program:

Here is an example of how you can use this method:

sell = getNumber('O great Hammurabi, how many acres shall you sell?');

  • Project name: Hammurabi
  • Package name: hammurabi
  • Class names and method signatures:
    • class Hammurabi
      • public static void main(String[] args)
      • Numerous other methods, as described above.

The above are requirements. The methods that do calculations, not input/output, will be tested by my test methods, so be sure to get the spelling, capitalization, and number and types of arguments correct (argument names are irrelevant). You may have additional methods if you wish.

Thursday, October 21, before midnight. Turn in your zipped assignment via Blackboard. Email submissions will incur the wrath of Hammurabi (and won't be graded).