Пример #1
0
        public void PlayGame()
        {
            Stack = new CardHand();
            bool GameFinished = false;

            while (!GameFinished)
            {
                foreach (var player in Players)
                {
                    if (player.cardHand.Count > 0)
                    {
                        var Playedcard = player.cardHand[0];
                        Thread.Sleep(100);
                        _UserInterface.WriteLine($" Player {player.CardHandIndex + 1} played {Playedcard.CardValue} of {Playedcard.CardSuit}");
                        var StackCardShowing = Stack.cardHand.Count > 0 ? Stack.cardHand[Stack.cardHand.Count - 1] : null;
                        player.DealCard();
                        Stack.AddCard(Playedcard);
                        if (StackCardShowing != null && Playedcard.CardValue == StackCardShowing.CardValue)
                        {
                            ProcessSnapping();
                        }
                        GameFinished = TestIfGameFinished();
                    }
                }
            }
        }
Пример #2
0
 public void DealPlayersTheirCards(ICardHand ShuffledDeck, int NumberOfPlayers)
 {
     Players    = _Utilities.GetSetOfNewlyDealtCardHands(ShuffledDeck, NumberOfPlayers);
     this.Stack = new CardHand();
 }