-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfood.cpp
More file actions
42 lines (34 loc) · 793 Bytes
/
food.cpp
File metadata and controls
42 lines (34 loc) · 793 Bytes
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
#include "food.h"
Food::Food()
{
foodPosition[xCor] = randomNumberGetter.get_random_number(foodGridSpacer,randomNumberRange);
foodPosition[yCor] = randomNumberGetter.get_random_number(foodGridSpacer,randomNumberRange);
}
Food::Food(double xCoordinate, double yCoordinate)
{
foodPosition[xCor] = xCoordinate;
foodPosition[yCor] = yCoordinate;
}
double Food::get_y_coordinate() const
{
return foodPosition[yCor];
}
double Food::get_x_coordinate() const
{
return foodPosition[xCor];
}
Eigen::Vector2d Food::get_position() const
{
return foodPosition;
}
int Food::get_strength()
{
return foodStrength;
}
void Food::decrement_food()
{
if (foodStrength > 0)
{
foodStrength = foodStrength - 1;
}
}