Exemplo n.º 1
0
        public void Start()
        {
            Random r = new Random();

            CommonDeck.Mix();
            CardSet cards = new CardSet(52);
            int     a     = r.Next(cards.Cards.Count);
            int     b     = r.Next(cards.Cards.Count);

            for (int i = 0; i < 7; i++)
            {
                Player1.Cards.Add(CommonDeck.Pull(a));
                cards.Cards.RemoveAt(a);
                Player2.Cards.Add(CommonDeck.Pull(r.Next(cards.Cards.Count)));
                cards.Cards.RemoveAt(b);
            }
            DeckCard = CommonDeck.Pull();
            cards.Cards.RemoveAt(0);
            while (Player1.Cards.Cards.Count != 0 && Player2.Cards.Cards.Count != 0)
            {
                Move(Player1, Player2);
                if (Player1.Cards.Cards.Count == 0)
                {
                    ShowMessage(String.Format("Player {0} win!", Player1.Name));
                }
                Move(Player2, Player1);
                if (Player2.Cards.Cards.Count == 0)
                {
                    ShowMessage(String.Format("Player {0} win!", Player2.Name));
                }
            }
        }
Exemplo n.º 2
0
        public void Start()
        {
            CommonDeck.Mix();

            foreach (var player in Players)
            {
                player.Cards.Add(CommonDeck.Deal(7));
            }

            DeckCard     = CommonDeck.Pull();
            activeColor  = DeckCard.Colour;
            Reversed     = false;
            activePlayer = Players[0];
            SelectPlayer(activePlayer);
            SelectCards(GetCardsForMoving(), activePlayer);
        }