@Override
 public CardSet nextCards(int numberOfCards) {
   int counter = 0;
   CardSet returnedCards = new CardSet();
   while (iterator.hasNext() && numberOfCards > counter) {
     returnedCards.add(iterator.next());
     counter++;
   }
   return returnedCards;
 }
Esempio n. 2
0
  @Test
  public void followsTrickTakingRules() {
    CardSet cardsOnTable = new CardSet();
    cardsOnTable.add(TestCard.A1);

    Player player = new AiPlayer("", new Hand(8));
    player.take(TestCard.B1);
    player.take(TestCard.A2);
    player.take(TestCard.A3);
    RuleSet rules = new NoTrickRules();
    player.learnRules(rules);

    Card cardToBePlayed = player.play(cardsOnTable);

    assertEquals(TestCard.A2, cardToBePlayed);
  }