-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokerDeck.java
More file actions
46 lines (37 loc) · 1.01 KB
/
PokerDeck.java
File metadata and controls
46 lines (37 loc) · 1.01 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
package MainRepository;
import java.util.Collections;
import java.util.LinkedList;
class PokerDeck extends Deck {
public final String[] SUIT = { "♠", "♣", "◈", "♥" };
static private LinkedList<Card> table = new LinkedList<>(); // 포커 테이블
PokerDeck() {
initialize();
}
@Override
void initialize() {
super.getDeck().clear();
table.clear();
deckGenerate();
Collections.shuffle(super.getDeck());
}
@Override
void deckGenerate() {
for (int i = 0; i < SUIT.length; ++i) {
for (int j = 0; j < 13; ++j) {
Card card = new Card();
card.suit = SUIT[i];
card.number = j + 1;
super.getDeck().add(card);
}
}
}
void tableSet() {
for (int i = 0; i < 5; ++i) {
table.add(draw());
}
}
// 외부에서 table로의 접근 제공
static LinkedList<Card> getTable() {
return table;
}
}