public void CalculatePoints([Values(1)] int input, [Values(1)] int deckCount, [Values("Denis")] string clientName) { Game game = new Game(); game.NewGame(); Croupier croupier = new Croupier(1); croupier.TakeCard(new Card() { Name = "5", Suit = "Heart", Value = 5 }); croupier.TakeCard(new Card() { Name = "T", Suit = "Heart", Value = 11 }); croupier.TakeCard(new Card() { Name = "T", Suit = "Heart", Value = 11 }); croupier.TakeCard(new Card() { Name = "T", Suit = "Heart", Value = 11 }); croupier.TakeCard(new Card() { Name = "10", Suit = "Heart", Value = 10 }); Assert.AreEqual(18, croupier.CalculatePoints()); }
public void ComparePoints([Values(19)] int clientPoints) { Croupier croupier = new Croupier(1); croupier.TakeCard(new Card() { Name = "T", Suit = "Heart", Value = 11 }); croupier.TakeCard(new Card() { Name = "Q", Suit = "Heart", Value = 10 }); Assert.AreEqual("LOSE!", croupier.ComparePoints(clientPoints)); }
private void StartGame() { Cards deck = new Cards(); // Creating new deck Croupier croupier = new Croupier(); // initalizing croupier Player player = new Player(); //initializing player // Croupiter starting round croupier.TakeCard(deck.AllCards); // Croupier is taking one card //Player round for (int i = 1; i <= 2; i++) // player starts with 2 cards { player.TakeCard(deck.AllCards); } int option = 1; bool guard = true; while (guard) { Console.Clear(); Console.WriteLine("Croupier Hand:"); croupier.DrawCroupierHand(); croupier.WriteHandPoints(); Console.WriteLine("Player Hand:"); player.DrawHand(); player.WriteHandPoints(); PlayerRound(ref option, player, deck.AllCards, ref guard); } // croupiers ends his round Console.Clear(); Console.WriteLine("----Croupier Round----"); croupier.TakeCards(deck.AllCards); //summary Console.Clear(); Console.WriteLine("---Croupier Hand---"); croupier.DrawHand(); croupier.WriteHandPoints(); Console.WriteLine("Player Hand:"); player.DrawHand(); player.WriteHandPoints(); Console.WriteLine("----------Summary----------"); Console.WriteLine($"Croupier Points: {croupier.Points}"); Console.WriteLine("------"); Console.WriteLine($"Player Points: {player.Points}"); Console.WriteLine("--------------------------"); Console.Write("The winner is... "); Thread.Sleep(500); if (CheckWinner(croupier, player) == 0) { Console.BackgroundColor = ConsoleColor.DarkRed; Console.WriteLine("Croupier!"); } else if (CheckWinner(croupier, player) == 1) { Console.BackgroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Player! You won!"); } else { Console.BackgroundColor = ConsoleColor.DarkYellow; Console.WriteLine("No one! Draw!"); } Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.White; if (CheckBJ(croupier)) { Console.WriteLine("Croupier has Black Jack! Congratulations!"); } else if (CheckBJ(player)) { Console.WriteLine("Player has Black Jack! Congratulations!"); } Console.ResetColor(); Console.WriteLine("Press any key to return to menu..."); }