|
@@ -84,6 +84,13 @@ public class Solitaire extends CardGame {
|
84
|
84
|
for(Tableau tab : arrayTabs) tab.stack.peek().setCovered(false);
|
85
|
85
|
}
|
86
|
86
|
|
|
87
|
+ public void refillDeck(){
|
|
88
|
+ if (solitaireDeck.deckOfCards.size()<1){
|
|
89
|
+ while(wastePile.iterator().hasNext())
|
|
90
|
+ solitaireDeck.deckOfCards.push(wastePile.pop());
|
|
91
|
+ }
|
|
92
|
+ }
|
|
93
|
+
|
87
|
94
|
public void drawCard(){
|
88
|
95
|
wastePile.push(solitaireDeck.draw());
|
89
|
96
|
}
|
|
@@ -146,6 +153,10 @@ public class Solitaire extends CardGame {
|
146
|
153
|
if(wastePile.size()>0) System.out.println("\n\nDraw pile: " + wastePile.peek().toString2());
|
147
|
154
|
}
|
148
|
155
|
|
|
156
|
+ public static void unCover(Stack<Card> lastStack){
|
|
157
|
+ if (lastStack.size() > 0 && lastStack.peek().isCovered()) lastStack.peek().setCovered(false);
|
|
158
|
+ }
|
|
159
|
+
|
149
|
160
|
//you've got a temp stack. so when you pull a card, show it. if it doesn't go, put it back.
|
150
|
161
|
//fix empty stack exceptions
|
151
|
162
|
//draw shouldn't reprint every time. only print top of wastePile
|
|
@@ -191,6 +202,7 @@ public class Solitaire extends CardGame {
|
191
|
202
|
print();
|
192
|
203
|
break;
|
193
|
204
|
}
|
|
205
|
+ if (solitaireDeck.deckOfCards.size()<1) refillDeck();
|
194
|
206
|
}
|
195
|
207
|
}
|
196
|
208
|
|