@@ -20,15 +20,19 @@ public MultiplayerGameRunner() {
2020
2121 /**
2222 * 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.
2529 */
26-
30+
2731 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 ));
3236 }
3337
3438 /**
@@ -43,7 +47,8 @@ public void setLeagueLevel(int leagueLevel) {
4347 * If those parameters are present in the given input, the input values should override the generated values.
4448 * </p>
4549 *
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
4752 */
4853 public void setSeed (Long seed ) {
4954 this .seed = seed ;
@@ -119,7 +124,7 @@ public void addAgent(Class<?> playerClass, String nickname, String avatarUrl) {
119124 public void addAgent (String commandLine , String nickname , String avatarUrl ) {
120125 addAgent (new CommandLinePlayerAgent (commandLine ), nickname , avatarUrl );
121126 }
122-
127+
123128 /**
124129 * Adds an AI to the next game to run, with the specified nickname.
125130 *
@@ -157,4 +162,53 @@ protected void buildInitCommand(Command initCommand) {
157162 }
158163 }
159164 }
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+
160214}
0 commit comments