static void Main(string[] args) { bool loop = true; while (loop == true) { Random random = new Random(); PlayGame PlayGame = new PlayGame(); Console.Clear(); Console.WriteLine("--------------- Rock, Paper, Scissors ---------------"); var p1 = PlayGame.PlayerChoice(); var c1 = PlayGame.ComputerChoice(random); PlayGame.Calculate(p1, c1); loop = PlayGame.PromptNewGame(); } }
static void Main() { var game = new PlayGame(); var userGuess = string.Empty; var rps = new Random(); var userScore = 0; var computerscore = 0; while (userGuess != "quit") { Console.Clear(); Console.Write("Enter \"Rock\", \"Paper\", \"Scissors\" or \"Quit\": "); userGuess = Console.ReadLine()?.ToLower(); if (userGuess != "rock" && userGuess != "paper" && userGuess != "scissors" && userGuess != "quit") { Console.WriteLine("Must enter Rock, Paper, Scissors or Quit"); Console.Write("Press Enter to continue"); Console.ReadLine(); continue; } var computerGuess = rps.Next(1, 4); if (userGuess == "rock") { game.Rock(computerGuess); } else if (userGuess == "paper") { game.Paper(computerGuess); } else if (userGuess == "scissors") { game.Scissors(computerGuess); } } }