-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathagent.h
More file actions
96 lines (87 loc) · 2.09 KB
/
Copy pathagent.h
File metadata and controls
96 lines (87 loc) · 2.09 KB
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
/*
* Project name: Food collection
* Version 4
* Student : Albert Eduard Merino Pulido
*/
#ifndef agent_h
#define agent_h
#include <cmath>
#include "strategy.h"
#include "particle.h"
using namespace std;
typedef struct Bullet {
Cell * position;
Direction direction;
bool enable;
Particle particle;
Bullet();
Bullet(Cell * position, Direction direction);
} Bullet;
class Agent {
public:
static int agentVelocity;
static int rotateVelocity;
static int bulletVelocity;
static void setVelocity(int);
Agent * agent;
// Constructors
Agent();
Agent(CellType, Strategy *);
// Getters
Direction getAction();
int getScore();
State getState();
bool isQuiet();
bool isMove();
bool isRotate();
bool getNeedAction();
Cell * getCurrentPosition();
Cell * getNextPosition();
Direction getDirection();
void draw();
// Setters
void setMap(Map * gameState);
void setPosition(Cell *);
void setPosition(CellType, Cell *);
void setDirection(Direction);
void setNextDirection(Direction);
void setAgent(Agent *);
// Methods
void goInitPosition();
void registerInitialState();
void initMovement(Direction, int);
bool integrate(long);
void moveBullet();
bool isCrashBullet();
void crashBullet();
void eat();
void move();
void move(Cell *);
Map observationFunction(Map state);
void final(Map state);
void crash();
Translation getTranslation(Direction);
bool isCrash();
bool isCrash(CellType agent, Cell * c1, Cell * c2);
float manhattanDistance(Cell *, Cell *);
void rotate();
void shoot();
bool canShoot();
void tryNextDirection();
Cell * getNextPosition(Direction, Cell *);
protected:
CellType cellType;
Cell * initPosition;
Strategy * strategy;
Map * gameState;
int score;
Cell * nextPosition;
Particle particle;
bool needRotate;
bool needAction;
Bullet bullet;
Direction lastDirection;
Direction currentDirection;
Direction nextDirection;
};
#endif // ifndef agent_h