public Cards<Card> draw(int count) { Cards<Card> drawn = new Cards<Card>(); for (int i = 0; i < count; i++) { drawn.add(drawTop()); } return drawn; }
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; }
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)); } } }
public void discard(Cards<Card> chosen) { if (chosen.contains(null)) throw new IllegalArgumentException(chosen.toString()); discardPile.add(chosen); }
public void discard(Card chosen) { if (chosen == null) throw new IllegalArgumentException(); discardPile.add(chosen); }