-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPSRunner.java
executable file
·41 lines (32 loc) · 1.03 KB
/
RPSRunner.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
29
30
31
32
33
34
35
36
37
38
39
40
41
import info.gridworld.actor.Actor;
import info.gridworld.grid.Location;
import info.gridworld.grid.Grid;
import info.gridworld.grid.BoundedGrid;
import java.awt.Color;
import java.util.ArrayList;
public class RPSRunner
{
public static void main(String[] args)
{
int gridSize = 50;
int numEach = 10;
RPSWorld world = new RPSWorld( new BoundedGrid<Actor>(gridSize,gridSize) );
ArrayList<RPSCritter> contestants = new ArrayList<RPSCritter>();
for(int i=0; i<numEach; i++)
{
addOneOfEach(contestants);
}
world.addRandomly(contestants);
world.show();
}
public static void addOneOfEach(ArrayList<RPSCritter> contestants)
{
// BUILT-IN CONTESTANTS
contestants.add( new RockCritter() );
contestants.add( new PaperCritter() );
contestants.add( new ScissorsCritter() );
//contestants.add( new RandomCritter() );
//contestants.add( new AvoidCritter() );
// ADD YOUR CONTESTANTS HERE
}
}