-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlackJackDealer.java
More file actions
48 lines (47 loc) · 1.06 KB
/
BlackJackDealer.java
File metadata and controls
48 lines (47 loc) · 1.06 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
public class BlackJackDealer extends BlackJackPlayer
{
BlackJackDealer()
{
super("dealer");
}
public void play(Deck deck)
{
boolean allDone = false;
while(!allDone)
{
int val = this.getCardsValue();
if(val <= 16)
{
this.drawCard(deck.getTopCard());
}
else
{
allDone = true;
}
}
}
public void showCards(boolean showFullHand)
{
for(int i = 0; i < this.cards.size(); i++)
{
if(i == 0 || showFullHand)
{
String suit = this.cards.get(i).suit;
String name = this.cards.get(i).name;
System.out.print("| " + suit + "-" + name + " | ");
}
else
{
System.out.print("| ? |");
}
}
System.out.println();
}
public void reset()
{
while(this.cards.size() > 0)
{
this.cards.remove(0);
}
}
}