Exemplo n.º 1
0
 public void AskForACard(List<Player> players, int myIndex,
       Deck stock, Values value)
 {
     textBoxOnForm.Text += Name + " asks if anyone has a "
                                   + value + Environment.NewLine;
     int totalCardsGiven = 0;
     for (int i = 0; i < players.Count; i++)
     {
         if (i != myIndex)
         {
             Player player = players[i];
             Deck CardsGiven = player.DoYouHaveAny(value);
             totalCardsGiven += CardsGiven.Count;
             while (CardsGiven.Count > 0)
                 cards.Add(CardsGiven.Deal());
         }
     }
     if (totalCardsGiven == 0)
     {
         textBoxOnForm.Text += Name +
               " must draw from the stock." + Environment.NewLine;
         cards.Add(stock.Deal());
     }
 }