/src/pointJack/game/Player.java
Java | 78 lines | 59 code | 13 blank | 6 comment | 1 complexity | 9cf8549351eb6368098863ea2a2bf181 MD5 | raw file
1package pointJack.game;
2
3/**
4 *
5 * @author jthor
6 * @license http://jthor.no-ip.org/projects/pointjack/license BSD
7 */
8public class Player
9{
10 private PlayerDeck deck;
11 // Keys currently selected in the player's deck.
12 private PlayerDeck activeDeck;
13
14 private Score score;
15 private int id;
16 private String name;
17
18 public Player(int id)
19 {
20 score = new PlayerScore();
21 activeDeck = new PlayerDeck(2);
22 deck = new PlayerDeck(5);
23 this.id = id;
24 }
25
26 public Player(int id, String name)
27 {
28 score = new PlayerScore();
29 activeDeck = new PlayerDeck(5);
30 deck = new PlayerDeck(5);
31 this.id = id;
32 this.name = name;
33 }
34
35 public int getID()
36 {
37 return id;
38 }
39
40 @Override
41 public String toString()
42 {
43 String s = id + " has: [";
44 for (Card c : deck)
45 {
46 s += c.value() + ", ";
47 }
48
49 s += "]";
50
51 return s;
52 }
53
54 public PlayerDeck getActiveCards()
55 {
56 return activeDeck;
57 }
58
59 public PlayerDeck getDeck()
60 {
61 return deck;
62 }
63
64 public void playCards(PlayerDeck c)
65 {
66 activeDeck = c;
67 }
68
69 public String getName()
70 {
71 return name;
72 }
73
74 public Score getScore()
75 {
76 return score;
77 }
78}