Advertisement
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 RockPaperScissors1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string imputPlayer;
- string imputCPU;
- int randomInt;
- int scoreCPU = 0;
- int scorePlyer = 0;
- while (scoreCPU < 3 && scorePlyer < 3)
- {
- Console.Write("Choose between Rock,Paper and Scissors: ");
- imputPlayer = Console.ReadLine();
- Random rng = new Random();
- randomInt = rng.Next(1, 4);
- switch (randomInt)
- {
- case 1:
- imputCPU = "Rock";
- Console.WriteLine("COMPUTER CHOSE ROCK");
- if (imputPlayer == "Rock")
- {
- Console.WriteLine("DRAW!");
- }
- else if (imputPlayer == "Paper")
- {
- Console.WriteLine("PLAYER WIN!");
- scorePlyer++;
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine("COMPUTER WIN!");
- scoreCPU++;
- }
- break;
- case 2:
- imputCPU = "Paper";
- Console.WriteLine("COMPUTER CHOSE PAPER");
- if (imputPlayer == "Rock")
- {
- Console.WriteLine("COMPUTER WIN!");
- scoreCPU++;
- }
- else if (imputPlayer == "Paper")
- {
- Console.WriteLine("DRAW!");
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine("PLAYER WIN!");
- scorePlyer++;
- }
- break;
- case 3:
- imputCPU = "Scissors";
- Console.WriteLine("COMPUTER CHOSE SCISSORS");
- if (imputPlayer == "Rock")
- {
- Console.WriteLine("PLAYER WIN!");
- scorePlyer++;
- }
- else if (imputPlayer == "Paper")
- {
- Console.WriteLine("COMPUTER WIN!");
- scoreCPU++;
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine("DRAW!");
- }
- break;
- }
- Console.WriteLine("Player score :{0}",scorePlyer);
- Console.WriteLine("Computer score :{0}", scoreCPU);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement