示例#1
0
 /// <summary>
 /// Starts the game
 /// </summary>
 public void Start()
 {
     participants.Enqueue(um.CreateUser("Com1"));
     participants.Enqueue(um.CreateUser("Com2"));
     cm.CreateDeck();
     while (cm.CardsInDeck() > 0)
     {
         Card c = cm.GiveCard();
         User u = participants.Dequeue();
         u.GiveCard(c);
         participants.Enqueue(u);
     }
     foreach (User u in participants)
     {
         for (int i = 0; i < u.deck.Count; i++)
         {
             Card c = u.deck[i];
             //remove the card to check from the deck - in order to avoid it being checked with itself
             u.deck.Remove(c);
             Card pair = v.CheckPair(u.deck, c);
             if (pair != null)
             {
                 u.SubmitPair(pair);
             }
             else
             {
                 u.deck.Add(c);
             }
         }
     }
 }