Advertisement
RuslanMag

Game

Oct 3rd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 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 Game
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Rock, Paper, Scissors - the game");
  14.             Console.WriteLine("1 - Rock");
  15.             Console.WriteLine("2 - Paper");
  16.             Console.WriteLine("3 - Scissors");
  17.  
  18.             Console.WriteLine("Player 1: ");
  19.             int a = int.Parse(Console.ReadLine());
  20.             //Console.WriteLine("Player 2");
  21.             //int b = int.Parse(Console.ReadLine()); //Ввод игрока
  22.  
  23.             Random rand = new Random();
  24.             int b = rand.Next(1, 4); //Рандомный ввод          
  25.  
  26.             Console.WriteLine("Player 2: ");
  27.             Console.WriteLine(b);
  28.  
  29.             if (a == b)
  30.             {
  31.                 Console.WriteLine("Friendship wins");
  32.             }
  33.             else if (a == 1 && b == 3 || a == 2 && b == 1 || a == 3 && b == 2)
  34.             {
  35.                 Console.WriteLine("Player 1 win");
  36.             }
  37.             else
  38.             {
  39.                 Console.WriteLine("Player 2 win");
  40.             }
  41.             Console.Read();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement