Example #1
0
        public void RollAndPlay()
        {
            numberOfPlayers = player.GetPlayersNumber();

            do
            {
                int id = 1;
                if (players.Count == numberOfPlayers)
                {
                    players.Clear();
                }
                for (int i = 0; i < numberOfPlayers; i++)
                {
                    pointsArray = dice.RollDice();
                    totalPoints = dice.CountPoints(pointsArray);
                    players.Add(new Player(id, pointsArray, totalPoints));
                    id++;
                }

                int max = players.Max(p => p.TotalPoints);

                var winner = players.Where(p => p.TotalPoints == max).Select(p => p.Id);
                winners = winner.ToList();
            }while (winners.Count != 1);

            PrintPoints();
            AskAgain();
        }