-
Notifications
You must be signed in to change notification settings - Fork 16
/
Agent.cs
44 lines (38 loc) · 1.01 KB
/
Agent.cs
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
using System;
namespace mapf;
[Serializable] public class Agent
{
public int agentNum;
public Move Goal; // TODO: Make it a coordinate
public Agent(Agent a)
{
agentNum = a.agentNum;
Goal = new Move(a.Goal);
}
public Agent(int Goal_X, int Goal_Y, int agentNum)
{
this.agentNum = agentNum;
Goal = new Move(Goal_X, Goal_Y, Move.Direction.NO_DIRECTION);
}
public override string ToString()
{
return $"Agent-{agentNum} Goal-{Goal}";
}
public override bool Equals(object other_obj)
{
if (other_obj == null)
return false;
Agent other = (Agent)other_obj;
return agentNum == other.agentNum && Goal.Equals(other.Goal);
}
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + agentNum;
hash = hash * 23 + Goal.GetHashCode();
return hash;
}
}
}