public List <int> GetTicketWinningNumbers(KinoTicket kinoTicket)
        {
            if (kinoTicket == null)
            {
                throw new ArgumentNullException("kinoticket");
            }
            if (kinoTicket.SelectedKinoNumbers.Count != 6)
            {
                throw new InvalidOperationException("Kino ticket has incomplete selections.");
            }
            var drawnKinoNumbers = Draw.KinoNumbers;

            return(kinoTicket.SelectedKinoNumbers.Where(x => Draw.KinoNumbers.Contains(x)).ToList());
        }
        public bool HasWonKinoBonus(KinoTicket kinoTicket)
        {
            if (kinoTicket == null)
            {
                throw new ArgumentNullException("kinoticket");
            }


            //if (kinoTicket.PlayKinoBonus)
            //{
            //    if (kinoTicket.SelectedKinoNumbers.Contains(Draw.KinoBonus))
            //        return true;
            //}
            //return false;
        }
Exemple #3
0
        // Creates a list of tickets with random selections (1 ticket/player in list of players)
        public static List <KinoTicket> GetRandomTickets(List <Player> players, Random random)
        {
            if (players == null)
            {
                throw new ArgumentNullException("players");
            }
            KinoTicket kinoTicket        = null;
            var        randomKinoTickets = new List <KinoTicket>();

            foreach (var player in players)
            {
                kinoTicket = new KinoTicket(random.Next(1, 10001), player);
                kinoTicket.RandomizeSelections(random);
                randomKinoTickets.Add(kinoTicket);
            }
            return(randomKinoTickets);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var random         = new Random();
            var kinoManagement = new KinoManagement();

            Console.Write("Enter number of tickets: ");
            var numberOfPlayers   = Int32.Parse(Console.ReadLine());
            var randomPlayers     = Player.GetRandomPlayers(numberOfPlayers, random);
            var randomKinoTickets = KinoTicket.GetRandomTickets(randomPlayers, random);

            Console.Write("Enter times to draw: ");
            var timesToDraw = Int32.Parse(Console.ReadLine());

            //for (int i = 0; i < timesToDraw; i++)
            //{
            //    kinoManagement.RunDrawCicle(randomKinoTickets, random);
            //}

            //kinoManagement.ComputeStatistic();
            //Console.WriteLine(kinoManagement.Statistic);

            Console.WriteLine();
            randomKinoTickets.ForEach(x => Console.WriteLine(x));
        }