Updated RandomGenerator2
This commit is contained in:
parent
01d71acc2b
commit
1acd532363
@ -10,9 +10,8 @@ import analysis.NetworkDumper;
|
||||
|
||||
public class RandomGenerator2 {
|
||||
|
||||
private int ROUNDS = 100;
|
||||
|
||||
public static double BIRTH_RATE = 0.80;
|
||||
public static double BIRTH_RATE = 0.50;
|
||||
private static int START_NODES = 100;
|
||||
|
||||
public static List<Node> nodes = new ArrayList<Node>();
|
||||
public static Random gen = new Random();
|
||||
@ -28,7 +27,11 @@ public class RandomGenerator2 {
|
||||
nodes.add(firstNode);
|
||||
new NetworkDumper(firstNode);
|
||||
|
||||
for (int i = 0; i < ROUNDS - 1; i++) {
|
||||
for (int i = 0; i < START_NODES; i++) {
|
||||
nodes.add(new Node());
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
if (gen.nextDouble() > 1 - BIRTH_RATE) {
|
||||
spawn();
|
||||
@ -37,17 +40,17 @@ public class RandomGenerator2 {
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Executed " + ROUNDS
|
||||
+ " rounds (with a spawn rate of " + BIRTH_RATE + "). "
|
||||
+ numSpawned + " nodes were spawned, " + numKilled
|
||||
+ " nodes were killed. Currently " + "there are "
|
||||
+ nodes.size() + " nodes remaining. At one point we had"
|
||||
+ " a maximum of " + maxNodes + " nodes.");
|
||||
// System.out.println("Executed " + ROUNDS
|
||||
// + " rounds (with a spawn rate of " + BIRTH_RATE + "). "
|
||||
// + numSpawned + " nodes were spawned, " + numKilled
|
||||
// + " nodes were killed. Currently " + "there are "
|
||||
// + nodes.size() + " nodes remaining. At one point we had"
|
||||
// + " a maximum of " + maxNodes + " nodes.");
|
||||
}
|
||||
|
||||
private void spawn() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user