static void Main(string[] args) { Random_Player playerRandom = new Random_Player(); playerRandom.Name = "Randominater"; Rock_Player playerRock = new Rock_Player(); playerRock.Name = "RockKroc"; Roshambo rockPlay = playerRock.GenerateRoshambo(); User_Player playerUser = new User_Player(); Console.WriteLine("Please enter your name: "); playerUser.Name = Console.ReadLine(); do { Roshambo randomPlay = playerRandom.GenerateRoshambo(); string userInput = Validator.OpponentSelector(); Roshambo userPlay = playerUser.GenerateRoshambo(); switch (userInput) { case "1": case "Randominater": VersusRandomOpponent(playerRandom, playerUser, randomPlay, userPlay); break; case "2": case "RockKroc": VersusRockOpponent(playerRock, playerUser, rockPlay, userPlay); break; } string goAgain = Validator.GetUserInput("Would you like to play again? (y/n)?"); if (goAgain == "n") { more = false; } else { more = true; } }while (more); Console.WriteLine("Have a good day!"); }
public static void VersusRockOpponent(Rock_Player playerRock, User_Player playerUser, Roshambo rockPlay, Roshambo userThrow) { if (rockPlay == Roshambo.Rock && userThrow == Roshambo.Rock) { Console.WriteLine($"{playerRock.Name} threw Rock and {playerUser.Name} threw {userThrow}."); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("It's A Tie"); Console.ResetColor(); ties++; } if (rockPlay == Roshambo.Rock && userThrow == Roshambo.Paper) { Console.WriteLine($"{playerRock.Name} threw Rock and {playerUser.Name} threw {userThrow}."); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"{playerUser.Name} Wins"); Console.ResetColor(); userWins++; } if (rockPlay == Roshambo.Rock && userThrow == Roshambo.Scissors) { Console.WriteLine($"{playerRock.Name} threw Rock and {playerUser.Name} threw {userThrow}."); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{playerRock.Name} Wins"); Console.ResetColor(); rockKrocWins++; } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("RockKroc Wins" + rockKrocWins); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"{playerUser.Name} Wins" + userWins); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Tie Wins" + ties); }