Explorar el Código

merging solitaire

Jennifer Chao hace 6 años
padre
commit
356299487f

+ 7
- 5
src/main/java/io/zipcoder/casino/CardGame/Card.java Ver fichero

@@ -6,7 +6,7 @@ import static io.zipcoder.casino.CardGame.Face.getFaceByValue;
6 6
 import static io.zipcoder.casino.CardGame.Suit.getSuitByValue;
7 7
 
8 8
 public class Card {
9
-
9
+//9D on 10S didn't work...
10 10
     private Suit suit;
11 11
     private boolean isBlack;
12 12
     private Face face;
@@ -23,9 +23,6 @@ public class Card {
23 23
 //    }
24 24
 
25 25
     public static Card toCard(char face, char suit){
26
-//        char s = suit.charAt(0);
27
-//        char f = face.charAt(0);
28
-//        return new Card(getSuitByValue(s), getFaceByValue(f));
29 26
         return new Card(getSuitByValue(suit), getFaceByValue(face));
30 27
     }
31 28
 
@@ -42,7 +39,7 @@ public class Card {
42 39
     }
43 40
 
44 41
     private void setBlack(){
45
-        if(this.getSuit().toString().equals("HEARTS") || this.getSuit().toString().equals("DIAMOND")) isBlack = false;
42
+        if(this.getSuit().toString().equals("HEARTS") || this.getSuit().toString().equals("DIAMONDS")) isBlack = false;
46 43
         else isBlack = true;
47 44
     }
48 45
 
@@ -74,6 +71,11 @@ public class Card {
74 71
         return suit + "-" + face;
75 72
     }
76 73
 
74
+    public String toString2(){
75
+        if (this.isCovered()) return "--";
76
+        else return "" + face.getTertiaryValue() + suit.getPrimaryValue();
77
+    }
78
+
77 79
     @Override
78 80
     public boolean equals(Object o) {
79 81
         if (this == o) return true;

+ 31
- 26
src/main/java/io/zipcoder/casino/CardGame/Solitaire/Foundation.java Ver fichero

@@ -13,6 +13,7 @@ public class Foundation {
13 13
     public static Stack<Card> diamondStack = new Stack<>();
14 14
     public static Stack<Card> heartStack = new Stack<>();
15 15
     public static Stack<Card> spadeStack = new Stack<>();
16
+    public static Boolean foundsFull = false;
16 17
 
17 18
     public Foundation() {
18 19
 
@@ -28,59 +29,63 @@ public class Foundation {
28 29
         if (tempStackCard.peek().getSuit() == Suit.CLUBS) {
29 30
             //Checks if the Clubs Foundation is Empty
30 31
             if (clubStack.empty() && tempStackCard.peek().getFace() == Face.ACE) {
31
-                clubStack.push(tempStackCard.peek());
32
+                clubStack.push(tempStackCard.pop());
32 33
             }
33
-            //Checks if the Temp Card is 1 more than what
34
-            // is on the Foundation
35
-
36
-            if (tempStackCard.peek().getFace().getPrimaryValue() == clubStack.peek().getFace().getPrimaryValue() + 1) {
37
-                clubStack.push(tempStackCard.peek());
38
-
34
+            //Checks if the Temp Card is 1 more than what is on the Foundation
35
+            else if (tempStackCard.peek().getFace().getPrimaryValue() == clubStack.peek().getFace().getPrimaryValue() + 1) {
36
+                clubStack.push(tempStackCard.pop());
39 37
             }
40 38
         }
41 39
 
42
-        if (tempStackCard.peek().getSuit() == Suit.DIAMONDS) {
40
+        else if (tempStackCard.peek().getSuit() == Suit.DIAMONDS) {
43 41
 
44 42
             //Checks if the Diamonds Foundation is Empty
45 43
             if (diamondStack.empty() && tempStackCard.peek().getFace() == Face.ACE) {
46
-                diamondStack.push(tempStackCard.peek());
44
+                diamondStack.push(tempStackCard.pop());
47 45
             }
48
-            //Checks if the Temp Card is 1 more than what
49
-            // is on the Foundation
50
-            if (tempStackCard.peek().getFace().getPrimaryValue() == diamondStack.peek().getFace().getPrimaryValue() + 1) {
51
-                diamondStack.push(tempStackCard.peek());
46
+            //Checks if the Temp Card is 1 more than what is on the Foundation
47
+            else if (tempStackCard.peek().getFace().getPrimaryValue() == diamondStack.peek().getFace().getPrimaryValue() + 1) {
48
+                diamondStack.push(tempStackCard.pop());
52 49
             }
53 50
         }
54 51
 
55
-        if (tempStackCard.peek().getSuit() == Suit.HEARTS) {
52
+        else if (tempStackCard.peek().getSuit() == Suit.HEARTS) {
56 53
 
57 54
             //Checks if the Heart Foundation is Empty
58 55
             if (heartStack.empty() && tempStackCard.peek().getFace() == Face.ACE) {
59
-                heartStack.push(tempStackCard.peek());
56
+                heartStack.push(tempStackCard.pop());
60 57
             }
61
-            //Checks if the Temp Card is 1 more than what
62
-            // is on the Foundation
63
-            if (tempStackCard.peek().getFace().getPrimaryValue() == heartStack.peek().getFace().getPrimaryValue() + 1) {
64
-                heartStack.push(tempStackCard.peek());
58
+            //Checks if the Temp Card is 1 more than what is on the Foundation
59
+            else if (tempStackCard.peek().getFace().getPrimaryValue() == heartStack.peek().getFace().getPrimaryValue() + 1) {
60
+                heartStack.push(tempStackCard.pop());
65 61
             }
66 62
         }
67 63
 
68
-        if (tempStackCard.peek().getSuit() == Suit.SPADES) {
64
+        else if (tempStackCard.peek().getSuit() == Suit.SPADES) {
69 65
 
70 66
 
71 67
             if (spadeStack.empty() && tempStackCard.peek().getFace() == Face.ACE) {
72
-                spadeStack.push(tempStackCard.peek());
68
+                spadeStack.push(tempStackCard.pop());
73 69
             }
74
-            if (tempStackCard.peek().getFace().getPrimaryValue() == spadeStack.peek().getFace().getPrimaryValue() + 1) {
75
-                spadeStack.push(tempStackCard.peek());
70
+            else if (tempStackCard.peek().getFace().getPrimaryValue() == spadeStack.peek().getFace().getPrimaryValue() + 1) {
71
+                spadeStack.push(tempStackCard.pop());
76 72
             }
77 73
         }
78 74
     }
79 75
 
80 76
     public static Boolean allFoundsFull() {
77
+        if (foundsFull == true) return true;
78
+        return false;
79
+    }
80
+
81
+    public static void checkFoundsFull() {
81 82
         if (clubStack.size() == 13 && spadeStack.size() == 13
82
-                && heartStack.size() == 13  && diamondStack.size() == 13)
83
-            return true;
84
-        else return false;
83
+                && heartStack.size() == 13  && diamondStack.size() == 13) {
84
+            foundsFull = true;
85
+        }
85 86
     }
87
+
88
+    public static void cheatFoundations(){
89
+        foundsFull = true;
90
+        }
86 91
 }

+ 118
- 68
src/main/java/io/zipcoder/casino/CardGame/Solitaire/Solitaire.java Ver fichero

@@ -6,11 +6,13 @@ import io.zipcoder.casino.CardGame.Deck;
6 6
 import io.zipcoder.casino.Console;
7 7
 import io.zipcoder.casino.Player;
8 8
 
9
+import java.util.EmptyStackException;
9 10
 import java.util.Scanner;
10 11
 import java.util.Stack;
11 12
 
12 13
 import static io.zipcoder.casino.CardGame.Card.toCard;
13 14
 import static io.zipcoder.casino.CardGame.Solitaire.Foundation.allFoundsFull;
15
+import static io.zipcoder.casino.CardGame.Solitaire.Foundation.cheatFoundations;
14 16
 import static io.zipcoder.casino.CardGame.Solitaire.Foundation.whichSuit;
15 17
 
16 18
 public class Solitaire extends CardGame {
@@ -19,6 +21,7 @@ public class Solitaire extends CardGame {
19 21
         Solitaire s = new Solitaire(new Player("Bill"));
20 22
         s.start();
21 23
     }
24
+    Console console = new Console(System.in, System.out);
22 25
 
23 26
     Scanner in = new Scanner(System.in);
24 27
     //clean up.
@@ -29,6 +32,8 @@ public class Solitaire extends CardGame {
29 32
     public Stack<Card> wastePile;
30 33
     public Tableau[] arrayTabs;
31 34
     public static Stack<Card> tempStack = new Stack<>();
35
+    public static Stack<Card> lastStack = null;
36
+    public Boolean ifFromWaste = false;
32 37
 
33 38
     public Solitaire(Player player) {
34 39
         this.player = player;
@@ -41,13 +46,27 @@ public class Solitaire extends CardGame {
41 46
         tab6 = new Tableau();
42 47
         tab7 = new Tableau();
43 48
         arrayTabs = new Tableau[]{tab1, tab2, tab3, tab4, tab5, tab6, tab7};
44
-        start();
45 49
     }
46 50
 
47 51
     public static Deck solitaireDeck = new Deck();
48 52
 
49
-    public void deal() {
53
+
54
+    public void start(){
55
+        System.out.println("Welcome");
56
+        resetDeck();
57
+        wastePile.removeAllElements();
58
+        tempStack.removeAllElements();
59
+        shuffle();
60
+        deal();
61
+        print();
62
+        takeATurn();
63
+    }
64
+
65
+    public void shuffle(){
50 66
         solitaireDeck.shuffle();
67
+    }
68
+
69
+    public void deal() {
51 70
         for (int i = 0; i < arrayTabs.length; i++) {
52 71
             for (int j = 0; j < arrayTabs.length; j++) {
53 72
                 if (j >= i) arrayTabs[j].add(draw());
@@ -63,6 +82,7 @@ public class Solitaire extends CardGame {
63 82
 
64 83
     public Stack<Card> pickUp(){
65 84
         tempStack.push(wastePile.pop());
85
+        lastStack = wastePile;
66 86
         return tempStack;
67 87
     }
68 88
 
@@ -92,80 +112,75 @@ public class Solitaire extends CardGame {
92 112
             case '8':
93 113
                 whichSuit(tempStack);
94 114
                 break;
95
-            case '9':
96
-                whichSuit(tempStack);
97
-                break;
98
-            case '0':
99
-                whichSuit(tempStack);
100
-                break;
101
-            case '-':
102
-                whichSuit(tempStack);
103
-                break;
104
-            case 'E': //develop way to replace original stack on pile. don't change coverage until placed. same with pulled from stack.
105
-                break;
106 115
             default:
107 116
                 System.out.println("Not a valid entry. Try again or press \'E\'");
108 117
                 dropToTab(in.next().charAt(0));
109 118
         }
110 119
     }
111 120
 
112
-    public Stack<Card> pull(String cardCode){
113
-        char f = cardCode.charAt(0);
114
-        char s = cardCode.charAt(1);
121
+    public void pull(String cardCode){
122
+        char f = cardCode.toUpperCase().charAt(0);
123
+        char s = cardCode.toUpperCase().charAt(1);
115 124
         Card c = toCard(f,s);
116
-        return findTab(c).pull(c);
125
+        findTab(c).pull(c);
117 126
     }
118 127
 
119 128
     public Tableau findTab(Card c){
120 129
         for (Tableau tab : arrayTabs)
121
-            if (tab.stack.contains(c))
130
+            if (tab.stack.contains(c)) {
131
+                lastStack = tab.stack;
122 132
                 return tab;
133
+            }
123 134
         return null;
124 135
     }
125 136
 
126
-    public void start(){
127
-        System.out.println("Welcome");
128
-        resetDeck();
129
-        wastePile.removeAllElements();
130
-        deal();
131
-        print();
132
-        takeATurn();
133
-    }
134
-
135
-    public void end() {
136
-        System.out.println("Congratulations!");
137
-        System.out.println("Enter \'N\' to play again or press \'Q\' to quit");
138
-        String command = in.next().toUpperCase();
139
-        while (!command.equals("Q") || !command.equals("N")){
140
-            if (command.equals("Q")) end();
141
-            else if (command.equals("N")) start();
142
-            else System.out.println("Invalid. Enter \'N\' to play again or press \'Q\' to quit");
143
-        }
144
-    }
145
-
146
-    public String getInput(){
147
-        return in.next();
137
+    public void peekWaste(){
138
+        if(wastePile.size()>0) System.out.println("\n\nDraw pile: " + wastePile.peek().toString2());
148 139
     }
149 140
 
141
+    //you've got a temp stack. so when you pull a card, show it. if it doesn't go, put it back.
142
+    //fix empty stack exceptions
143
+    //draw shouldn't reprint every time. only print top of wastePile
144
+    //build console class for solitaire printouts
150 145
     public void takeATurn() {
151
-        Console.println("Let's play");
152
-        while (!getInput().equals("QUIT") || !allFoundsFull()) {
153
-            if (Console.getInputString("Enter draw to draw a card").equals("DRAW")) {
154
-                drawCard();
155
-                print();
156
-                continue;
157
-            } else if (Console.getInputString("Enter draw to draw a card").equals("P")) {
158
-                pickUp();
159
-                dropToTab(getInput().charAt(0));
160
-                print();
161
-            } else if (Console.getInputString("Enter draw to draw a card").length() == 2) {
162
-                pull(String.valueOf(getInput()));
163
-                dropToTab(getInput().charAt(0));
164
-                print();
146
+            console.println("\n\nReady? Let's Play");
147
+            while (!allFoundsFull() || !gameOver()) {
148
+                String command = console.getInputString("\nWhat now?");
149
+                switch (String.valueOf(command)) {
150
+                    case "DRAW":
151
+                        drawCard();
152
+                        print();
153
+                        //console.println("\nDraw pile: " + wastePile.peek().toString2());
154
+                        break;
155
+                    case "P":
156
+                        //try, catch, continue
157
+                        try {
158
+                            pickUp();
159
+                            console.println("\nYou just picked up " + tempStack.peek().toString2());
160
+                                dropToTab(console.getDropTab().charAt(0));
161
+                            print();
162
+                            break;
163
+                        } catch (EmptyStackException e) {
164
+                            console.println("\nCan't pull from an empty draw pile");
165
+                            break;
166
+                        }
167
+                    case "QUIT":
168
+                        gameOver();
169
+//                    case "FOO":
170
+//                        cheatFoundations();
171
+                    default:
172
+                        try {
173
+                            pull(String.valueOf(command));
174
+                            console.println("\nYou just pulled " + tempStack.peek().toString2());
175
+                            dropToTab(console.getDropTab().charAt(0));
176
+                        } catch (NullPointerException e) {
177
+                            console.println("Card does not exist. Try again :)\n");
178
+                            break;
179
+                        }
180
+                        print();
181
+                        break;
182
+                }
165 183
             }
166
-        }
167
-
168
-        if (allFoundsFull()) end();
169 184
     }
170 185
 
171 186
     public void addPlayer(Player player) {
@@ -176,12 +191,6 @@ public class Solitaire extends CardGame {
176 191
 
177 192
     }
178 193
 
179
-    public void moveable() {
180
-    }
181
-
182
-    public void receivable() {
183
-    }
184
-
185 194
     public Card draw() {
186 195
         return solitaireDeck.draw();
187 196
     }
@@ -189,15 +198,56 @@ public class Solitaire extends CardGame {
189 198
     public void resetDeck(){
190 199
         solitaireDeck = new Deck();
191 200
     }
201
+    Foundation found = new Foundation();
192 202
 
193 203
     public void print(){
194
-        int i = 0;
204
+        System.out.println("CLUBS\t\tDIAMONDS\t\tHEARTS\t\tSPADES");
205
+        System.out.println("------\t\t--------\t\t------\t\t------");
206
+
207
+        if (Foundation.clubStack.size() == 0){
208
+            System.out.print("  --  \t\t");
209
+        } else {
210
+            System.out.print("  " + Foundation.clubStack.peek().toString2() + "  \t\t");
211
+        }
212
+
213
+        if (Foundation.diamondStack.size() == 0){
214
+            System.out.print("   --  \t\t\t");
215
+        } else {
216
+            System.out.print("  " + Foundation.diamondStack.peek().toString2() + "  \t\t\t");
217
+        }
218
+
219
+        if (Foundation.heartStack.size() == 0){
220
+            System.out.print("  --  \t\t");
221
+        } else {
222
+            System.out.print("  " + Foundation.heartStack.peek().toString2() + "  \t");
223
+        }
224
+        if (Foundation.spadeStack.size() == 0){
225
+            System.out.println("  --  \t\t");
226
+        } else {
227
+            System.out.print("  " + Foundation.spadeStack.peek().toString2() + "  \t\n");
228
+        }
229
+
230
+        int i = 1;
195 231
         for (Tableau tab : arrayTabs) {
196
-            System.out.println("tab " + i); i++;
197
-            tab.stack.forEach(e -> System.out.println(e + " " + e.isCovered()));
232
+            System.out.println("\nCOLUMN " + i); i++;
233
+            tab.stack.forEach(e -> System.out.print(e.toString2() + " " + "\t"));
198 234
         }
199
-        if (wastePile.size() > 0) System.out.println("Top of Pile " + wastePile.peek());
235
+        peekWaste();
200 236
     }
201 237
 
238
+    public Boolean gameOver(){
239
+        if(console.getInputString("Are you sure you want to quit?\nEnter Y to quit").equals("Y")) return true;
240
+        return false;
241
+    }
202 242
 
203
-}
243
+    public void end() {
244
+        System.out.println("Congratulations!");
245
+        System.out.println("Enter \'N\' to play again or press \'Q\' to quit");
246
+        String command = in.next().toUpperCase();
247
+        while (!command.equals("Q") || !command.equals("N")){
248
+            if (command.equals("Q"));
249
+            else if (command.equals("N")) start();
250
+            else System.out.println("Invalid. Enter \'N\' to play again or press \'Q\' to quit");
251
+        }
252
+    }
253
+}

+ 10
- 15
src/main/java/io/zipcoder/casino/CardGame/Solitaire/Tableau.java Ver fichero

@@ -4,6 +4,7 @@ import io.zipcoder.casino.CardGame.Card;
4 4
 
5 5
 import java.util.Stack;
6 6
 
7
+import static io.zipcoder.casino.CardGame.Solitaire.Solitaire.lastStack;
7 8
 import static io.zipcoder.casino.CardGame.Solitaire.Solitaire.tempStack;
8 9
 
9 10
 public class Tableau {
@@ -23,27 +24,21 @@ public class Tableau {
23 24
         stack.push(c);
24 25
     }
25 26
 
26
-    //need to preface with a find stack method. maybe at higher level that feeds into this.stack
27
-    // - so that player doesn't have to select the stack, he can just type in card to place onto.
28
-
29
-    //c = the top card of the subStack you want to pull - ex. 6D, 5C, 4H, 3S, 2D, AS; if pulling 4H and down, c = 4H.
30
-    public Stack<Card> pull(Card c){
31
-        if(this.stack.contains(c)){
32
-            while(!stack.peek().equals(c))  tempStack.push(stack.pop());
33
-            tempStack.push(stack.pop());
34
-            }
35
-        unCover();
36
-        return tempStack;
27
+    //c = the top card of the subStack you want to pull - ex. 6D, 5C, 4H, 3S, 2D, AS; if you want to pull 4H and down, c = 4H.
28
+    public void pull(Card c){
29
+        while(!stack.peek().equals(c))  tempStack.push(stack.pop());
30
+        tempStack.push(stack.pop());
37 31
         }
38 32
 
39 33
     //does not need parameter. with a stack representing each column, will simply call 'stack'.place() to drop the tempStack on top of it.
40 34
     public void place(){
41 35
         if (this.canReceive(tempStack.peek())){
42 36
             while(tempStack.iterator().hasNext()){
43
-                unCover();
37
+                unCover(lastStack);
44 38
                 add(tempStack.pop());
45 39
             }
46
-        }
40
+            unCover(lastStack);
41
+        } else { lastStack.push(tempStack.pop()); }
47 42
     }
48 43
 
49 44
     //checks whether 'top' card of stack is opposite color and 1 above passed card
@@ -61,7 +56,7 @@ public class Tableau {
61 56
         } return false;
62 57
     }
63 58
 
64
-    private void unCover(){
65
-        if (size() > 0 && this.stack.peek().isCovered()) this.stack.peek().setCovered(false);
59
+    private void unCover(Stack<Card> lastStack){
60
+        if (size() > 0 && lastStack.peek().isCovered()) lastStack.peek().setCovered(false);
66 61
     }
67 62
 }

+ 10
- 6
src/main/java/io/zipcoder/casino/Console.java Ver fichero

@@ -6,24 +6,24 @@ import java.util.Scanner;
6 6
 
7 7
 public class Console {
8 8
 
9
-    private static Scanner input;
10
-    private static PrintStream output;
9
+    private final Scanner input;
10
+    private final PrintStream output;
11 11
 
12 12
     public Console(InputStream in, PrintStream out) {
13 13
         this.input = new Scanner(in);
14 14
         this.output = out;
15 15
     }
16 16
 
17
-    public static void println(String prompt, Object... args) {
17
+    public void println(String prompt, Object... args) {
18 18
         output.format(prompt + "\n", args);
19 19
     }
20 20
 
21
-    public static String getInputString(String prompt, Object... args) {
21
+    public String getInputString(String prompt, Object... args) {
22 22
         println(prompt, args);
23 23
         return input.nextLine();
24 24
     }
25 25
 
26
-    public static Double getInputDouble(String prompt, Object... args) {
26
+    public Double getInputDouble(String prompt, Object... args) {
27 27
         String stringInput = getInputString(prompt, args);
28 28
         do {
29 29
             try {
@@ -35,7 +35,7 @@ public class Console {
35 35
         } while (true);
36 36
     }
37 37
 
38
-    public static Integer getInputInteger(String prompt, Object... args) {
38
+    public Integer getInputInteger(String prompt, Object... args) {
39 39
         return getInputDouble(prompt, args).intValue();
40 40
     }
41 41
 
@@ -52,4 +52,8 @@ public class Console {
52 52
         return scanner.nextInt();
53 53
     }
54 54
 
55
+    public String getDropTab(){
56
+        return getInputString("To which row do you want to drop?");
57
+    }
58
+
55 59
 }

+ 9
- 0
src/main/java/io/zipcoder/casino/InputOutput.java Ver fichero

@@ -0,0 +1,9 @@
1
+package io.zipcoder.casino;
2
+
3
+public class InputOutput {
4
+
5
+    public static final Console console = new Console(System.in, System.out);
6
+
7
+
8
+
9
+}

+ 9
- 0
src/test/java/io/zipcoder/casino/CardGame/Solitaire/FoundationTest.java Ver fichero

@@ -4,6 +4,7 @@ import io.zipcoder.casino.CardGame.Card;
4 4
 import io.zipcoder.casino.CardGame.Deck;
5 5
 import io.zipcoder.casino.CardGame.Face;
6 6
 import io.zipcoder.casino.CardGame.Suit;
7
+import io.zipcoder.casino.Player;
7 8
 import org.junit.Assert;
8 9
 import org.junit.Test;
9 10
 
@@ -203,4 +204,12 @@ public class FoundationTest {
203 204
         Assert.assertEquals(expected, actual);
204 205
     }
205 206
 
207
+    @Test
208
+    public void testCheatFoundations(){
209
+        Solitaire s = new Solitaire(new Player("234"));
210
+        s.resetDeck();
211
+        Foundation.cheatFoundations();
212
+
213
+    }
214
+
206 215
 }

+ 74
- 27
src/test/java/io/zipcoder/casino/CardGame/Solitaire/SolitaireTest.java Ver fichero

@@ -10,30 +10,30 @@ import static io.zipcoder.casino.CardGame.Card.toCard;
10 10
 public class SolitaireTest {
11 11
     Solitaire s = new Solitaire(new Player("Murphy"));
12 12
 
13
-//    @Test
14
-//    public void testfind() {
15
-//        s.resetDeck();
16
-//        s.tab1.add(toCard("Ace", "Hearts"));
17
-//        s.tab2.add(toCard("five", "diamonds"));
18
-//
19
-//        System.out.println(s.findTab(toCard("Ace", "Hearts")).stack.peek());
20
-//    }
21
-//
22
-//    @Test
23
-//    public void testPull() {
24
-//        s.resetDeck();
25
-//        s.tab1.add(toCard("Ace", "Hearts"));
26
-//        s.tab2.add(toCard("five", "diamonds"));
27
-//
28
-//        Integer preSize = s.tab1.size();
29
-//        s.pull(toCard("Ace", "Hearts")); //main method tested
30
-//        Integer postSize = s.tab1.size();
31
-//
32
-//        Integer actual = preSize - postSize;
33
-//        Integer expected = 1;
34
-//
35
-//        Assert.assertEquals(expected, actual);
36
-//    }
13
+    @Test
14
+    public void testfind() {
15
+        s.resetDeck();
16
+        s.tab1.add(toCard('A', 'H'));
17
+        s.tab2.add(toCard('5', 'D'));
18
+
19
+        System.out.println(s.findTab(toCard('A', 'H')).stack.peek());
20
+    }
21
+
22
+    @Test
23
+    public void testPull2() {
24
+        s.resetDeck();
25
+        s.tab1.add(toCard('A', 'H'));
26
+        s.tab2.add(toCard('5', 'D'));
27
+
28
+        Integer preSize = s.tab1.size();
29
+        s.pull("AH"); //main method tested
30
+        Integer postSize = s.tab1.size();
31
+
32
+        Integer actual = preSize - postSize;
33
+        Integer expected = 1;
34
+
35
+        Assert.assertEquals(expected, actual);
36
+    }
37 37
 
38 38
     @Test
39 39
     public void drawCard() {
@@ -74,7 +74,8 @@ public class SolitaireTest {
74 74
     }
75 75
 
76 76
     @Test
77
-    public void testCoverage() {
77
+    public void testCardCoverage() {
78
+        //whether top card on each tab is uncovered
78 79
         s.resetDeck();
79 80
         s.deal();
80 81
         int i = 0;
@@ -93,7 +94,53 @@ public class SolitaireTest {
93 94
     }
94 95
 
95 96
     @Test
96
-    public void testStartGame() {
97
-        s.start();
97
+    public void testPull(){
98
+        s.resetDeck();
99
+        s.deal();
100
+        Card expected = s.tab1.stack.peek();
101
+        s.pull("KC");
102
+        Card actual = s.tempStack.peek();
103
+        Assert.assertEquals(expected,actual);
104
+    }
105
+
106
+    @Test
107
+    public void testPlace(){
108
+        s.resetDeck();
109
+        s.deal();
110
+        Card expected = s.tab1.stack.peek();
111
+        s.pull("KC");
112
+        s.tab2.add(s.tempStack.pop());
113
+        Card actual = s.tab2.stack.peek();
114
+        s.print();
115
+        Assert.assertEquals(expected,actual);
116
+        s.tempStack.removeAllElements();
117
+    }
118
+
119
+    @Test
120
+    public void testShuffle(){
121
+        s.resetDeck();
122
+        Card actual = s.solitaireDeck.deckOfCards.peek();
123
+        s.shuffle();
124
+        Card expected = s.solitaireDeck.deckOfCards.peek();
125
+        Assert.assertNotEquals(expected,actual);
126
+    }
127
+
128
+    @Test
129
+    public void peekWaste(){
130
+        s.resetDeck();
131
+        Card actual = s.solitaireDeck.deckOfCards.peek();
132
+        s.drawCard();
133
+        Card expected = s.wastePile.peek();
134
+        Assert.assertEquals(expected,actual);
135
+    }
136
+
137
+    @Test
138
+    public void resetDeck(){
139
+        s.resetDeck();
140
+        Card actual = s.solitaireDeck.deckOfCards.peek();
141
+        s.shuffle();
142
+        s.resetDeck();
143
+        Card expected = s.solitaireDeck.deckOfCards.peek();
144
+        Assert.assertEquals(expected,actual);
98 145
     }
99 146
 }