-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldAnalysis.cpp
More file actions
43 lines (42 loc) · 875 Bytes
/
FieldAnalysis.cpp
File metadata and controls
43 lines (42 loc) · 875 Bytes
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
#include "utils.h"
class FieldAnalysis
{
public:
FieldAnalysis();
~FieldAnalysis();
//Defense Calculator
//Team Closest To The Ball
bool iSBallWithTeamYellow(){
bool ret = true;
int dist1 = INF,dist2 = INF;
for(int i=0;i<8;i++){
dist1 = min(dist1,getDistance(yellow_bot[i],ball));
dist2 = min(dist2,getDistance(blue_bot[i],ball));
}
ret = dist1 < dist2;
return ret;
}
//Ball Possession ID
int BallPossessionId(){
int id = 0,dist = INF;
if(iSBallWithTeamYellow){
for(int i=0;i<8;i++){
if(getDistance(yellow_bot[i],ball) < dist){
dist = getDistance(yellow_bot[i],ball);
id = i;
}
}
}
else{
for(int i=0;i<8;i++){
if(getDistance(blue_bot[i],ball) < dist){
dist = getDistance(yellow_bot[i],ball);
id = i;
}
}
}
return id;
}
//Offense Points Carrier
//Offense Points receiver
};