-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathGamePlayers.java
More file actions
39 lines (29 loc) · 889 Bytes
/
GamePlayers.java
File metadata and controls
39 lines (29 loc) · 889 Bytes
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
package blackjack.domain;
public abstract class GamePlayers {
private static final int INIT_CNT = 2;
protected final String playerName;
protected final OwnCards ownCards;
protected GamePlayers(String playerName) {
this.playerName = playerName;
this.ownCards = new OwnCards();
}
protected GamePlayers(String playerName, OwnCards ownCards) {
this.playerName = playerName;
this.ownCards = ownCards;
}
public abstract boolean isAvailDraw();
public void initOwnCards(Deck deck) {
for (int i = 0; i < INIT_CNT; i++) {
ownCards.addCard(deck.cardDraw());
}
}
public void drawOneCards(Deck deck) {
ownCards.addCard(deck.cardDraw());
}
public String getPlayerName() {
return playerName;
}
public OwnCards myOwnCards() {
return ownCards;
}
}