Paper Writing Services ant should be created. step() proceeds the simulation by one turn, and handles the automatic behaviour of the colony. Namely, ts method

Abstract
If there is insufficient food, a message should be printed to the user and no ant should be created. step() proceeds the simulation by one turn, and handles the automatic behaviour of the colony. Namely, ts method will control the behaviour of each ant in the colony. Each turn each ant should eat one food from the colony’s

You are going to create a simulated ant colony, in wch the user will take the role of the queen who’s duty it will be to manage the health of the colony. The simulation will proceed in a turn-based fason, where each turn the user can choose to spend precious food resources on more ants. Begin by creating two classes: Colony and Ant. The Colony class will maintain an array of worker ants (initially empty with room for 100 ants), an amount of food (initially 10), and 3 methods: breedWorker(), step(), and purge(). breedWorker() creates a new Ant and adds it to the colony’s list of worker ants. Creating a worker costs 5 of the colony’s food. If there is insufficient food, a message should be printed to the user and no ant should be created. step() proceeds the simulation by one turn, and handles the automatic behaviour of the colony. Namely, ts method will control the behaviour of each ant in the colony. Each turn each ant should eat one food from the colony’s food supply. If there is not enough food, the ant will lose one point of health instead. All dead ants should then be purged from the colony. Lastly, each ant will then forage for food (described below), and any food found will be added back into the colony’s food supply. Note: All ants should eat before any ants are purged. purge() scans the list of worker ants, and any ants with 0 health are removed from the list. For each dead ant add 1 to the food supply, because ants recycle! Also, notify the user that an ant has died. (Note, see tutorial 4 for an idea of how to do ts). The Ant class will have a health (initially set to 10), and a forage() method. forage() determines randomly the luck an ant has wle out searcng for food each turn. There is a 10% chance that the ant dies in a horrible accident (health = 0, return no food) There is a 35% chance that the ant finds food. The amount found should be a random number between 1 and 5. There is a 50% chance that the ant finds no food. And there is a 5% chance that the and finds sweet nectar! Her health is replenished (i.e., set to 10) and she brings back 10 food to the colony! The results of each ant’s foraging should be both printed for the user and returned to update the colony’s supply. Finally, you will need to write a main() method to start the simulation and repeatedly prompt the user for their choices. Ts can be placed in the Colony class or in its own class. Each turn the user should be prompted with the current state of the colony (number of ants, and food supply). A menu should be displayed with two options: to breed a new worker (for a cost of 5 food), or do notng (no new ants for a cost of 0 food). Your code should check the user’s input for errors and ask again if it was invalid. Following the user’s action (breed or not), the colony will take one simulation step as described above. Simulation should repeat like ts until the colony is out of both ants and enough food to make more ants. E.g. (interactions): ================================================= Your colony has 0 ants and 10 food, Your Majesty. What would you like to do? 0. Do notng 1. Breed worker (costs 5 food) > 1 Breeding worker… Step results: Ant finds 5 food. ================================================= Your colony has 1 ants and 9 food, Your Majesty. What would you like to do? 0. Do notng 1. Breed worker (costs 5 food) > 1 Breeding worker… Step results: Ant returns empty handed. Ant finds 1 food. ================================================= Your colony has 2 ants and 3 food, Your Majesty. What would you like to do? 0. Do notng 1. Breed worker (costs 5 food) > 1 Your colony doesn’t have enough food to breed a worker! Step results: Ant finds 4 food! Ant returns empty handed. ================================================= Your colony has 2 ants and 5 food, Your Majesty. What would you like to do? 0. Do notng 1. Breed worker (costs 5 food) > 0 Step results: Ant returns empty handed. Ant finds 4 food! ================================================= Your colony has 2 ants and 7 food, Your Majesty. What would you like to do? 0. Do notng 1. Breed worker (costs 5 food) >

Sample references
  • (‘Institute of Medicine. Leadership Commitments to Improve Value in Health Care: Finding Common Ground: Workshop Summary;National Academies Press: Washington, DC, USA, 2009; ISBN 978-0-309-11053-2.’,)
  • (‘Baker, D. J., R. W. Schmitt, and C. Wunsch. 2007. Endowments and new institutions for long-term observations. Oceanography 20(4):10-14.’,)
  • (‘Knowles, N., M. D. Dettinger, and D. R. Cayan. 2006. Trends in snowfall versus rainfall in the western United States. Journal of Climate 19(18):4545-4559.’,)
  • (‘Engle, N. L., and M. C. Lemos. 2010. Unpacking governance: Building adaptive capacity to climate change of river basins in Brazil. Global Environmental Change 20(1):4-13.’,)

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer