-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gene.h
49 lines (46 loc) · 1.58 KB
/
Gene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef GENE_H
#define GENE_H
//!Ãåíîì ñîçäàíèÿ
struct Gene
{
Gene(int lifeExpectancy, int lifeWitoutFood, int reproductionPeriod, int rangeOfVision, int hungerLimit, int speed)
: lifeExpectancy(lifeExpectancy), lifeWitoutFood(lifeWitoutFood), reproductionPeriod(reproductionPeriod), rangeOfVision(rangeOfVision),
hungerLimit(hungerLimit), speed(speed) {};
Gene(LifeType type)
{
if (type == LifeType::PLANKTON)
{
lifeExpectancy = 550;
lifeWitoutFood = 600;
reproductionPeriod = 35;
rangeOfVision = 5;
hungerLimit = 0;
speed = 0.9;
}
else if (type == LifeType::CARNIVOREFISH)
{
lifeExpectancy = 1500;
lifeWitoutFood = 850;
reproductionPeriod = 180;
rangeOfVision = 70;
hungerLimit = 650;
speed = 0.6;
}
else // herbivore fish
{
lifeExpectancy = 950;
lifeWitoutFood = 470;
reproductionPeriod = 55;
rangeOfVision = 100;
hungerLimit = 350;
speed = 1.1;
}
};
int lifeExpectancy; //!< ïðîäîëæèòåëüíîñòü æèçíè
int lifeWitoutFood; //!< ñêîëüêî ìîæåò æèòü áåç åäû
int reproductionPeriod; //!< ïåðèîä ðàçìíîæåíèÿ (êàæä 2 äíÿ ïëàíêòîí äåëèòñÿ, à ðûáà ïëûâåò ê äðóãîé, ÷òîáû ðàçìíîæèòüñÿ)
int rangeOfVision; //!< äàëüíîñòü çðåíèÿ ðûáû (êàê äàëåêî âèäèò âîêðóã)
int hungerLimit; //!< ãðàíèöà ãîëîäà (âûøå - î÷åíü ïëîõî!!)
double speed; //!< ñêîðîñòü ïåðåìåùåíèÿ
};
#endif //! GENE_H