using System.Collections.Generic;
protected static int _sides;
public static void setDie(int numOfSides)
public virtual int Roll()
Random res = new Random();
return res.Next(Die._sides+1);
public override int Roll()
Random res = new Random();
return res.Next(1,Die._sides+1);
public static void Winner(Player[] competitor)
List<Player> Winner = new List<Player>();
int highScore = int.MinValue;
foreach(Player player in competitor)
if(player.score > highScore)
highScore = player.score;
else if (player.score == highScore)
Console.WriteLine($"winner is {Winner[0].Name} with the score of {highScore}");
Console.WriteLine($"Its a tie: Winners are");
foreach (Player player in Winner )
Console.WriteLine($"{player.Name} with the score of {player.score}");
public static void Main()
Console.WriteLine("Welcome to the Dice Game");
Console.WriteLine("Enter the sides of the Dice");
int numSides = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the number of players");
int numOfPlayers = int.Parse(Console.ReadLine());
Player[] players = new Player[numOfPlayers];
for(int i =0; i<numOfPlayers; i++)
Console.WriteLine($"Enter the name of the Player {i+1} ");
players[i] = new Player();
players[i].Name =Console.ReadLine();
for (int i=0; i<numOfPlayers ; i++)
players[i].score = players[i].Roll();
Console.WriteLine($"{players[i].Name} score is {players[i].score}");