jpsp91 6 years ago
parent
commit
75c4a12466

+ 9
- 8
src/main/java/io/zipcoder/casino/Leviathan/Games/BlackJack.java View File

@@ -118,8 +118,9 @@ public class BlackJack extends CardGame implements Gambling {
118 118
 
119 119
         while (playAgain == true) {
120 120
 
121
-            aConsole.println("*** Welcome " + this.aPlayer.getName() +
122
-                    ", let’s play BlackJack! ***\n");
121
+            aConsole.println("\u2664 \u2663 \u2661 \u2666 \u2662 \u2665 \u2667 \u2660 \u2664 \u2663 \u2661 \u2666 \u2662 \u2665 \u2667 \u2660 \u2664 \u2663 \u2661 \u2666 \u2662 \u2665\n"
122
+                    + "*** Welcome " + this.aPlayer.getName() + ", let’s play BlackJack! ***\n"+
123
+                    "\u2664 \u2663 \u2661 \u2666 \u2662 \u2665 \u2667 \u2660 \u2664 \u2663 \u2661 \u2666 \u2662 \u2665 \u2667 \u2660 \u2664 \u2663 \u2661 \u2666 \u2662 \u2665\n");
123 124
 
124 125
             int wageAmount = wageMoney();
125 126
 
@@ -152,7 +153,7 @@ public class BlackJack extends CardGame implements Gambling {
152 153
             //I need to figure out how I could only show one card
153 154
             String houseHandString = houseHandToString(houseHand, 1);
154 155
             aConsole.println("\n The house has drawn: \n" + houseHandString +
155
-                    "And has one card faced down");
156
+                    "And has one card faced down\n");
156 157
 
157 158
             //Decision
158 159
             while (aPlayerScore < 21) {
@@ -173,12 +174,12 @@ public class BlackJack extends CardGame implements Gambling {
173 174
 
174 175
             //House winning situation
175 176
             if (aPlayerScore > 21) {
176
-                aConsole.println("Bust!");
177
+                aConsole.println("\nBust!\n");
177 178
                 win = false;
178 179
                 betChages(bet);
179 180
                 aConsole.println("Your current available chips: \n" + aPlayer.getTotalChips());
180 181
             }else if ((aHouseScore >= aPlayerScore && aHouseScore < 21) || aHouseScore == 21) {
181
-                aConsole.println("You lose\n" + "Your score: " + aPlayerScore +
182
+                aConsole.println("\nYou lose\n" + "Your score: " + aPlayerScore +
182 183
                         "\nHouse score: " + aHouseScore);
183 184
                 aConsole.println("\n Dealer's hand: \n" + handToString(houseHand));
184 185
                 win = false;
@@ -188,13 +189,13 @@ public class BlackJack extends CardGame implements Gambling {
188 189
 
189 190
             //Player winning situation
190 191
             else if (aHouseScore < 21) {
191
-                aConsole.println("You win!");
192
+                aConsole.println("\nYou win!\n");
192 193
                 win = true;
193 194
                 betChages(bet);
194 195
                 aConsole.println("Your current available chips: \n" + aPlayer.getTotalChips());
195 196
             } else {
196 197
                 //aConsole.println("You win!");
197
-                aConsole.println("You win!\n" + "Your score: " + aPlayerScore +
198
+                aConsole.println("\nYou win!\n" + "Your score: " + aPlayerScore +
198 199
                         "\nHouse score: " + aHouseScore);
199 200
                 win = true;
200 201
                 betChages(bet);
@@ -206,7 +207,7 @@ public class BlackJack extends CardGame implements Gambling {
206 207
         }
207 208
     }
208 209
 
209
-    private void playerHit(List<Card> playerHand) {
210
+    public void playerHit(List<Card> playerHand) {
210 211
         //draw a new card
211 212
         Card drawSingleCard = drawSingleCard();
212 213
         playerHand.add(drawSingleCard);

+ 43
- 6
src/test/java/io/zipcoder/casino/BlackJackTest.java View File

@@ -53,9 +53,6 @@ public class BlackJackTest {
53 53
         assertEquals(expected, actual);
54 54
     }
55 55
 
56
-
57
-
58
-
59 56
     @Test
60 57
     public void testGetHandTotal() {
61 58
         Card c1 = new Card(Rank.FOUR, Suit.CLUBS);
@@ -73,7 +70,6 @@ public class BlackJackTest {
73 70
         assertEquals(expected, actual);
74 71
     }
75 72
 
76
-
77 73
     @Test
78 74
     public void testHandToString() {
79 75
         Card c1 = new Card(Rank.FOUR, Suit.CLUBS);
@@ -86,12 +82,53 @@ public class BlackJackTest {
86 82
         hand.add(c3);
87 83
 
88 84
         String expected = "FOUR of CLUBS\n" +
89
-                "EIGHT of CLUBS\n" +
90
-                "TWO of CLUBS\n";
85
+                          "EIGHT of CLUBS\n" +
86
+                          "TWO of CLUBS\n";
91 87
         String actual = testBlackJack.handToString(hand);
92 88
 
93 89
         System.out.println(actual);
94 90
 
95 91
         assertEquals(expected, actual);
96 92
     }
93
+
94
+    @Test
95
+    public void testDrawOneCardToString() {
96
+
97
+        Card c = new Card(Rank.ACE,Suit.HEARTS);
98
+
99
+        String expected = "ACE of HEARTS";
100
+        String actual =testBlackJack.drawnCardToString(c);
101
+
102
+        assertEquals(expected, actual);
103
+    }
104
+
105
+
106
+@Test
107
+    public void testPlayerHit() {
108
+        Card c = new Card(Rank.TWO, Suit.SPADES);
109
+
110
+        int aPlayerScore = 2;
111
+
112
+        List<Card> playerHand = new ArrayList<>();
113
+        playerHand.add(c);
114
+
115
+        int expected = 4;
116
+        //int actual = testBlackJack.playerHit(playerHand);
117
+
118
+
119
+}
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
97 134
 }