Пример #1
0
 private void PrintBothHands()
 {
     TypeToConsole.WriteLine("My hand was -");
     PrintHand(DealerHand);
     TypeToConsole.WriteLine("\nYour hand was -");
     PrintHand(PlayersHand);
 }
Пример #2
0
 private void GetPlayerNewCard()
 {
     PlayersHand.Add(Deck.RemoveTopCard());
     TypeToConsole.WriteLine("Your hand -");
     PrintHand(PlayersHand);
     PlayersHandTotal = UpdateScore(PlayersHand);
     PrintPlayerScore();
 }
Пример #3
0
 private void PrintFinalScore()
 {
     if (DealerGameScore > PlayerGameScore)
     {
         TypeToConsole.WriteLine("\nGame over! I win! better luck next time looser! " + DealerEmoji.WinFace);
     }
     else
     {
         TypeToConsole.WriteLine("\nGame over! Dammit you win, You have defeated me! " + DealerEmoji.LooseFace);
     }
 }
Пример #4
0
 private void PrintPlayerScore()
 {
     if (PlayersHandTotal > 21)
     {
         Console.WriteLine($"\nYour score is {PlayersHandTotal}.\n");
         TypeToConsole.WriteLine("HAHA! you've gone bust! " + DealerEmoji.PlayerBustFace);
     }
     else
     {
         TypeToConsole.WriteLine($"\nYour score is {PlayersHandTotal}.");
     }
 }
Пример #5
0
        private void PrintGameScore()
        {
            var PlayersHandFinalTotal = PlayersHandTotal == -1 ? "Bust!" : PlayersHandTotal.ToString();
            var DealersHandFinalTotal = DealersHandTotal == -1 ? "Bust!" : DealersHandTotal.ToString();

            if (PlayersHandTotal > DealersHandTotal)
            {
                TypeToConsole.WriteLine($"No you won the game! you scored {PlayersHandFinalTotal} and I scored {DealersHandFinalTotal}. " + DealerEmoji.AngryFace);
                DealerGameScore--;
                PlayerGameScore++;
            }
            else if (PlayersHandTotal < DealersHandTotal)
            {
                TypeToConsole.WriteLine($"HAHA! you lost! you scored {PlayersHandFinalTotal} and I scored {DealersHandFinalTotal}. " + DealerEmoji.HappyFace);
                DealerGameScore++;
                PlayerGameScore--;
            }
            else if (PlayersHandTotal == DealersHandTotal)
            {
                TypeToConsole.WriteLine($"Dammit its a draw! we both scored {PlayersHandFinalTotal}. Our match scores stay the same! " + DealerEmoji.DislikeFace);
            }
        }
Пример #6
0
        public static void Main(string[] args)
        {
            system(@"printf '\e[8;50;160t'");

            Console.Clear();
            Console.WriteLine("Press enter to start blackjack......");

            var EasterEgg = string.Empty;

            bool GameStart = false;

            while (GameStart == false)
            {
                switch (Console.ReadKey(true).Key)
                {
                case ConsoleKey.Enter:
                    GameStart = true;
                    break;

                case ConsoleKey.E:
                    EasterEgg = "(But you can call me daddy!) ";
                    GameStart = true;
                    break;

                default:
                    Console.WriteLine("Invalid Input!\n");
                    break;
                }
            }

            Console.Clear();
            Console.WriteLine();
            AsciiTitle.Print();
            TypeToConsole.WriteLine($"Hello! my name's Kevin {EasterEgg}and I will be your dealer today! You think you've got what it takes to beat me?! " + DealerEmoji.StartFace);

            Game game = new Game(3);

            game.Start();
        }
Пример #7
0
        public void Start()
        {
            bool runMatch = true;

            while (runMatch)
            {
                TypeToConsole.WriteLine("Lets Deal! " + DealerEmoji.DealingFace);

                StartGame();

                if (PlayerGameScore == 0 || DealerGameScore == 0)
                {
                    runMatch = false;
                }
                else
                {
                    TypeToConsole.WriteLine($"\nYour match score is {PlayerGameScore} And my match score is {DealerGameScore}");
                    TypeToConsole.WriteLine("Let the match continue, Next round! " + DealerEmoji.NextRoundFace);
                    Console.Clear();
                }
            }

            PrintFinalScore();
        }
Пример #8
0
        private void StartGame()
        {
            NewGame();

            bool playersTurn = true;

            while (playersTurn)
            {
                Console.WriteLine("Press '1' to stick or Press '2' to hit\n");

                switch (GetUserInput())
                {
                case ConsoleKey.D1:
                    playersTurn = false;
                    break;

                case ConsoleKey.D2:
                    GetPlayerNewCard();
                    playersTurn = PlayersHandTotal <= 21;
                    CheckIfBust();
                    break;

                default:
                    Console.WriteLine("Invalid input!\n");
                    break;
                }
            }

            TypeToConsole.WriteLine("Now its my turn! " + DealerEmoji.GoFace);
            DealersTurn();

            TypeToConsole.WriteLine("Ive finished my go, lets see who's won this hand! " + DealerEmoji.WhosWonFace);

            PrintGameScore();
            PrintBothHands();
        }
Пример #9
0
        private void NewGame()
        {
            Deck = new PlayingCardDeck();

            Deck.Shuffle();

            PlayersHandTotal = 0;
            PlayersHand.Clear();

            DealersHandTotal = 0;
            DealerHand.Clear();

            PlayersHand.Add(Deck.RemoveTopCard());
            DealerHand.Add(Deck.RemoveTopCard());
            PlayersHand.Add(Deck.RemoveTopCard());
            DealerHand.Add(Deck.RemoveTopCard());

            DealersHandTotal = UpdateScore(DealerHand);

            TypeToConsole.WriteLine("Your hand is -");
            PrintHand(PlayersHand);
            PlayersHandTotal = UpdateScore(PlayersHand);
            PrintPlayerScore();
        }