static void Main() { String MenuChoice; Console.Clear(); Console.WriteLine("\n\t ROCK-PAPER-SCISSOR-LIZARD-SPOCK"); Console.WriteLine("\t 1.PLAY"); Console.WriteLine("\t 2.RULES"); Console.WriteLine("\t 3.EXIT"); MenuChoice = Console.ReadLine(); switch (MenuChoice) { case "1": RPSGame obj = new RPSGame(); obj.Result(); Main(); break; case "2": Console.Clear(); Console.WriteLine("General Rules of the GAME are: \n 1.Rock Beats Scissors\n 2.Paper Beats Rock\n 3.Scissors Beat Paper\n 4.Rock Beats Lizard"); Console.WriteLine(" 5.Lizard Beats Spock\n 6.Spock Beats Scissors\n 7.Scissors Beats Lizard\n 8.Lizard Beats Paper\n 9.Spock Beats Rock\n 10.Paper Beats Spock"); Console.WriteLine("\n Enter any key to go back"); Console.ReadLine(); Main(); break; case "3": Console.Clear(); Environment.Exit(-1); break; default: Console.WriteLine("Wrong Option.. Try Again\n Press Enter"); Console.WriteLine(); Main(); break; } }
static void Main(string[] args) { String MenuChoice; again: Console.Clear(); again1: Console.WriteLine("\n\t ROCK-PAPER-SCISSOR"); Console.WriteLine("\t 1.PLAY"); Console.WriteLine("\t 2.RULES"); Console.WriteLine("\t 3.EXIT"); MenuChoice = Console.ReadLine(); switch (MenuChoice) { case "1": RPSGame obj = new RPSGame(); obj.Result(); goto again; case "2": Console.Clear(); Console.WriteLine("General Rules of the GAME are: \n 1.Rock Beats Scissors\n 2.Paper Beats Rock\n 3.Scissors Beat Paper"); Console.WriteLine("\n Enter any key to go back"); Console.ReadLine(); goto again; case "3": Console.Clear(); Environment.Exit(-1); break; default: Console.WriteLine("Wrong Option.. Try Again"); goto again1; } }