-
Notifications
You must be signed in to change notification settings - Fork 0
/
PokerGames.java
112 lines (102 loc) · 4.27 KB
/
PokerGames.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.util.Set;
public class PokerGames {
private PokerGames() {
// uninstantiable untility class
}
// Standard SMH (Simple Mercer Holdem) and MMH (Multiround Mercer Holdem) Games
public static PokerGame newSMHGame(int numPlayers) {
return initSMHGameBuilder(numPlayers, new FourCardEvaluator()).build();
}
public static PokerGame newMMHGame(int numPlayers) {
return initMMHGameBuilder(numPlayers, new FourCardEvaluator()).build();
}
// Games with weak/strong collusion
public static PokerGame newSMHCollGame(int numPlayers, Set<Integer> team, boolean strongColl) {
Evaluator eval = new CollusionEvaluator(new FourCardEvaluator(), team, true);
PokerGame.Builder builder = initSMHGameBuilder(numPlayers, eval);
if (strongColl) {
builder.addStronglyColludingPlayers(team);
}
return builder.build();
}
public static PokerGame newMMHCollGame(int numPlayers, Set<Integer> team, boolean strongColl) {
Evaluator eval = new CollusionEvaluator(new FourCardEvaluator(), team, true);
PokerGame.Builder builder = initMMHGameBuilder(numPlayers, eval);
if (strongColl) {
builder.addStronglyColludingPlayers(team);
}
return builder.build();
}
// Base constructors
private static PokerGame.Builder initSMHGameBuilder(int numPlayers, Evaluator eval) {
Deck deck = new Deck(5,4);
PokerGame.Builder builder = PokerGame.newBuilder(deck, eval, numPlayers);
Round r1 = Round.newBuilder()
.noSharedCards()
.setNumHoleCards(2)
.setMaxBetsPerPlayer(1)
.setAnte(1.0)
.addBetOption(4.0)
.canCheck(false)
.build();
Round r2 = Round.newBuilder()
.noBetting()
.noHoleCards()
.setNumSharedCards(2)
.build();
return builder.addRound(r1).addRound(r2);
}
private static PokerGame.Builder initMMHGameBuilder(int numPlayers, Evaluator eval) {
Deck deck = new Deck(5,4);
PokerGame.Builder builder = PokerGame.newBuilder(deck, eval, numPlayers);
Round r1 = Round.newBuilder()
.noSharedCards()
.setNumHoleCards(2)
.setMaxBetsPerPlayer(2)
.setAnte(1.0)
.addBetOption(4.0)
.canCheck(false)
.build();
Round r2 = Round.newBuilder()
.noHoleCards()
.setNumSharedCards(2)
.setMaxBetsPerPlayer(2)
.noAnte()
.addBetOption(4.0)
.canCheck(false)
.build();
return builder.addRound(r1).addRound(r2);
}
public static PokerGame newNoSuitFourCardHoldem() {
int numPlayers = 2;
boolean canCheck = false;
Deck deck = new Deck(13,4);
PokerGame.Builder builder =
PokerGame.newBuilder(deck, new FourCardEvaluator(), numPlayers);
Round r1 = Round.newBuilder()
.noSharedCards()
.setNumHoleCards(2)
.setMaxBetsPerPlayer(1)
.setAnte(1.0)
.addBetOption(4.0)
.canCheck(canCheck)
.build();
Round r2 = Round.newBuilder()
.noHoleCards()
.setNumSharedCards(1)
.noAnte()
.setMaxBetsPerPlayer(1)
.addBetOption(4.0)
.canCheck(canCheck)
.build();
Round r3 = Round.newBuilder()
.noHoleCards()
.setNumSharedCards(1)
.noAnte()
.setMaxBetsPerPlayer(1)
.addBetOption(4.0)
.canCheck(canCheck)
.build();
return builder.addRound(r1).addRound(r2).addRound(r3).build();
}
}