package solitaire;
class Main {
+ private static Stock stock = new Stock();
+ private static Waste waste = new Waste();
+ private static Foundation foundation = new Foundation(Suit.CLUBS);
+
+ private static void printTable() {
+ System.out.printf("%s %s\n\n%s\n\n", stock, waste, foundation);
+ }
public static void main(String[] args) {
- Deck d = new Deck();
- System.out.println(d);
+ Card c;
- while (!d.isEmpty()) {
- Card c = d.draw();
+ while (!stock.isEmpty()) {
+ printTable();
+
+ c = stock.draw();
c.reveal();
- System.out.println(c);
+
+ if (!foundation.add(c))
+ waste.add(c);
}
- System.out.println(d);
+ printTable();
}
}