-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticipant.java
More file actions
65 lines (45 loc) · 1.72 KB
/
Participant.java
File metadata and controls
65 lines (45 loc) · 1.72 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import java.util.ArrayList;
import java.util.Random;
public class Participant {
private String name;
private int headsCount = 0;
private static Random flip = new Random();
public Participant() {
this.name = NameGenerator.generateName();
this.headsCount = headsCount;
}
public void setHeadsCount() {
this.headsCount = headsCount + 1;
}
public int getHeadsCount() {
return headsCount;
}
public String getName() {
return name;
}
public static int coinFlip() {
return flip.nextInt(2) + 1;
}
@Override
public String toString() {
return name +
", headsCount:" + headsCount;
}
static class NameGenerator {
private static String[] Beginning = { "Kr", "Ca", "Ra", "Mrok", "Cru",
"Ray", "Bre", "Zed", "Drak", "Mor", "Jag", "Mer", "Jar", "Mjol",
"Zork", "Mad", "Cry", "Zur", "Creo", "Azak", "Azur", "Rei", "Cro",
"Mar", "Luk" };
private static String[] Middle = { "air", "ir", "mi", "sor", "mee", "clo",
"red", "cra", "ark", "arc", "miri", "lori", "cres", "mur", "zer",
"marac", "zoir", "slamar", "salmar", "urak" };
private static String[] End = { "d", "ed", "ark", "arc", "es", "er", "der",
"tron", "med", "ure", "zur", "cred", "mur" };
private static Random rand = new Random();
public static String generateName() {
return Beginning[rand.nextInt(Beginning.length)] +
Middle[rand.nextInt(Middle.length)]+
End[rand.nextInt(End.length)];
}
}
}