-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.java
63 lines (46 loc) · 1000 Bytes
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package java6CodingAssignment;
import java.util.ArrayList;
import java.util.List;
public class Player {
List<Card> hand = new ArrayList<Card>();
private String playerName;
private int score;
public Player(String name) {
this.playerName = name;
this.score = 0;
}
public void describe() {
System.out.println(this.getPlayerName());
System.out.println(this.getScore() + "\n");
for (Card card:hand) {
card.describe();
}
}
public void draw(Deck deck) {
hand.add(deck.draw());
}
public Card flip() {
return hand.remove(0);
}
public void incrementScore() {
score = score + 1;
}
public String getPlayerName() {
return playerName;
}
public void setPlayerName(String playerName) {
this.playerName = playerName;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public List<Card> getHand() {
return hand;
}
public void setHand(List<Card> hand) {
this.hand = hand;
}
}