-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.h
50 lines (48 loc) · 1.14 KB
/
robot.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
50
//
// Created by xinya on 2024/3/8.
//
#ifndef HARBOR_MANAGER__ROBOT_H_
#define HARBOR_MANAGER__ROBOT_H_
#include <iostream>
#include "position.h"
#include "constant.h"
#include "map_object.h"
struct Robot : MapObject {
enum RobotStatus {
kGoingToLoad,
kGoingToUnload,
};
int dir{kStay};
int goods_id{-1};
int berth_id{-1};
Robot()=default;
Robot(int id,int x,int y) : MapObject{id,kGoingToLoad,Position{x,y}} {
}
void PrintMove() {
std::cout << "move " << this->id << " " << dir << std::endl;
}
void PrintLoad() {
std::cout << "get " << this->id << std::endl;
}
void PrintUnload() {
std::cout << "pull " << this->id << std::endl;
}
void Refresh() {
this->status = kGoingToLoad;
this->dir = kStay;
this->goods_id = -1;
this->berth_id = -1;
}
void Show() {
fprintf(stderr,
"Robot %d: (%d, %d) status: %d, goods_id: %d, berth_id: %d dir:%d\n",
this->id,
this->position.x,
this->position.y,
this->status,
this->goods_id,
this->berth_id,
this->dir);
}
};
#endif //HARBOR_MANAGER__ROBOT_H_