-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGoalie.java
222 lines (183 loc) · 8.46 KB
/
Goalie.java
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
//~--- non-JDK imports --------------------------------------------------------
import com.github.robocup_atan.atan.model.ActionsPlayer;
import com.github.robocup_atan.atan.model.ControllerPlayer;
import com.github.robocup_atan.atan.model.enums.Errors;
import com.github.robocup_atan.atan.model.enums.Flag;
import com.github.robocup_atan.atan.model.enums.Line;
import com.github.robocup_atan.atan.model.enums.Ok;
import com.github.robocup_atan.atan.model.enums.PlayMode;
import com.github.robocup_atan.atan.model.enums.RefereeMessage;
import com.github.robocup_atan.atan.model.enums.ServerParams;
import com.github.robocup_atan.atan.model.enums.ViewAngle;
import com.github.robocup_atan.atan.model.enums.ViewQuality;
import com.github.robocup_atan.atan.model.enums.Warning;
import org.apache.log4j.Logger;
//~--- JDK imports ------------------------------------------------------------
import java.util.HashMap;
/**
* <p>Silly class.</p>
*
* @author Atan
*/
public class Silly implements ControllerPlayer {
private static Logger log = Logger.getLogger(Silly.class);
private double distBall = 1000;
private double minDistLine = 1000;
private ActionsPlayer player;
/** {@inheritDoc} */
@Override
public void preInfo() {
distBall = 1000;
minDistLine = 1000;
}
/** {@inheritDoc} */
@Override
public void postInfo() {
if (distBall < 10) {
getPlayer().turn(10.0);
getPlayer().dash(5);
} else if (minDistLine < 10) {
getPlayer().turn(-90.0);
} else {
getPlayer().dash(50);
}
log.info("I am a silly Client");
}
/** {@inheritDoc} */
@Override
public ActionsPlayer getPlayer() {
return player;
}
/** {@inheritDoc} */
@Override
public void setPlayer(ActionsPlayer p) {
player = p;
}
/** {@inheritDoc} */
@Override
public void infoSeeLine(Line line, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {
if (distance < minDistLine) {
minDistLine = distance;
}
}
/** {@inheritDoc} */
@Override
public void infoSeeBall(double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {
distBall = distance;
}
/** {@inheritDoc} */
@Override
public void infoHearReferee(RefereeMessage refereeMessage) {}
/** {@inheritDoc} */
@Override
public void infoHearPlayMode(PlayMode playMode) {
if (playMode == PlayMode.BEFORE_KICK_OFF) {
getPlayer().move(-30, 30);
}
}
/** {@inheritDoc} */
@Override
public void infoHearPlayer(double direction, String string) {}
/** {@inheritDoc} */
@Override
public void infoSenseBody(ViewQuality viewQuality, ViewAngle viewAngle, double stamina, double unknown,
double effort, double speedAmount, double speedDirection, double headAngle,
int kickCount, int dashCount, int turnCount, int sayCount, int turnNeckCount,
int catchCount, int moveCount, int changeViewCount) {}
/** {@inheritDoc} */
@Override
public String getType() {
return "Silly";
}
/** {@inheritDoc} */
@Override
public void setType(String newType) {}
/** {@inheritDoc} */
@Override
public void infoHearError(Errors error) {}
/** {@inheritDoc} */
@Override
public void infoHearOk(Ok ok) {}
/** {@inheritDoc} */
@Override
public void infoHearWarning(Warning warning) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagRight(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagLeft(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagOwn(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagOther(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagCenter(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagCornerOwn(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagCornerOther(Flag flag, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagPenaltyOwn(Flag flag, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagPenaltyOther(Flag flag, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagGoalOwn(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeeFlagGoalOther(Flag flag, double distance, double direction, double distChange, double dirChange,
double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeePlayerOther(int number, boolean goalie, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoSeePlayerOwn(int number, boolean goalie, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {}
/** {@inheritDoc} */
@Override
public void infoPlayerParam(double allowMultDefaultType, double dashPowerRateDeltaMax,
double dashPowerRateDeltaMin, double effortMaxDeltaFactor, double effortMinDeltaFactor,
double extraStaminaDeltaMax, double extraStaminaDeltaMin,
double inertiaMomentDeltaFactor, double kickRandDeltaFactor,
double kickableMarginDeltaMax, double kickableMarginDeltaMin,
double newDashPowerRateDeltaMax, double newDashPowerRateDeltaMin,
double newStaminaIncMaxDeltaFactor, double playerDecayDeltaMax,
double playerDecayDeltaMin, double playerTypes, double ptMax, double randomSeed,
double staminaIncMaxDeltaFactor, double subsMax) {}
/** {@inheritDoc} */
@Override
public void infoPlayerType(int id, double playerSpeedMax, double staminaIncMax, double playerDecay,
double inertiaMoment, double dashPowerRate, double playerSize, double kickableMargin,
double kickRand, double extraStamina, double effortMax, double effortMin) {}
/** {@inheritDoc} */
@Override
public void infoCPTOther(int unum) {}
/** {@inheritDoc} */
@Override
public void infoCPTOwn(int unum, int type) {}
/** {@inheritDoc} */
@Override
public void infoServerParam(HashMap<ServerParams, Object> info) {}
}