-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunMultiplayer.java
28 lines (27 loc) · 1.01 KB
/
runMultiplayer.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
/*Multi Agent Implementation*/
import com.diarc.DiarcComponent;
public class runMultiplayer {
public static class AgentThread extends Thread {
private int index;
private int numPlayers;
private Class<? extends DiarcComponent> agentClass;
public AgentThread(Class<? extends com.diarc.DiarcComponent> agentClass,
int index, int numPlayers) {
this.index = index;
this.numPlayers = numPlayers;
this.agentClass = agentClass;
}
public void run() {
DiarcComponent.createInstance(this.agentClass, new String[]{
"-agentName", "agent" + index,
"-agentIndex", Integer.toString(index),
"-numPlayers", Integer.toString(numPlayers)});
}
}
public static void main(String[] args) {
AgentThread a1 = new AgentThread(Agent.class, 1, 2);
//AgentThread a2 = new AgentThread(/*Your class name here*/.class, 0, 2);
a1.start();
//a2.start();
}
}