Next, let's describe the islands our animals will live on. Each island here is an isolated system that tracks all the changes, including the death and birth of all the animals, ever-changing conditions, and so on. For our purposes, these islands will also need to collect stats on the animals.
Let's start small by defining attributes of each island:
- A list of animals currently living on the island
- Current year (turn)
- Maximum population cap (integer)
- Umbrella object for all the statistics
The preceding attributes are defined in the following code snippet:
class Island: stats = dict() animals = list() max_pop, year = 0, 0 def __init__(self, initial_pop=10, max_pop=2500): self.year = 0 self.max_pop = max_pop self.stats ...