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;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- public static List<String> options = new List<String>() { "Stone", "Paper", "Scissors", "Spock", "Lizard", "Uncknow1", "Uncknow2", "Uncknow3", "Uncknow4" };
- public static List<String> results = new List<String>();
- static public int Mod(int a, int b)
- {
- if (a >= 0) return a % b;
- else return b - a % b;
- }
- static void Main(string[] args)
- {
- int range, playerChoice = -1, act = 0;
- Console.WriteLine("Enter number of move: ");
- while (!int.TryParse(Console.ReadLine(),out range)
- || (range < 3 || range > options.Count || range % 2 == 0))
- Console.WriteLine("Error. Print again!");
- while(playerChoice != 0)
- {
- Random random = new Random();
- int compChoice = random.Next(0, options.Capacity - 1);
- while (!int.TryParse(Console.ReadLine(), out playerChoice)
- || (playerChoice < 0 || playerChoice > range))
- Console.WriteLine("Error. Print again!");
- if (Mod((playerChoice - 1) - compChoice, options.Capacity) == 0) results.Add("act " + ++act + ": " + "Draw.");
- if (Mod((playerChoice - 1) - compChoice, options.Capacity) % 2 == 1) results.Add("act " + ++act + ": " + "Win.");
- else results.Add("act " + ++act + ": " + "Lose.");
- }
- results.ForEach(x => Console.WriteLine(x));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement