Пример #1
0
        public List <NumbersOfDraw> CreateNumbersOfDraw(Random random) // Μέθοδος δημιουργίας λίστας κληρώσεων που περιέχει αντικείμενα κληρώσεων
        {
            var listObjectOfDrawNumbers = new List <NumbersOfDraw>();
            var list_ID_Draw            = new List <int>();
            int count        = 1;
            int randomNumber = random.Next(lowerDrawNumber, upperDtawNumber);

            while (count <= randomNumber)
            {
                NumbersOfDraw numbersOfDraw = new NumbersOfDraw() // Δημιουργία αντικειμένου κληρώσεων
                {
                    listOfDrawNumbers = new List <int>(),
                    ΙD_Draw           = Create_ID_Numbers_Of_Draw(random)
                };
                numbersOfDraw.listOfDrawNumbers = CreateRandomNumbers(numbersPerdraw, random); // Γέμισμα κλήρωσης με αριθμούς
                listObjectOfDrawNumbers.Add(numbersOfDraw);                                    // Προσθήκη κλήρωσης στη λίστα κληρώσεων

                while (list_ID_Draw.Contains(numbersOfDraw.ΙD_Draw))
                {
                    numbersOfDraw.ΙD_Draw = Create_ID_Numbers_Of_Draw(random);
                }
                list_ID_Draw.Add(numbersOfDraw.ΙD_Draw);
                count += 1;
            }
            return(listObjectOfDrawNumbers);
        }
Пример #2
0
        public static void WinninigTicketPerDraw()
        {
            double initialAmount = 100000;

            WinningColumnPerKinoTicket winningColumnPerTicket = new WinningColumnPerKinoTicket();
            Random        random                  = new Random();
            NumbersOfDraw numbeRsOfDraw           = new NumbersOfDraw();
            KinoTicket    kiNoTicket              = new KinoTicket();
            Result        result                  = new Result();
            Statistics    statistics              = new Statistics();
            double        jackPot                 = 0;
            var           listNumbersOfDraw       = numbeRsOfDraw.CreateNumbersOfDraw(random); // Λίστα που περιέχει μέσα της τις κληρώσεις. (Λίστα που περιέχει αντικείμενα δηλ κληρώσεων)
            var           listNumbersOfKinoTicket = kiNoTicket.CreateKinoTickets(random);      // Λίστα που περιέχει μέσα της τα δελτία συμπληρωμένα με αριθμούς. (Λίστα που περιέχει αντικείμενα δηλ δελτία)

            foreach (NumbersOfDraw numbersOfDraw in listNumbersOfDraw)
            {
                initialAmount += jackPot;
                var listOfwinningsColumnsPerTicket = new List <WinningColumnPerKinoTicket>(); // Αρχικοποιώ εδώ τη λίστα με τους κερδισμένους αριθμούς γιατί θέλω αποτελέσματα για κάθε κλήρωση και όχι γενικά αποτελέσματα για όλες τις κληρώσεις!!!!
                foreach (KinoTicket kinoTicket in listNumbersOfKinoTicket)
                {
                    winningColumnPerTicket = winningColumnPerTicket.CreatWinningColumnPerKinoTicket(); // Δημιουργεία νικητήριας στήλης κάθε δελτίου
                    foreach (int numberOfkinoticket in kinoTicket.listNumbersOfTicket)
                    {
                        //Console.Write(numberOfkinoticket + " ");
                        if (numbersOfDraw.listOfDrawNumbers.Contains(numberOfkinoticket))
                        {
                            winningColumnPerTicket.ListWinningsNumbers.Add(numberOfkinoticket);  // Νικητήρια στήλη κάθε δελτίου
                            if (winningColumnPerTicket.ListWinningsNumbers.Contains(numbersOfDraw.listOfDrawNumbers[11]))
                            {
                                winningColumnPerTicket.FoundKinoBonus = true;
                            }
                        }
                    }
                    listOfwinningsColumnsPerTicket.Add(winningColumnPerTicket);
                }
                jackPot = result.SortingByDraw(listOfwinningsColumnsPerTicket, initialAmount, numbersOfDraw); // Ανα κλήρωση καλώ τη μέθοδο SortingByDraw
            }
            statistics.GetStatistics(listNumbersOfDraw);
        }
