Преглед изворни кода

Merge branch 'Working' of tkhong102/ZCW-OOP-Casino into Working

nedredmond пре 6 година
родитељ
комит
d009f5cc72
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6
    4
      src/main/java/io/zipcoder/casino/cardgames/BlackJack.java

+ 6
- 4
src/main/java/io/zipcoder/casino/cardgames/BlackJack.java Прегледај датотеку

@@ -81,16 +81,18 @@ public class BlackJack extends CardGame implements Gamble {
81 81
             Console.println("Dealer's card are: " + dealerHand.display());
82 82
 
83 83
             while (getSum(dealerHand) < 17) {
84
+                dealerHand.add(deck.removeFirst());
84 85
                 revealCard();
85
-                if (getSum(dealerHand) > 21) {
86
-                    Console.println("Dealer busted. " + currentPlayer + " wins.");
87
-                }
86
+                Console.println("Dealer's sum is " + getSum(dealerHand));
87
+            }
88
+            if (getSum(dealerHand) > 21) {
89
+                Console.println("Dealer busted. You win.");
88 90
             }
89 91
 
90 92
             if (getSum(dealerHand) == getSum(currentPlayer.getHand())) {
91 93
                 Console.println("It's a tie. You lose.");
92 94
                 return false;
93
-            } else if (getSum(dealerHand) > getSum(currentPlayer.getHand())) {
95
+            } else if (getSum(dealerHand) <=21 && getSum(dealerHand) > getSum(currentPlayer.getHand())) {
94 96
                 Console.println("Dealer wins.");
95 97
                 return false;
96 98
             } else {