-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableau.java
More file actions
43 lines (34 loc) · 1.11 KB
/
Tableau.java
File metadata and controls
43 lines (34 loc) · 1.11 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
import java.util.ArrayList;
import java.util.List;
public class Tableau {
private List<Card> Cards = new ArrayList<>();
public void addCard(Card card) {
Cards.add(card);
}
public void printCards() {
// Top level
System.out.println("|" + "-".repeat(Cards.size() * 5 + 6) + "|");
System.out.print("| ");
for (Card card : Cards) {
System.out.print(card.showCard() + " ");
}
// And the "next" card
System.out.print(new Card("?", "?").showCard() + " |\n");
// Bottom level
System.out.println("|" + "-".repeat(Cards.size() * 5 + 6) + "|");
}
public void printFinalCards() {
// Top level
System.out.println("|" + "-".repeat(Cards.size() * 5 + 1) + "|");
System.out.print("| ");
for (Card card : Cards) {
System.out.print(card.showCard() + " ");
}
System.out.print("|\n");
// Bottom level
System.out.println("|" + "-".repeat(Cards.size() * 5 + 1) + "|");
}
public Card lastCard() {
return Cards.get(Cards.size() - 1);
}
}