-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAgent.hpp
40 lines (30 loc) · 1.05 KB
/
Agent.hpp
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
#pragma once
#include "heuristic.hpp"
#include "porting.hpp"
using namespace porting;
class Agent
{
/**
* An agent is defined by its x and y initial coordinates in the grid, and
* a goal position in the grid. An agent can calculate is own heuristic.
* An agent also has a label, for identification
*/
public:
Agent(int x, int y, int gx, int gy, string l): X(x), Y(y),
goalX(gx), goalY(gy), label(l){};
int getX() const { return X; };
int getY() const { return Y; };
int getGoalX() const { return goalX; };
int getGoalY() const { return goalY; };
string getLabel() const { return label; };
void setX(int x) { X = x; };
void setY(int y) { Y = y; };
/* Returns agent's heuristic h value */
int getH() const { return heuristic::h(X, Y, goalX, goalY); };
bool operator == (const Agent &a)const;
void show() const;
private:
int X, Y;
int goalX, goalY;
string label;
};