Question: Problem 3 ( 30 points). Write the code for this problem in a file named p3_Lastname_Firstname.py, as required above. Take the prey-predator problem described in

 Problem 3 ( 30 points). Write the code for this problemin a file named p3_Lastname_Firstname.py, as required above. Take the prey-predator problem

Problem 3 ( 30 points). Write the code for this problem in a file named p3_Lastname_Firstname.py, as required above. Take the prey-predator problem described in Chapter 13 and add humans. Start from file program1314.py, attached to the assignment page. A human is an animal that kills and eats predators, and also moves and breeds like an animal. Humans do not kill prey. Here are the detailed rules pertaining to humans: - A Human object moves like an Animal object on the island grid. - A Human object does not kill prey, in contrast to predators. - A Human object eats 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_grid(), the Human will move to its cell and remove the Predator from the island, in the same way Predators eat Prey objects. 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_animals() should take each an extra parameter count_humans and init_animals 0 should position Human objects at random positions. - A method count_humans() that returns the number of Human objects on the grid. The main() 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. - Stop the simulation only when all three populations converge to constant values or after a maximum of 1000 time units. - Display at the end with matplotlib 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: 1. 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. 2. Use the object-oriented design process. Integrate class Human smoothly into the existing design and code. 3. Print a Human object on the Island grid with character ' H '. 4. Apply the proper coding style and techniques taught in this class. 5. Write docstrings for functions and comment your code following the guidelines from the textbook. 6. Run the program with different combinations of parameters and find an interesting case. 7. Take a screenshot with the matplotlib chart showing the evolution of the three populations vs. time. Insert this screenshot in the Word document. This chart looks like that on slide 46 in the Chapter 13 lecture notes PDF flle. 8. Take a screenshot with the terminal showing the island grid printout (first tick and last tick) + any other statistics displayed in main(). Insert this screenshot in the Word document

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!