-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFranCap.java
More file actions
44 lines (42 loc) · 1.28 KB
/
FranCap.java
File metadata and controls
44 lines (42 loc) · 1.28 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
/**
* Write a description of class FranCap here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class FranCap extends Player
{
public String getName() {
return "Francesca Capossela (fixed)";
}
protected boolean doesJoin(Game game, int c) {
Round lastRound = game.getLastRound();
if(c == 2) {
if(lastRound == null) {
return false;
}
int lastC = lastRound.getC();
if(lastC == 2) {
return false;
} else if(lastC == 4) {
return (!lastRound.didEnterersWin() && RAND.nextInt(10) < 3);
} else {
return (!lastRound.didEnterersWin() && RAND.nextInt(10) < 7);
}
} else if(c == 4) {
if(game.isWinning(this) || points < game.getAverageScore()) {
return true;
} else {
return RAND.nextInt(10) < 7;
}
} else if(c == 6) {
if(lastRound == null || (!lastRound.areEnterersMostCommon() && lastRound.didEnterersWin())) {
return false;
} else {
return true;
}
}else {
throw new IllegalArgumentException("c = "+c);
}
}
}