Beispiel #1
0
 static void Main(string[] args)
 {
     r                       = new Random();
     Deck                    = new CardDeck();
     Table                   = new DisplayTable();
     computerPlayers         = new List <Player>();
     players                 = new List <Player>();
     Console.ForegroundColor = ConsoleColor.White;
     Console.Write("Enter your name: ");
     player = new HumanPlayer(Console.ReadLine(), Table);
     do
     {
         Console.Write("Enter number of Computer players (3-5): ");
         try
         {
             numComps = Convert.ToInt32(Console.ReadLine());
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
             numComps = 0;
         }
     } while (numComps < 3 || numComps > 5);
     //Create numComps computer players
     for (int i = 0; i < numComps; ++i)
     {
         ComputerPlayer cp = new ComputerPlayer("Computer_" + i, Table);
         computerPlayers.Add(cp);
     }
     Go();
     Console.WriteLine("\nThanks for playing!");
     Console.WriteLine("Press any key to continue . . . ");
     Console.ReadLine();
 }
Beispiel #2
0
 public Player(string name, DisplayTable dt)
 {
     Name          = name;
     hand          = new HandRow[4];
     hand[0]       = new HandRow(dt.DisplayCards[0]);
     hand[1]       = new HandRow(dt.DisplayCards[1]);
     hand[2]       = new HandRow(dt.DisplayCards[2]);
     hand[3]       = new HandRow(dt.DisplayCards[3]);
     validIndecies = new bool[13];
     NumCards      = 0;
 }
Beispiel #3
0
 public ComputerPlayer(string name, DisplayTable dt)
     : base(name, dt)
 {
 }
Beispiel #4
0
 public HumanPlayer(string name, DisplayTable dt)
     : base(name, dt)
 {
 }