コード例 #1
0
        /// <summary>
        /// Play next game round. Game Status change to GameOver when there are no more rounds to play.
        /// </summary>
        public void PlayRound()
        {
            if (!this.CanPlayRound())
            {
                return;
            }

            var shuffledDeck = _dealer.Shuffle(_deck);

            _dealer.Deal(shuffledDeck, Players, 2);
            var score = _dealer.ScorePlayers(Players);

            Rounds.Add(new Round(Rounds.Count + 1, score));

            Status = Rounds.Count == NumberOfRounds
                ? GameStatus.GameOver
                : GameStatus.InProgress;

            if (Status == GameStatus.GameOver)
            {
                GameOver();
            }
        }