Exemple #1
0
 public Cards<Card> draw(int count) {
   Cards<Card> drawn = new Cards<Card>();
   for (int i = 0; i < count; i++) {
     drawn.add(drawTop());
   }
   return drawn;
 }
Exemple #2
0
 public void shuffle() {
   Cards<Card> shuffled = new Cards<Card>();
   List<Card> cards = deck.getCards();
   while (cards.size() > 0) {
     shuffled.add((Card) cards.remove(rng.nextInt(cards.size())));
   }
   deck = shuffled;
 }
Exemple #3
0
 Deck() {
   deck = new Cards<Card>();
   discardPile = new Cards<Card>();
   for (int i = 0; i < PRODUCTION.length; i++) {
     for (int j = 0; j < COUNT[i]; j++) {
       deck.add(
           new Card(
               NAMES[i],
               getKey(NAMES[i]),
               VICTORY_POINTS[i],
               COST[i],
               PRODUCTION[i],
               MONUMENT[i] > 0));
     }
   }
 }
Exemple #4
0
 public void discard(Cards<Card> chosen) {
   if (chosen.contains(null)) throw new IllegalArgumentException(chosen.toString());
   discardPile.add(chosen);
 }
Exemple #5
0
 public void discard(Card chosen) {
   if (chosen == null) throw new IllegalArgumentException();
   discardPile.add(chosen);
 }