-
Notifications
You must be signed in to change notification settings - Fork 0
/
robot_object.h
44 lines (30 loc) · 864 Bytes
/
robot_object.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
#ifndef ENTITY_ROBOT_OBJECT_H_
#define ENTITY_ROBOT_OBJECT_H_
#include "base_object.h"
#include "direction.h"
namespace toyrobot {
class RobotObject : public BaseObject {
public:
RobotObject() : BaseObject() {
type_ = kRobotType;
}
RobotObject(const Coordinates& position, const Direction& facing)
: BaseObject(position, kRobotType), facing_(facing) {}
RobotObject(const RobotObject &r)
: BaseObject(r), facing_(r.facing_) {}
Coordinates GetMovePosition() override;
void Move() override;
void TurnLeft() override;
void TurnRight() override;
string Report() override;
protected:
Direction facing_;
};
inline void RobotObject::TurnLeft() {
facing_.TurnLeft();
}
inline void RobotObject::TurnRight() {
facing_.TurnRight();
}
} // namespace toyrobot
#endif // ENTITY_ROBOT_OBJECT_H_