-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBJBot.java
More file actions
36 lines (31 loc) · 1.12 KB
/
BJBot.java
File metadata and controls
36 lines (31 loc) · 1.12 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
// import java.util.*;
public class BJBot extends BJPlayer {
private static String[] names = { "Bob", "Rob", "Alice", "Aaron", "Sam", "Eddie", "Rachel", "Mike", "Charlie",
"Ellie", "Colin", "Kevin", "Victor", "Robin", "Jean", "Katheryne", "Dan", "Mark", "Richard", "Dana", "Elena",
"Joe", "Juan", "Tony", "Ella", "Sammy", "Edward", "Ethan", "Jonathan", "Jason", "Evelyn", "Josie", "Sophia",
"Bryan", "Allen", "Alan", "Kim", "Chloe", "Claire", "Jerry", "Aventurine" };
public BJBot() { // <=16 hit >17 stand
super(names[(int) (Math.random() * names.length)]);
}
public int[] action(int gS) {
int[] out = new int[2];
if (gS >= 17) {
out[0] = 2;
} else {
out[0] = 1;
}
return out;
}
public void dispHand(boolean show) {
super.dispHand();
}
public void dispHand() {
System.out.println(); // start to display cards each person has
System.out.println(getName() + ":");
System.out.print("??? ");
for (int i = 1; i < getHand().size(); i++) {
System.out.print(getHand().get(i).getValue() + " ");
}
System.out.println("\n");
}
}