Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programming Problem 1. Prey-Predators-Humans Problem Take the prey-predator problem described in Chapter 13 and add humans. Use the file program13- 14.py, attached to the

python programming

image text in transcribed

image text in transcribed

image text in transcribed

Problem 1. Prey-Predators-Humans Problem Take the prey-predator problem described in Chapter 13 and add humans. Use the file program13- 14.py, attached to the assignment page A human is a predator that eats prey. It also moves, breeds like an Animal, and kills predators (e.g. to keep prey for humans or for fun). Here are the detailed rules pertaining to humans: 1. A Human object moves like an Animal object on the island grid. 2. A Human object eats Prey just like a Predator object, with starving time given by a Human.starve time class attribute, initialized in main0. A Human object breeds like an Animal object, with the breeding period given by a Human.breed time class attribute, initialized in main0. 3. 4. A Human object hunts Predator objects periodically. Every Human.hunt time clock ticks (starting with the Human object's creation time), if a Predator is in a neighboring cell (using check_grid0), the Human will move to its cell and remove the Predator from the island, in the same way Predators eat Prey objects. All other rules for Prey and Predators remain in effect. We want to study the impact of humans on the island animal populations. Add the following to the Island class: Proper initialization for Human objects. The constructor and init_animals0 should take each an extra parameter count_humans and init_animals0 should position Human objects at random positions. *A method count humans) that returns the number of Human objects on the grid. The mainO method should: Take extra parameters for the Human class attributes described above and should properly initialize them. Keep track of the Human population for each clock tick in the same ways it's done for Predator and Prey objects. NOT stop the simulation if Human objects or Predator get extinct, but only when Prey dissapear Display at the end with pylab the evolution in time of the Prey, Predator, and Human populations. Display the island grid to the terminal, at the beginning and at the end of the simulation. More requirements: Add a Human class to the existing class hierarchy so that code is properly reused. Use the problem description above to decide what class is Human's superclass. Use the object-oriented design process. Integrate class Human smoothly into the existing design and code No copy-pasted code from other classes is allowed in class Human. Print a Human object on the Island grid with character 'H Apply the proper coding style and techniques taught in this class. Write docstrings for functions and comment your code following the guidelines from the textbook. 1. 2. 3. 4. 5. 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

=+4. Are there areas where you are seeing healing take root?

Answered: 1 week ago

Question

=+2. What are some of your racialized triggers?

Answered: 1 week ago

Question

=+4. Who could serve as your healing advisor?

Answered: 1 week ago