private void PrintBothHands() { TypeToConsole.WriteLine("My hand was -"); PrintHand(DealerHand); TypeToConsole.WriteLine("\nYour hand was -"); PrintHand(PlayersHand); }
private void GetPlayerNewCard() { PlayersHand.Add(Deck.RemoveTopCard()); TypeToConsole.WriteLine("Your hand -"); PrintHand(PlayersHand); PlayersHandTotal = UpdateScore(PlayersHand); PrintPlayerScore(); }
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); } }
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}."); } }
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); } }
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(); }
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(); }
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(); }
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(); }