Advertisement
jyoung12387

Rock Paper Scissors - Beginning

Feb 29th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace WorkingWithDates
  8. {
  9.     class Program
  10.     {
  11.         static string userChoice = "Scissors";
  12.         static string cpuChoice = "Rock";
  13.         static void Main(string[] args)
  14.         {
  15.             Console.WriteLine("User chooses {0}",userChoice);
  16.             Console.WriteLine("Computer chooses {0}", cpuChoice);
  17.             Play();
  18.             Console.ReadLine();
  19.         }
  20.         //Check to see win condition
  21.         static void Play()
  22.         {
  23.             if (userChoice == cpuChoice)
  24.                 Console.WriteLine("Tie");
  25.             else
  26.             {
  27.                 if (userChoice == "Rock" && cpuChoice == "Scissors")
  28.                     Console.WriteLine("You Win!");
  29.  
  30.                 if (userChoice == "Rock" && cpuChoice == "Paper")
  31.                     Console.WriteLine("You Lose");
  32.  
  33.                 if (userChoice == "Paper" && cpuChoice == "Rock")
  34.                     Console.WriteLine("You Win!");
  35.  
  36.                 if (userChoice == "Paper" && cpuChoice == "Scissors")
  37.                     Console.WriteLine("You Lose");
  38.  
  39.                 if (userChoice == "Scissors" && cpuChoice == "Paper")
  40.                     Console.WriteLine("You Win!");
  41.  
  42.                 if (userChoice == "Scissors" && cpuChoice == "Rock")
  43.                     Console.WriteLine("You Lose");
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement