Hey all,
I have created a group of player using a list within a list method. But now I'm stuck on dealing out the cards. Here is the code for setting up the players:
static Random r = new Random();
static int numPlayers;
static List<List<string>> playersHands = new List<List<string>>();
static void setNumPlayers()
{
Console.Write("Please Enter the Number of Players Between 2 and 52: ");
numPlayers = Convert.ToInt16(Console.ReadLine());
if (numPlayers < 2 || numPlayers > 52)//only loops through once
{
Console.WriteLine("Please enter a value between 2 and 52: ");
numPlayers = Convert.ToInt16(Console.ReadLine());
}
else
{
Console.WriteLine("NUM PLAYERS: " + numPlayers);
List<string> p = new List<string>();
for (int i = 1; i <= numPlayers; i++)
{
var name = "p" + i;
p.Add(name);
}
playersHands.Add(p);
p.ForEach(Console.WriteLine);//for 2 players outputs p1 p2
}
}
Thanks