Пример #3
0
        public double SortingByDraw(List <WinningColumnPerKinoTicket> listResultPerDrawPerKinoTicket, double initialAmount, NumbersOfDraw numbersOfDraw)
        {
            SortingMoneyPerDraw sortingMoneyPerDraw = new SortingMoneyPerDraw();
            List <Result>       listObjectOfProfitPerTicket = new List <Result>();
            int c1_KB = 0, c2_KB = 0, c3_KB = 0, c4_KB = 0, c5_KB = 0, c6_KB = 0, c7_KB = 0, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0;

            foreach (WinningColumnPerKinoTicket winningNumbersPerKinoTicketsPerDraw in listResultPerDrawPerKinoTicket)
            {
                var category = CreateResulutPerDraw();
                if (winningNumbersPerKinoTicketsPerDraw.FoundKinoBonus)
                {
                    switch (winningNumbersPerKinoTicketsPerDraw.ListWinningsNumbers.Count)
                    {
                    case (int)Category.firstCategory:
                        c1_KB           += 1;
                        category.Percent = firstCategoryWithKB;
                        break;

                    case (int)Category.secondCategory:
                        c2_KB           += 1;
                        category.Percent = secondCategoryWithKB;
                        break;

                    case (int)Category.thirdCategory:
                        c3_KB           += 1;
                        category.Percent = thirdCategoryWithKB;
                        break;

                    case (int)Category.fourthCategory:
                        c4_KB           += 1;
                        category.Percent = fourthCategoryWithKB;
                        break;

                    case (int)Category.fifthCategory:
                        c5_KB           += 1;
                        category.Percent = fifthCategoryWithKB;
                        break;

                    case (int)Category.sixthCategory:
                        c6_KB           += 1;
                        category.Percent = sixthCategoryWithKB;
                        break;

                    case (int)Category.seventhCategory:
                        c7_KB += 1;
                        break;
                    }
                }
                else
                {
                    switch (winningNumbersPerKinoTicketsPerDraw.ListWinningsNumbers.Count)
                    {
                    case (int)Category.firstCategory:
                        c1 += 1;
                        category.Percent = firstCategory;
                        break;

                    case (int)Category.secondCategory:
                        c2 += 1;
                        category.Percent = secondCategory;
                        break;

                    case (int)Category.thirdCategory:
                        c3 += 1;
                        category.Percent = thirdCategory;
                        break;

                    case (int)Category.fourthCategory:
                        c4 += 1;
                        category.Percent = fourthCategory;
                        break;

                    case (int)Category.fifthCategory:
                        c5 += 1;
                        category.Percent = fifthCategory;
                        break;

                    case (int)Category.sixthCategory:
                        c6 += 1;
                        category.Percent = sixthCategory;
                        break;

                    case (int)Category.seventhCategory:
                        c7 += 1;
                        break;
                    }
                }
                listObjectOfProfitPerTicket.Add(category);
            }
            double jackPot = sortingMoneyPerDraw.PrintReSult(c1_KB, c2_KB, c3_KB, c4_KB, c5_KB, c6_KB, c7_KB, c1, c2, c3, c4, c5, c6, c7, initialAmount, numbersOfDraw);

            return(jackPot);
        }
Пример #4
0
        public double PrintReSult(int c1_KB, int c2_KB, int c3_KB, int c4_KB, int c5_KB, int c6_KB, int c7_KB,
                                  int c1, int c2, int c3, int c4, int c5, int c6, int c7, double initialAmount, NumbersOfDraw numbersOfDraw)
        {
            var sortingMoneyPerDraw = CreateObjectSortingMoneyPerDraw();

            string[] categorys =
            { "6 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c1_KB, firstCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "5 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c2_KB, secondCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "4 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c3_KB, thirdCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "3 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c4_KB, fourthCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "2 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c5_KB, fifthCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "1 / 6 νούμερα (+ KB), και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c6_KB, sixthCategoryWithKB, initialAmount, sortingMoneyPerDraw):0.000}" + "}$" + "\n",

              "6 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c1, firstCategory, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "5 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c2, secondCategory, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "4 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c3, thirdCategory, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "3 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c4, fourthCategory, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "2 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c5, fifthCategory, initialAmount, sortingMoneyPerDraw):0.00}" + "}$",
              "1 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {"
              + $"{CalculationProfitPerPlayer(c6, sixthCategory, initialAmount, sortingMoneyPerDraw):0.000}" + "}$",
              "0 / 6 νούμερα, και ο κάθε παίχτης/ες κερδίζει {" + "0" + "} $" + "\n" };

            int[] WinningsNumbersPerCategory = { c1_KB, c2_KB, c3_KB, c4_KB, c5_KB, c6_KB, c7_KB, c1, c2, c3, c4, c5, c6, c7 };

            var resultPerDraw = categorys.Zip(WinningsNumbersPerCategory, (category, winningNumbers)
                                              => $"Υπάρχουν {winningNumbers} παίχτης/ες που έπιασαν {category}");

            Charity = CalculationCharity(initialAmount);

            Console.WriteLine("\n\t\t\t\t\t" + "    *ID Draw: {"
                              + $"{ numbersOfDraw.ΙD_Draw}" + "}*" + "\n" + "\n" + "\t\t\t\t\t" + "Draw Amount: {" + $"{(initialAmount):0.00}" + "}");
            Console.WriteLine("\t\t\t\t\t" + "Amount Charity: {" + $"{(Charity):0.00}" + "}" + "\n" + "\t\t\t\t" + "   ------------------------------------" + "\n");

            resultPerDraw.ToList().ForEach(i => Console.WriteLine("\t" + i));

            double totalMoneyWhereGivenPerDraw = sortingMoneyPerDraw.listMoneyPerCategory.Sum();

            JackPot = CalculationJackPot(totalMoneyWhereGivenPerDraw, CalculationPercentPerCategory(initialAmountPerCent) * initialAmount);
            Console.WriteLine("\t" + $"Jack Pot: {(JackPot):0.00}");
            return(JackPot);
        }