-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathRound.java
More file actions
283 lines (276 loc) · 19.7 KB
/
Round.java
File metadata and controls
283 lines (276 loc) · 19.7 KB
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// automatically generated by the FlatBuffers compiler, do not modify
package battlecode.schema;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
@SuppressWarnings("unused")
/**
* A single time-step in a Game.
* The bulk of the data in the file is stored in tables like this.
* Note that a struct-of-arrays format is more space efficient than an array-
* of-structs.
*/
public final class Round extends Table {
public static Round getRootAsRound(ByteBuffer _bb) { return getRootAsRound(_bb, new Round()); }
public static Round getRootAsRound(ByteBuffer _bb, Round obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
public Round __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
/**
* The IDs of teams in the Game.
*/
public int teamIDs(int j) { int o = __offset(4); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int teamIDsLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer teamIDsAsByteBuffer() { return __vector_as_bytebuffer(4, 4); }
public ByteBuffer teamIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 4); }
/**
* The number of votes the teams get, 0 or 1.
*/
public int teamVotes(int j) { int o = __offset(6); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int teamVotesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer teamVotesAsByteBuffer() { return __vector_as_bytebuffer(6, 4); }
public ByteBuffer teamVotesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 4); }
/**
* The ID of the Enlightenment Center got the bid.
*/
public int teamBidderIDs(int j) { int o = __offset(8); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int teamBidderIDsLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer teamBidderIDsAsByteBuffer() { return __vector_as_bytebuffer(8, 4); }
public ByteBuffer teamBidderIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 8, 4); }
/**
* The IDs of bodies that moved.
*/
public int movedIDs(int j) { int o = __offset(10); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int movedIDsLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer movedIDsAsByteBuffer() { return __vector_as_bytebuffer(10, 4); }
public ByteBuffer movedIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 4); }
/**
* The new locations of bodies that have moved.
*/
public VecTable movedLocs() { return movedLocs(new VecTable()); }
public VecTable movedLocs(VecTable obj) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* New bodies.
*/
public SpawnedBodyTable spawnedBodies() { return spawnedBodies(new SpawnedBodyTable()); }
public SpawnedBodyTable spawnedBodies(SpawnedBodyTable obj) { int o = __offset(14); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* The IDs of bodies that died.
*/
public int diedIDs(int j) { int o = __offset(16); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int diedIDsLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer diedIDsAsByteBuffer() { return __vector_as_bytebuffer(16, 4); }
public ByteBuffer diedIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 16, 4); }
/**
* The IDs of robots that performed actions.
* IDs may repeat.
*/
public int actionIDs(int j) { int o = __offset(18); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int actionIDsLength() { int o = __offset(18); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer actionIDsAsByteBuffer() { return __vector_as_bytebuffer(18, 4); }
public ByteBuffer actionIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 18, 4); }
/**
* The actions performed. These actions allow us to track how much soup or dirt a body carries.
*/
public byte actions(int j) { int o = __offset(20); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
public int actionsLength() { int o = __offset(20); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer actionsAsByteBuffer() { return __vector_as_bytebuffer(20, 1); }
public ByteBuffer actionsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 20, 1); }
/**
* The 'targets' of the performed actions. Actions without targets may have any value
*/
public int actionTargets(int j) { int o = __offset(22); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int actionTargetsLength() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer actionTargetsAsByteBuffer() { return __vector_as_bytebuffer(22, 4); }
public ByteBuffer actionTargetsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 22, 4); }
/**
* The IDs of bodies that set indicator dots
*/
public int indicatorDotIDs(int j) { int o = __offset(24); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int indicatorDotIDsLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer indicatorDotIDsAsByteBuffer() { return __vector_as_bytebuffer(24, 4); }
public ByteBuffer indicatorDotIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 24, 4); }
/**
* The location of the indicator dots
*/
public VecTable indicatorDotLocs() { return indicatorDotLocs(new VecTable()); }
public VecTable indicatorDotLocs(VecTable obj) { int o = __offset(26); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* The RGB values of the indicator dots
*/
public RGBTable indicatorDotRGBs() { return indicatorDotRGBs(new RGBTable()); }
public RGBTable indicatorDotRGBs(RGBTable obj) { int o = __offset(28); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* The IDs of bodies that set indicator lines
*/
public int indicatorLineIDs(int j) { int o = __offset(30); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int indicatorLineIDsLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer indicatorLineIDsAsByteBuffer() { return __vector_as_bytebuffer(30, 4); }
public ByteBuffer indicatorLineIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 30, 4); }
/**
* The start location of the indicator lines
*/
public VecTable indicatorLineStartLocs() { return indicatorLineStartLocs(new VecTable()); }
public VecTable indicatorLineStartLocs(VecTable obj) { int o = __offset(32); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* The end location of the indicator lines
*/
public VecTable indicatorLineEndLocs() { return indicatorLineEndLocs(new VecTable()); }
public VecTable indicatorLineEndLocs(VecTable obj) { int o = __offset(34); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* The RGB values of the indicator lines
*/
public RGBTable indicatorLineRGBs() { return indicatorLineRGBs(new RGBTable()); }
public RGBTable indicatorLineRGBs(RGBTable obj) { int o = __offset(36); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* All logs sent this round.
* Messages from a particular robot in this round start on a new line, and
* have a header:
* '[' $TEAM ':' $ROBOTTYPE '#' $ID '@' $ROUND '] '
* $TEAM = 'A' | 'B'
* $ROBOTTYPE = 'ENLIGHTENMENT_CENTER' | 'POLITICIAN' | 'SLANDERER' | 'MUCKRAKER'
* $ID = a number
* $ROUND = a number
* The header is not necessarily followed by a newline.
* This header should only be sent once per robot per round (although
* players may forge it, so don't crash if you get strange input.)
*
* You should try to only read this value once, and cache it. Reading
* strings from a flatbuffer is much less efficient than reading other
* buffers, because they need to be copied into an environment-provided
* buffer and validated.
*
* (haha i guess you can never really escape string parsing can you)
*/
public String logs() { int o = __offset(38); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer logsAsByteBuffer() { return __vector_as_bytebuffer(38, 1); }
public ByteBuffer logsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 38, 1); }
/**
* The first sent Round in a match should have index 1. (The starting state,
* created by the MatchHeader, can be thought to have index 0.)
* It should increase by one for each following round.
*/
public int roundID() { int o = __offset(40); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
/**
* The IDs of player bodies.
*/
public int bytecodeIDs(int j) { int o = __offset(42); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int bytecodeIDsLength() { int o = __offset(42); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer bytecodeIDsAsByteBuffer() { return __vector_as_bytebuffer(42, 4); }
public ByteBuffer bytecodeIDsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 42, 4); }
/**
* The bytecodes used by the player bodies.
*/
public int bytecodesUsed(int j) { int o = __offset(44); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int bytecodesUsedLength() { int o = __offset(44); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer bytecodesUsedAsByteBuffer() { return __vector_as_bytebuffer(44, 4); }
public ByteBuffer bytecodesUsedInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 44, 4); }
/**
* Amount of influence contributing to the teams' buffs. Added at end for backwards compatability.
*/
public int teamNumBuffs(int j) { int o = __offset(46); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
public int teamNumBuffsLength() { int o = __offset(46); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer teamNumBuffsAsByteBuffer() { return __vector_as_bytebuffer(46, 4); }
public ByteBuffer teamNumBuffsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 46, 4); }
public static int createRound(FlatBufferBuilder builder,
int teamIDsOffset,
int teamVotesOffset,
int teamBidderIDsOffset,
int movedIDsOffset,
int movedLocsOffset,
int spawnedBodiesOffset,
int diedIDsOffset,
int actionIDsOffset,
int actionsOffset,
int actionTargetsOffset,
int indicatorDotIDsOffset,
int indicatorDotLocsOffset,
int indicatorDotRGBsOffset,
int indicatorLineIDsOffset,
int indicatorLineStartLocsOffset,
int indicatorLineEndLocsOffset,
int indicatorLineRGBsOffset,
int logsOffset,
int roundID,
int bytecodeIDsOffset,
int bytecodesUsedOffset,
int teamNumBuffsOffset) {
builder.startObject(22);
Round.addTeamNumBuffs(builder, teamNumBuffsOffset);
Round.addBytecodesUsed(builder, bytecodesUsedOffset);
Round.addBytecodeIDs(builder, bytecodeIDsOffset);
Round.addRoundID(builder, roundID);
Round.addLogs(builder, logsOffset);
Round.addIndicatorLineRGBs(builder, indicatorLineRGBsOffset);
Round.addIndicatorLineEndLocs(builder, indicatorLineEndLocsOffset);
Round.addIndicatorLineStartLocs(builder, indicatorLineStartLocsOffset);
Round.addIndicatorLineIDs(builder, indicatorLineIDsOffset);
Round.addIndicatorDotRGBs(builder, indicatorDotRGBsOffset);
Round.addIndicatorDotLocs(builder, indicatorDotLocsOffset);
Round.addIndicatorDotIDs(builder, indicatorDotIDsOffset);
Round.addActionTargets(builder, actionTargetsOffset);
Round.addActions(builder, actionsOffset);
Round.addActionIDs(builder, actionIDsOffset);
Round.addDiedIDs(builder, diedIDsOffset);
Round.addSpawnedBodies(builder, spawnedBodiesOffset);
Round.addMovedLocs(builder, movedLocsOffset);
Round.addMovedIDs(builder, movedIDsOffset);
Round.addTeamBidderIDs(builder, teamBidderIDsOffset);
Round.addTeamVotes(builder, teamVotesOffset);
Round.addTeamIDs(builder, teamIDsOffset);
return Round.endRound(builder);
}
public static void startRound(FlatBufferBuilder builder) { builder.startObject(22); }
public static void addTeamIDs(FlatBufferBuilder builder, int teamIDsOffset) { builder.addOffset(0, teamIDsOffset, 0); }
public static int createTeamIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startTeamIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addTeamVotes(FlatBufferBuilder builder, int teamVotesOffset) { builder.addOffset(1, teamVotesOffset, 0); }
public static int createTeamVotesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startTeamVotesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addTeamBidderIDs(FlatBufferBuilder builder, int teamBidderIDsOffset) { builder.addOffset(2, teamBidderIDsOffset, 0); }
public static int createTeamBidderIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startTeamBidderIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addMovedIDs(FlatBufferBuilder builder, int movedIDsOffset) { builder.addOffset(3, movedIDsOffset, 0); }
public static int createMovedIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startMovedIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addMovedLocs(FlatBufferBuilder builder, int movedLocsOffset) { builder.addOffset(4, movedLocsOffset, 0); }
public static void addSpawnedBodies(FlatBufferBuilder builder, int spawnedBodiesOffset) { builder.addOffset(5, spawnedBodiesOffset, 0); }
public static void addDiedIDs(FlatBufferBuilder builder, int diedIDsOffset) { builder.addOffset(6, diedIDsOffset, 0); }
public static int createDiedIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startDiedIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addActionIDs(FlatBufferBuilder builder, int actionIDsOffset) { builder.addOffset(7, actionIDsOffset, 0); }
public static int createActionIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startActionIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addActions(FlatBufferBuilder builder, int actionsOffset) { builder.addOffset(8, actionsOffset, 0); }
public static int createActionsVector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); }
public static void startActionsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
public static void addActionTargets(FlatBufferBuilder builder, int actionTargetsOffset) { builder.addOffset(9, actionTargetsOffset, 0); }
public static int createActionTargetsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startActionTargetsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addIndicatorDotIDs(FlatBufferBuilder builder, int indicatorDotIDsOffset) { builder.addOffset(10, indicatorDotIDsOffset, 0); }
public static int createIndicatorDotIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startIndicatorDotIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addIndicatorDotLocs(FlatBufferBuilder builder, int indicatorDotLocsOffset) { builder.addOffset(11, indicatorDotLocsOffset, 0); }
public static void addIndicatorDotRGBs(FlatBufferBuilder builder, int indicatorDotRGBsOffset) { builder.addOffset(12, indicatorDotRGBsOffset, 0); }
public static void addIndicatorLineIDs(FlatBufferBuilder builder, int indicatorLineIDsOffset) { builder.addOffset(13, indicatorLineIDsOffset, 0); }
public static int createIndicatorLineIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startIndicatorLineIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addIndicatorLineStartLocs(FlatBufferBuilder builder, int indicatorLineStartLocsOffset) { builder.addOffset(14, indicatorLineStartLocsOffset, 0); }
public static void addIndicatorLineEndLocs(FlatBufferBuilder builder, int indicatorLineEndLocsOffset) { builder.addOffset(15, indicatorLineEndLocsOffset, 0); }
public static void addIndicatorLineRGBs(FlatBufferBuilder builder, int indicatorLineRGBsOffset) { builder.addOffset(16, indicatorLineRGBsOffset, 0); }
public static void addLogs(FlatBufferBuilder builder, int logsOffset) { builder.addOffset(17, logsOffset, 0); }
public static void addRoundID(FlatBufferBuilder builder, int roundID) { builder.addInt(18, roundID, 0); }
public static void addBytecodeIDs(FlatBufferBuilder builder, int bytecodeIDsOffset) { builder.addOffset(19, bytecodeIDsOffset, 0); }
public static int createBytecodeIDsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startBytecodeIDsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addBytecodesUsed(FlatBufferBuilder builder, int bytecodesUsedOffset) { builder.addOffset(20, bytecodesUsedOffset, 0); }
public static int createBytecodesUsedVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startBytecodesUsedVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addTeamNumBuffs(FlatBufferBuilder builder, int teamNumBuffsOffset) { builder.addOffset(21, teamNumBuffsOffset, 0); }
public static int createTeamNumBuffsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
public static void startTeamNumBuffsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static int endRound(FlatBufferBuilder builder) {
int o = builder.endObject();
return o;
}
}