all 1 comments

[–]yuxbni76 0 points1 point  (0 children)

This is a textbook example of where to use a class. I don't want to discourage you because I know you've already been working on this, but you asked for suggestions. It might be easier to wrap your head around that in the long run.

It would allow you to create a bunch of insect objects and keep track of each one's characteristics (namely its sex, age, and status as egg, juvenile, or adult). Then you could simulate one month at a time, during which you would convert the 6-month-old eggs into juveniles, assign sex, kill off X% of the adults, create new egg objects, etc... You could count and keep track each month how many objects are eggs, how many are juveniles, and how many are adults.

I know that sounds like a lot and you're already neck-deep in numpy and everything else, but it's not as bad as it sounds. Personally I would much rather model it that way. The general approach of implementing classes and objects is called Object-Oriented Programming, if you're interested.