This commit is contained in:
2022-09-15 22:36:02 +02:00
parent 3993342453
commit fef09ea000
9 changed files with 103 additions and 2 deletions

View File

View File

View File

@@ -11,12 +11,21 @@ public class Bot extends Player {
public Bot(Dealer dealer) {
super(dealer);
this.hand = super.getHand();
}
@Override
public Card getPlay(Card currentCard) {
new Scanner(System.in).nextLine();
List<Card> hand = super.getHand();
if (hand.size() == 1 && Referee.isValidEndCard(hand.get(0))) {
return hand.get(0);
} else if (hand.size() == 1) {
hand.add(drawCard());
System.out.println("Bot drew a card");
System.out.println("Bot now has " + hand.size() + " cards");
return null;
}
for(Card card : hand) {
TYPENUM cardType = card.getType();

View File

@@ -13,7 +13,6 @@ public class Human extends Player {
public Human(Dealer dealer) {
super(dealer);
this.hand = super.getHand();
}
@Override
@@ -22,6 +21,7 @@ public class Human extends Player {
Scanner scanner = new Scanner(System.in);
List<Card> hand = super.getHand();
while (true){
String input = scanner.nextLine();
if(input.equals("quit")){
@@ -53,6 +53,7 @@ public class Human extends Player {
}
private void printHand(){
List<Card> hand = super.getHand();
for (int i = 0; i < hand.size(); i++) {
System.out.println("(" + i + ") " + hand.get(i).getType() + " " + hand.get(i).getValue());
}