@@ -20,15 +20,19 @@ public MultiplayerGameRunner() {
20
20
21
21
/**
22
22
* Sets the league level to run. The first league is 1.
23
- * <p>The value can also be set by setting the environment variable <code>league.level</code>.</p>
24
- * @param leagueLevel the league level. 1 is the lowest level and default value.
23
+ * <p>
24
+ * The value can also be set by setting the environment variable <code>league.level</code>.
25
+ * </p>
26
+ *
27
+ * @param leagueLevel
28
+ * the league level. 1 is the lowest level and default value.
25
29
*/
26
-
30
+
27
31
public void setLeagueLevel (int leagueLevel ) {
28
- if (leagueLevel < 1 || leagueLevel >= 20 ) {
29
- throw new IllegalArgumentException ("League level must be higher than 0 and lesser than 20" );
30
- }
31
- System .setProperty ("league.level" , String .valueOf (leagueLevel ));
32
+ if (leagueLevel < 1 || leagueLevel >= 20 ) {
33
+ throw new IllegalArgumentException ("League level must be higher than 0 and lesser than 20" );
34
+ }
35
+ System .setProperty ("league.level" , String .valueOf (leagueLevel ));
32
36
}
33
37
34
38
/**
@@ -43,7 +47,8 @@ public void setLeagueLevel(int leagueLevel) {
43
47
* If those parameters are present in the given input, the input values should override the generated values.
44
48
* </p>
45
49
*
46
- * @param seed this game's seed returned by the <code>GameManager</code> during execution
50
+ * @param seed
51
+ * this game's seed returned by the <code>GameManager</code> during execution
47
52
*/
48
53
public void setSeed (Long seed ) {
49
54
this .seed = seed ;
@@ -119,7 +124,7 @@ public void addAgent(Class<?> playerClass, String nickname, String avatarUrl) {
119
124
public void addAgent (String commandLine , String nickname , String avatarUrl ) {
120
125
addAgent (new CommandLinePlayerAgent (commandLine ), nickname , avatarUrl );
121
126
}
122
-
127
+
123
128
/**
124
129
* Adds an AI to the next game to run, with the specified nickname.
125
130
*
@@ -157,4 +162,53 @@ protected void buildInitCommand(Command initCommand) {
157
162
}
158
163
}
159
164
}
165
+
166
+ /**
167
+ * Adds an AI to the next game to run.
168
+ * <p>
169
+ * The given command array will be executed with <code>Runtime.getRuntime().exec()</code>.
170
+ * </p>
171
+ * Example: <code>new String[]{"bash", "-c", "echo command1 && echo command2"}</code>
172
+ *
173
+ * @param commandArray
174
+ * the system command array to run the AI.
175
+ * @param nickname
176
+ * the player's nickname
177
+ * @param avatarUrl
178
+ * the url of the player's avatar
179
+ */
180
+ public void addAgent (String [] commandArray , String nickname , String avatarUrl ) {
181
+ addAgent (new CommandLinePlayerAgent (commandArray ), nickname , avatarUrl );
182
+ }
183
+
184
+ /**
185
+ * Adds an AI to the next game to run.
186
+ * <p>
187
+ * The given command array will be executed with <code>Runtime.getRuntime().exec()</code>.
188
+ * </p>
189
+ * Example: <code>new String[]{"bash", "-c", "echo command1 && echo command2"}</code>
190
+ *
191
+ * @param commandArray
192
+ * the system command array to run the AI.
193
+ * @param nickname
194
+ * the player's nickname
195
+ */
196
+ public void addAgent (String [] commandArray , String nickname ) {
197
+ addAgent (commandArray , nickname , null );
198
+ }
199
+
200
+ /**
201
+ * Adds an AI to the next game to run.
202
+ * <p>
203
+ * The given command array will be executed with <code>Runtime.getRuntime().exec()</code>.
204
+ * </p>
205
+ * Example: <code>new String[]{"bash", "-c", "echo command1 && echo command2"}</code>
206
+ *
207
+ * @param commandArray
208
+ * the system command array to run the AI.
209
+ */
210
+ public void addAgent (String [] commandArray ) {
211
+ addAgent (commandArray , null , null );
212
+ }
213
+
160
214
}
0 commit comments