public static void Flip() { int playerValue;//Value of players hand int dealerValue;//Value of dealer hand
//START FLIP LOOP foreach (KeyValuePair<string, int> playerPair in playerHand) { foreach (KeyValuePair<string, int> dealerPair in dealerHand) { if (playerHand.TryGetValue(playerPair.Key, out playerValue) & dealerHand.TryGetValue(dealerPair.Key, out dealerValue)) { Console.WriteLine("Player draw: {0}, {1}", playerPair.Key, playerPair.Value); Console.WriteLine("Dealer draw: {0}, {1}", dealerPair.Key, dealerPair.Value); if (playerValue > dealerValue) { playerTotal++; dealerTotal--; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nPlayer Score: " + playerTotal); Console.WriteLine("Dealer Score: " + dealerTotal); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\n{0} Player hand is GREAT than dealer hand {1}. Player wins round.", playerPair.Key, dealerPair.Key); //Update(); } if (playerValue < dealerValue) { playerTotal--; dealerTotal++; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nPlayer Score: " + playerTotal); Console.WriteLine("Dealer Score: " + dealerTotal); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\n{0} Player hand is LESS than dealer hand {1}. Dealer wins round.", playerPair.Key, dealerPair.Key); //Update(); } Console.ReadLine(); } } } }
|