-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlayer.java
43 lines (30 loc) · 1.11 KB
/
Player.java
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
package blackjack.player;
import blackjack.card.Deck;
import java.util.Objects;
import java.util.Scanner;
public class Player extends AbstractPlayer{
public Player(String name){
super(name);
}
public void initCardList(Deck deck){
draw(deck);
draw(deck);
}
@Override
public void drawCard(Deck deck) {
System.out.println(getName() + "の得点は" + calcScore() + "点です \n");
try(Scanner sc = new Scanner(System.in)) {
String line = null;
while (!getIsBurst() && !Objects.equals(line, "N")) {
System.out.println("カードを引きますか?引く場合はYを、引かない場合はNを入力してください。\n");
line = sc.nextLine();
if(Objects.equals(line, "Y")){
draw(deck);
System.out.println(getName() + "の得点は" + calcScore() + "点です \n");
} if(!Objects.equals(line, "N")) {
System.out.println("Y/N以外が入力されました。");
}
}
}
}
}