Congratulations, you are the newest leader of ancient Chaco Canyon, 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 infestations and the drought! Maize is the general currency, measured in bushels. The following will help you in your decisions: - Each person needs at least 20 bushels of maize per year to survive. - Each person can farm at most 10 acres of land. - It takes 2 bushels of maize 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!
Values When you implement your ChacoCanyonSimulation class, you will require instance variables to capture the state of Chaco Canyon. The following provides the initial values for your instance variables.
You should think of your simulation as a big loop. On each iteration of your loop, you will ask the user the above questions, which provide the input parameters for a method described in the next section. The following shows the initial state message followed by three questions. The printout will occur each year, with the state information changing based on the leaders decisions.
O great Chaco Leader, I beg to report to you, In the year 1000, 0 people starved to death, 0 people left our nation, 0 people entered our nation. The population is now 100. The nation now owns 1000 acres. We harvested 3000 bushels at 3 bushels per acre. Rats destroyed 0 bushels, leaving 3000 bushels in storage. Land is currently worth 20 bushels per acre. How many acres do you wish to buy? 10 How many acres to you wish to sell? 0 How many bushels of maize do you wish to feed your people? 2000 How many acres do you wish to plant with seed? 400
A player who is buying land is not allowed to sell land during the same year. Make sure you do a sanity check of all player input. For example, you cannot plant 1000 acres when you only have 204 bushels of maize.
At the end (either after 10 years or failure), print out a final summary, and tell the player how good a job he/she did. The details are up to you, but the usual evaluation is based on how many people starved, and how many acres per person you end up with.
When you simulate a year in Chaco Canyon, your simulation algorithm with use as input the current state defined by your instance variables and the four input parameters collected from the user:
Current State: year, population, acres of land, value of land, maize in storage.
Input Parameters: acres to buy, acres to sell, maize to feed, acres to plant.
The computational attributes of your simulation algorithm are defined by the following.
If more than 45% of the people die or leave (either via this Starvation of via Drought) you will be immediately thrown out of office. For the initial values provided above, this means if your population dips below 55, you will be thrown out of office. In that case print some harsh message and exit the program.
$(\frac{20 \times acres + grain}{100 \times population} + 1) \times P$
Where $P$ is a random floating point number between 0 and 1. This can be produced by the "nextDouble" function of the Random class. However, only a whole number person can come to the city (you cannot have 2.5 people arriving into the city).
All computations should use doubles for intermediate values, but ultimately produce integers.
Congratulations, you are the newest leader of ancient Chaco Canyon, 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 infestations and the drought! Maize is the general currency, measured in bushels. The following will help you in your decisions: * Each person needs at least 20 bushels of maize per year to survive. * Each person can farm at most 10 acres of land. * It takes 2 bushels of maize 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! O great Chaco Leader, I beg to report to you, In the year 1000, 0 people starved to death, 0 people left our nation, 0 people entered our nation. The population is now 100. The nation now owns 1000 acres. We harvested 3000 bushels at 3 bushels per acre. Rats destroyed 0 bushels, leaving 3000 bushels in storage. Land is currently worth 20 bushels per acre. How many acres do you wish to buy? 10 How many bushels of maize do you wish to feed your people? 2000 How many acres do you wish to plant with seed? 400 O great Chaco Leader, I beg to report to you, In the year 1001, 0 people starved to death, 0 people left our nation, 5 people entered our nation. The population is now 105. The nation now owns 1010 acres. We harvested 1600 bushels at 4 bushels per acre. Rats destroyed 100 bushels, leaving 1500 bushels in storage. Land is currently worth 21 bushels per acre. How many acres do you wish to buy? 0 How many bushels of maize do you wish to feed your people? 1200 How many acres do you wish to plant with seed? 1000 O honorable leader, Think again, You only have 300 bushels of maize. Now then, How many acres do you wish to plan with seed? 150 O great Chaco Leader, I beg to report to you, In the year 1002, 40 people starved to death, 0 people left our nation, 0 people entered our nation. The population is now 60. The nation now owns 1010 acres. We harvested 750 bushels at 150 bushels per acre. Rats destroyed 0 bushels, leaving 750 bushels in storage. Land is currently worth 20 bushels per acre. ...
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.