Exemplo n.º 1
0
 public static void AddPlayersToGame(DiceGame diceGame, int numOfPlayers)
 {
     for (int i = 0; i < numOfPlayers; i++)
     {
         diceGame.AddPlayer(new Player()
         {
             Name  = $"Player{i + 1}",
             Score = 0
         });
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int numOfPlayer = 2;

            do
            {
                Console.Write("Enter number of players: ");
            } while (!int.TryParse(Console.ReadLine(), out numOfPlayer));

            DiceGame game = new DiceGame(2);

            for (int i = 0; i < numOfPlayer; i++)
            {
                game.AddPlayer(new Player("Player" + (i + 1)));
            }

            Console.WriteLine();

            PlayGame(game);
            Console.ReadKey();
        }