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;
- bool oneMore = true;
- while (oneMore)
- {
- 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!\n");
- }
- else if (imputPlayer == "Paper")
- {
- Console.WriteLine(" PLAYER WIN!\n");
- scorePlyer++;
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine(" COMPUTER WIN!\n");
- scoreCPU++;
- }
- break;
- case 2:
- imputCPU = "Paper";
- Console.WriteLine("COMPUTER CHOSE PAPER");
- if (imputPlayer == "Rock")
- {
- Console.WriteLine(" COMPUTER WIN!\n");
- scoreCPU++;
- }
- else if (imputPlayer == " Paper")
- {
- Console.WriteLine(" DRAW!\n");
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine(" PLAYER WIN!\n");
- scorePlyer++;
- }
- break;
- case 3:
- imputCPU = "Scissors";
- Console.WriteLine("COMPUTER CHOSE SCISSORS");
- if (imputPlayer == "Rock")
- {
- Console.WriteLine(" PLAYER WIN!\n");
- scorePlyer++;
- }
- else if (imputPlayer == "Paper")
- {
- Console.WriteLine(" COMPUTER WIN!\n");
- scoreCPU++;
- }
- else if (imputPlayer == "Scissors")
- {
- Console.WriteLine(" DRAW!/n");
- }
- break;
- }
- Console.WriteLine("Player score :{0}\n\n", scorePlyer);
- Console.WriteLine("Computer score :{0}\n\n", scoreCPU);
- }
- scoreCPU = 0;
- scorePlyer = 0;
- Console.WriteLine("One More Game? Y/N ");
- string playAgain = Console.ReadLine();
- if (playAgain == "Y")
- {
- }
- else if (playAgain == "N")
- {
- oneMore = false;
- }
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement