-
Notifications
You must be signed in to change notification settings - Fork 0
/
coordfix.h
184 lines (142 loc) · 3.89 KB
/
coordfix.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#ifndef COORDFIX_H
#define COORDFIX_H
#include "Strategy.h"
using namespace std;
using namespace model;
class CoordFix {
public:
CoordFix();
CoordFix(double width, double height, bool isOnLeft);
void setInvY(bool invcY);
bool isInvY() const;
double invcY(double y) const;
double fixX(double x) const;
double fixY(double y) const;
double fixAngle(double angle) const;
double fixDx(double dx) const;
double fixDy(double dy) const;
double fixDAngle(double dAngle) const;
private:
double _w;
double _h;
bool _isOnLeft;
bool _invY;
double invcX(double x) const;
double invcAngle(double angle) const;
double invcDx(double dx) const;
double invcDy(double dy) const;
double invyAngle(double angle) const;
double invyDAngle(double dAngle) const;
};
//
class MoveF {
public:
MoveF();
MoveF(Move* m, const CoordFix* fix);
double getSpeedUp() const;
void setSpeedUp(const double speedUp);
double getTurn() const;
void setTurn(const double turn);
ActionType getAction() const;
void setAction(const ActionType action);
double getPassPower() const;
void setPassPower(const double passPower);
double getPassAngle() const;
void setPassAngle(const double passAngle);
int getTeammateIndex() const;
void setTeammateIndex(const int teammateIndex);
private:
Move* _move;
const CoordFix* _fix;
};
//
class GameF : public Game {
public:
GameF();
GameF(const Game& g);
double getWorldWidth() const;
double getWorldHeight() const;
};
//
class PlayerF : public Player {
public:
PlayerF(const Player& p, const CoordFix* fix);
double getNetLeft() const;
double getNetRight() const;
double getNetFront() const;
double getNetBack() const;
private:
const CoordFix* _fix;
};
//
class UnitF : public Unit {
public:
UnitF(const Unit& u, const CoordFix* fix);
double getX() const;
double getY() const;
double getSpeedX() const;
double getSpeedY() const;
double getAngle() const;
double getAngleTo(double x, double y) const;
double getAngleTo(const UnitF& unit) const;
double getDistanceTo(double x, double y) const;
double getDistanceTo(const UnitF& unit) const;
private:
const CoordFix* _fix;
};
//
class HockeyistF : public Hockeyist, public UnitF {
public:
HockeyistF();
HockeyistF(const Hockeyist& h, const CoordFix* fix);
long long getId() const;
double getMass() const;
double getRadius() const;
double getX() const;
double getY() const;
double getSpeedX() const;
double getSpeedY() const;
double getAngle() const;
double getAngularSpeed() const;
double getAngleTo(double x, double y) const;
double getAngleTo(const UnitF& unit) const;
double getDistanceTo(double x, double y) const;
double getDistanceTo(const UnitF& unit) const;
private:
const CoordFix* _fix;
};
//
class PuckF : public Puck, public UnitF {
public:
PuckF(const Puck& p, const CoordFix* fix);
long long getId() const;
double getMass() const;
double getRadius() const;
double getX() const;
double getY() const;
double getSpeedX() const;
double getSpeedY() const;
double getAngle() const;
double getAngularSpeed() const;
double getAngleTo(double x, double y) const;
double getAngleTo(const UnitF& unit) const;
double getDistanceTo(double x, double y) const;
double getDistanceTo(const UnitF& unit) const;
};
//
class WorldF : public World {
public:
WorldF();
WorldF(const World& w, const CoordFix* fix, const GameF& game);
vector<PlayerF> getPlayers() const;
PlayerF getMyPlayer() const;
PlayerF getOpponentPlayer() const;
vector<HockeyistF> getHockeyists() const;
PuckF getPuck() const;
double getWidth() const;
double getHeight() const;
private:
const CoordFix* _fix;
GameF _game;
};
#endif // COORDFIX_H