-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathParticipant.java
More file actions
49 lines (36 loc) · 1.14 KB
/
Participant.java
File metadata and controls
49 lines (36 loc) · 1.14 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
package blackjack.domain;
import java.util.ArrayList;
abstract public class Participant {
private static final String COLON = " : ";
protected final String name;
protected final ParticipantCards cards;
protected int winScore, loseScore;
public Participant(String name, ParticipantCards cards, int winCount, int loseCount) {
this.name = name;
this.cards = cards;
this.winScore = winCount;
this.loseScore = loseCount;
}
public Participant(String name) {
this(name, new ParticipantCards(new ArrayList<>()), 0, 0);
}
public final void judgeScore(int maxScore) {
if (sumCardScore() == maxScore) {
winScore++;
return;
}
loseScore++;
}
public final String getName() {
return name;
}
public final String holdingInfo() {
return name + COLON + cards.toString();
}
public final int sumCardScore() {
return cards.sumCardScore();
}
public abstract void drawCardMultiple(Deck deck, int number);
public abstract void drawCardContinue(Deck deck);
public abstract String scoreResult();
}