public void PlayGame(string pchoice) { PickCompChoice(); switch (pchoice) { case "Rock": playerChoice = Choices.ROCK; break; case "Paper": playerChoice = Choices.PAPER; break; case "Scissors": playerChoice = Choices.SCISSORS; break; case "Spock": playerChoice = Choices.SPOCK; break; case "Lizard": playerChoice = Choices.LIZARD; break; } switch (GetWinner()) { case Outcome.PLAYERWIN: EndingMessage = "You win!"; break; case Outcome.COMPWIN: EndingMessage = "You lose."; break; case Outcome.TIE: EndingMessage = "It's a tie.\nPlay again."; break; } }
/// <summary> /// Returns the choice that the player entered. /// Defaults to ROCK (1) /// </summary> /// <param name="choice"><see cref="Choices"/></param> /// <returns></returns> private static Choices PlayerChoice(ConsoleKey choice) { Choices PlayerChoice = Choices.none; switch (choice) { default: case (ConsoleKey.D1): PlayerChoice = Choices.Rock; break; case (ConsoleKey.D2): PlayerChoice = Choices.Paper; break; case (ConsoleKey.D3): PlayerChoice = Choices.Scissors; break; } return(PlayerChoice); }