-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunIPD.java
More file actions
42 lines (33 loc) · 1.04 KB
/
RunIPD.java
File metadata and controls
42 lines (33 loc) · 1.04 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
/**
* General class containing main program to run the
* iterated Prisoner's Dilemma (IPD).
* @author 081028AW
*/
public class RunIPD extends Object
{
/**
* Main program to start IPD program.
*/
public static void main(String args[])
{
int i;
int maxSteps = 10;
Strategy player1, player2;
IteratedPD ipd;
for (i=0; i<args.length; i++)
{
/* check parameters */
if (args[i].equals("-l") || args[i].equals("-L"))
{
maxSteps = Integer.parseInt(args[i+1]);
System.out.println(" Max steps = " + maxSteps);
} /* if */
} /* for i */
player1 = new StrategyPercentAll();
player2 = new StrategyPercentAll();
ipd = new IteratedPD(player1, player2);
ipd.runSteps(maxSteps);
System.out.printf(" Player 1 score = %d\n", ipd.player1Score());
System.out.printf(" Player 2 score = %d\n", ipd.player2Score());
} /* main */
} /* class RunIPD */