forked from stjpm09/ClassMelee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
executable file
·41 lines (33 loc) · 1.21 KB
/
Main.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
package clanmelee;
import java.util.Collection;
import java.util.Random;
public class Main {
private static Random rand = new Random();
private static int wiggle(int original) {
int amount = rand.nextInt((int) (original * 0.05));
if (rand.nextDouble() < 0.5)
return original + amount;
else
return original - amount;
}
public static void main(String[] args) {
int[] allBaseHitPoints = {100, 1000, 10000, 100000, 1000000, 10000000};
Collection<Clan> clans = new ClanFactory().getClans();
ClanMelee melee = new ClanMelee();
int round = 1;
for (int baseHitPoints : allBaseHitPoints) {
for (int i = 0; i < 5; i++) {
int hitPoints = wiggle(baseHitPoints);
System.out.println("Round " + round + ", " + hitPoints
+ " hit points per clan");
System.out.println();
melee.runMelee(clans, hitPoints);
System.out.println();
System.out.println("Results after " + round + " rounds:");
melee.printStats();
System.out.println();
++round;
}
}
}
}