forked from jogp10/GongasMaze
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobot.cpp
81 lines (71 loc) · 1.06 KB
/
Robot.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
//T02_G11
#include "Robot.h"
unsigned int Robot::robotCounter = 0;
/** Robot -> get info from robot's location
* @param row
* @param col
*/
Robot::Robot(unsigned int row, unsigned int col)
{
robotCounter++;
id = robotCounter;
this->row = row;
this->col = col;
}
/**
* setMove -> move robot
* @param movement
*/
void Robot::setMove(const Movement& movement)
{
this->row += movement.dRow;
this->col += movement.dCol;
}
/**
* setDead -> robot is now dead
*/
void Robot::setDead()
{
live = false;
}
/**
* getID -> get robot's id
* @param symbol
*/
unsigned int Robot::getId() const
{
return id;
}
/**
* getRow -> get robot's row
* @return
*/
unsigned int Robot::getRow() const
{
return row;
}
/**
* getCol -> get robot's col
* @return
*/
unsigned int Robot::getCol() const
{
return col;
}
/**
* getSymbol -> get robot's symbol
* @return
*/
char Robot::getSymbol() const
{
if(live) return 'R';
else return 'r';
}
/**
* getLive -> get robot's live
* @return
*/
bool Robot::getLive() const
{
return live;
}