Esempio n. 1
0
        private static void TestAmountOfPlatesWithBingoAtOnce(int AmountOfSeedsToTest, int PlatesPerEvent)
        {
            var random = new Random();

            using (CsvFileWriter writer = new CsvFileWriter("TestAmountsOfPlatesWithBingo.csv"))
            {
                CsvRow row = new CsvRow();
                row.Add("Seed");
                row.Add("AmountOfPlatesWithBingo");
                writer.WriteRow(row);
                for (int i = 0; i < AmountOfSeedsToTest; i++)
                {
                    BingoEvent TestEvent = new BingoEvent();
                    TestEvent.Initialize(RandomSeed(random), "Test nr." + i, PlatesPerEvent);
                    TestEvent.PInfo.CardList = TestEvent.PInfo.CardGenerator.GenerateCard(TestEvent.PInfo.PlatesGenerated);
                    Random rdnForEvents            = new Random();
                    int    AmountOfPlatesWithBingo = 0;
                    while (!RunTestEvent(3, TestEvent, ref AmountOfPlatesWithBingo))
                    {
                        PickRandomNumber(TestEvent, rdnForEvents);
                    }
                    //Write here
                    CsvRow resultRow = new CsvRow();
                    row.Add(TestEvent.SInfo.OriginalSeed);
                    row.Add(AmountOfSeedsToTest.ToString());
                    writer.WriteRow(row);
                }
            }
        }
Esempio n. 2
0
        private static void TestSeeds(WhatToTest condition, int AmountOfSeedsToTest, int PlatesPerEvent)
        {
            var random = new Random();

            if (condition == WhatToTest.NumberOfNumToOneRow)
            {
                using (CsvFileWriter writer = new CsvFileWriter("TestOfOneRow.csv"))
                {
                    CsvRow row = new CsvRow();
                    row.Add("Seed");
                    row.Add("AntalTal");
                    writer.WriteRow(row);
                    for (int i = 0; i < AmountOfSeedsToTest; i++)
                    {
                        BingoEvent TestEvent = new BingoEvent();
                        TestEvent.Initialize(RandomSeed(random), "Test nr." + i, PlatesPerEvent);
                        TestEvent.PInfo.CardList = TestEvent.PInfo.CardGenerator.GenerateCard(TestEvent.PInfo.PlatesGenerated);
                        Random rdnForEvents = new Random();
                        int    numbersNeededForCondition = 0;
                        while (!RunTestEvent(1, TestEvent))
                        {
                            PickRandomNumber(TestEvent, rdnForEvents);
                            numbersNeededForCondition++;
                        }
                        //Write here
                        CsvRow resultRow = new CsvRow();
                        row.Add(TestEvent.SInfo.OriginalSeed);
                        row.Add(numbersNeededForCondition.ToString());
                        writer.WriteRow(row);
                    }
                }
            }
            else if (condition == WhatToTest.NumberOfNumToPlate)
            {
                using (CsvFileWriter writer = new CsvFileWriter("TestOfPlate.csv"))
                {
                    CsvRow row = new CsvRow();
                    row.Add("Seed");
                    row.Add("AntalTal");
                    writer.WriteRow(row);
                    for (int i = 0; i < AmountOfSeedsToTest; i++)
                    {
                        BingoEvent TestEvent = new BingoEvent();
                        TestEvent.Initialize(RandomSeed(random), "Test nr." + i, PlatesPerEvent);
                        TestEvent.PInfo.CardList = TestEvent.PInfo.CardGenerator.GenerateCard(TestEvent.PInfo.PlatesGenerated);
                        Random rdnForEvents = new Random();
                        int    numbersNeededForCondition = 0;
                        while (!RunTestEvent(3, TestEvent))
                        {
                            PickRandomNumber(TestEvent, rdnForEvents);
                            numbersNeededForCondition++;
                        }
                        //Write here
                        CsvRow resultRow = new CsvRow();
                        row.Add(TestEvent.SInfo.OriginalSeed);
                        row.Add(numbersNeededForCondition.ToString());
                        writer.WriteRow(row);
                    }
                }
            }
        }