-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollusionEvaluator.java
36 lines (29 loc) · 1.04 KB
/
CollusionEvaluator.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
import java.util.List;
import java.util.Set;
public class CollusionEvaluator implements Evaluator {
private final Evaluator eval;
private final Set<Integer> team;
private final boolean zeroSum;
public CollusionEvaluator(Evaluator eval, Set<Integer> team) {
this(eval, team, true);
}
public CollusionEvaluator(Evaluator eval, Set<Integer> team, boolean zeroSum) {
this.eval = eval;
this.team = team;
this.zeroSum = zeroSum;
}
public double[] payoffs(List<List<Card>> holeCards, List<Card> sharedCards, double[] bets, boolean[] folds) {
double[] payoffs = eval.payoffs(holeCards, sharedCards, bets, folds);
double totalWinnings = 0;
for (int player : team) {
totalWinnings += payoffs[player];
}
int players = folds.length;
for (int p = 0; p < players; p++) {
if (team.contains(p)) {
payoffs[p] = zeroSum ? totalWinnings / team.size() : totalWinnings;
}
}
return payoffs;
}
}