-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimal.cpp
115 lines (90 loc) · 1.41 KB
/
animal.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <bits/stdc++.h>
#include <random>
#include "animal.hpp"
Animal::Animal()
{
aId = -1;
aType = Espece::rien;
}
Animal::Animal(int id, Espece type, Coord coord)
{
aId = id;
aType = type;
aCoord = coord;
}
int Animal::getId() const
{
return aId;
}
Coord Animal::getCoord() const
{
return aCoord;
}
void Animal::setCoord(Coord c)
{
aCoord = c;
}
Espece Animal::getEspece() const
{
return aType;
}
string Animal::toString() const
{
switch(aType)
{
case Espece::lapin:
return "L";
case Espece::renard:
return "R";
default:
return " ";
}
}
int Animal::getMinFreeBirthLapin() const
{
return MinFreeBirthLapin;
}
int Animal::getProbReproLapin() const
{
return ProbReproLapin;
}
int Animal::getFoodInit() const
{
return FoodInit;
}
void Animal::setFoodInit(int i)
{
FoodInit = i;
}
int Animal::getFoodLapin() const
{
return FoodLapin;
}
int Animal::getFoodReprod() const
{
return FoodReprod;
}
int Animal::getMaxFood() const
{
return MaxFood;
}
int Animal::getProbBirthRenard() const
{
return ProbBirthRenard;
}
bool operator==(Animal a1, Animal a2)
{
return a1.getId() == a2.getId() and a1.getCoord() == a2.getCoord() and a1.getEspece() == a2.getEspece();
}
int Animal::getAge() const
{
return age;
}
int Animal::getMaxAge() const
{
return maxAge;
}
int Animal::aged()
{
age = age + 1;
}