-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.java
64 lines (51 loc) · 1.51 KB
/
Card.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
64
/** Class Card
* stores suit, number, and value of a card
Ascii art for playing cards:
Suit in the middle:
♥, ♠, ◆, ♣
Face:
___________
│ A │
│ │
│ │
│ ♠ │
│ │
│ │
│ A │
‾‾‾‾‾‾‾‾‾‾‾
Back:
___________
│░░░░░░░░░░░│
│░░░░░░░░░░░│
│░░░░░░░░░░░│
│░░░░░░░░░░░│
│░░░░░░░░░░░│
│░░░░░░░░░░░│
│░░░░░░░░░░░│
‾‾‾‾‾‾‾‾‾‾‾
*/
import java.util.ArrayList;
import java.util.Arrays;
public class Card {
public String suit;
public String number;
public int gameValue;
public String[] stringy;
public boolean faceDown;
private static final ArrayList<String> NUMBERS = new ArrayList<>(Arrays.asList("A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"));
private static final ArrayList<Integer> GAMEVALUES = new ArrayList<>(Arrays.asList(11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10));
public Card() {
suit = "Spade";
number = "Ace";
gameValue = 1;
faceDown = false;
}
public Card(String suit, String number) {
this.suit = suit;
this.number = number;
this.gameValue = GAMEVALUES.get(NUMBERS.indexOf(number));
}
public String toString() {
return number + " of " + suit + ": " + gameValue;
}
}