Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace tester123
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input;
- bool exit = false;
- do
- {
- do
- {
- Console.WriteLine("Please enter rock, paper or scissors");
- input = Console.ReadLine();
- }
- while (input != "Rock" && input != "Paper" && input != "Scissors");
- Console.WriteLine("Thank you for choosing {0}", input);
- Console.Beep();
- Console.ReadLine();
- Console.Clear();
- Console.Beep();
- Console.WriteLine("Do you wanna play against Computer or no means exit? Y/N?");
- string input2 = Console.ReadLine();
- if (input2 == "Y")
- {
- Random random = new Random();
- bool playAgain = true;
- String player;
- String computer;
- while (playAgain)
- {
- player = "";
- computer = "";
- while (player != "ROCK" && player != "PAPER" && player != "SCISSORS")
- {
- Console.Write("Rock, Paper or Scissors?");
- player = Console.ReadLine();
- player = player.ToUpper();
- }
- Console.WriteLine();
- switch (random.Next(1, 4))
- {
- case 1:
- computer = "Rock";
- break;
- case 2:
- computer = "Paper";
- break;
- case 3:
- computer = "Scissor";
- break;
- }
- Console.WriteLine("Player: " + player);
- Console.WriteLine("Computer: " + computer);
- }
- }
- else if (input2 == "N")
- {
- exit = true;
- }
- } while (exit == false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment