-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBot.java
More file actions
67 lines (56 loc) · 1.72 KB
/
Bot.java
File metadata and controls
67 lines (56 loc) · 1.72 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.ArrayList;
import java.util.List;
public class Bot {
List<Card> cards;
String name;
int amountDrawn;
boolean placed; //gelegt, gezogen, gezogen da keine pssende karte auf der hand
public Bot(int cardAmount, String name) {
cards = new ArrayList<>();
drawCards(cardAmount);
this.name = name;
}
public List<Card> getCards() {
return cards;
}
public String getName() {
return name;
}
public void drawCard() { //in this gamemode disabled (all cards (32) are already in the players hands)
if (CardsStack.getAmount() > 0) { //always false
Card card = CardsStack.drawCard();
System.out.print(" Card drawn: ");
Card.showCard(card);
cards.add(card);
Helper.sort(cards);
Game.repaint();
}
}
public void drawCards(int amount) {
for (int i = 0; i < amount; i++) {
drawCard();
}
}
public boolean placed() {
boolean placedTemp = placed;
placed = false;
return placedTemp;
}
public Card getCardAt(int index) {
return cards.get(index);
}
public void placeCard(int num) {
if (!placed) {
System.out.print("Card placed: ");
Card.showCard(cards.get(num));
CheatProtection.check(this, num);
Game.repaint();
placed = true;
} else {
System.out.println("Bot tries to place two cards at the same time!");
}
}
public int getCardAmount() {
return cards.size();
}
}