コード例 #1
0
ファイル: Dealer.cs プロジェクト: joyceyeung1221/Kata5
 public void CompleteTurns(Deck deck, BlackJackEngine blackJackEngine)
 {
     write($"\n{blackJackEngine.ConfirmPlayerStatus(this)}\n");
     do
     {
         var currentCard = deck.HandOutCard();
         TakeCard(currentCard);
         write($"Dealer draws [{currentCard.getDisplayName()}, '{currentCard.Suit}']\n");
         wait();
         UpdateScore(ScoreTracker.CalculateScore(this.Hand));
         write($"\n{blackJackEngine.ConfirmPlayerStatus(this)}");
     } while (Score < 17);
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: joyceyeung1221/Kata5
        public void CompleteTurns(int maxScore, Deck deck, BlackJackEngine blackJackEngine)
        {
            int playerMove;

            write($"\n{blackJackEngine.ConfirmPlayerStatus(this)}\n");

            while (Score < maxScore)
            {
                playerMove = blackJackEngine.GetPlayerNextMove();
                if (playerMove == 1)
                {
                    var currentCard = deck.HandOutCard();
                    TakeCard(currentCard);
                    write($"\nYou draw [{currentCard.getDisplayName()}, '{currentCard.Suit}']\n");
                    wait();
                    UpdateScore(ScoreTracker.CalculateScore(this.Hand));
                    write($"\n{blackJackEngine.ConfirmPlayerStatus(this)}\n");
                }
                else
                {
                    break;
                }
            }
        }