To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

animal.hpp 794 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "genome.hpp"

class Animal {

    public:
        Animal() {}; // constructor that initializes the genome sequence
        static int counter; // count the animals alive ~ population 
        ~Animal() {}; // destructor when an animal dies
        void give_birth(); // have a child (only one is allowed)
        void prob_life(); // after the threshold, an individual is alive only with a certain probability
    private:
        Genome sequence();
        int mutation_rate; // mutation rate that determines how many bits are gonna change for the child
        int reproduction_age; // minimum age to have a child
        int life_threshold; // threshold for mutations allowed before death risks
        int max_population; // maximum numbers of individuals in the population
    
};