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 ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int cube1, cube2, min = int.MaxValue, players, tot = 0, winner = 0;
- Console.Write("Enter the amount of people who are going to play: ");
- players = int.Parse(Console.ReadLine());
- Random r = new Random();
- for (int i = 1; i <= players;i++)
- {
- Console.WriteLine("Player " + i + " turn");
- Console.Write("Your turn! Press enter to play to throw your first cube!");
- Console.ReadKey();
- cube1 = r.Next(1, 7);
- Console.WriteLine(cube1);
- Console.Write("Your turn! Press enter to play to throw your second cube!");
- Console.ReadKey();
- cube2 = r.Next(1, 7);
- Console.WriteLine(cube2);
- tot = tot + cube2 + cube1;
- while (cube1 != cube2)
- {
- Console.Write("Your turn! Press enter to play to throw your first cube!");
- Console.ReadKey();
- cube1 = r.Next(1, 7);
- Console.WriteLine(cube1);
- Console.Write("Your turn! Press enter to play to throw your second cube!");
- Console.ReadKey();
- cube2 = r.Next(1, 7);
- Console.WriteLine(cube2);
- tot = tot + cube2 + cube1;
- }
- if (tot < min)
- {
- min = tot;
- winner = i;
- }
- }
- Console.WriteLine(min);
- Console.WriteLine("Player " + winner + "# wins!");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment