Exemple #1
0
        // Create a list of dice
        public DiceList(int nbDices, string typeOfDice)
        {
            Type      = typeOfDice;
            DicesList = new List <int>();
            for (int i = 0; i < nbDices; i++)
            {
                DicesList.Add(Dices.BushidoDice());
            }

            TreatList();
        }
Exemple #2
0
        static public bool TestDices()
        {
            bool functionnal = true;

            int  d2 = 0, d6 = 0, bushidoDice = 0;
            long max = 1000000;

            for (int i = 0; i < max; i++)
            {
                d2          += Dices.D2();
                d6          += Dices.D6();
                bushidoDice += Dices.BushidoDice();
            }

            double average;

            if (Test.verbose)
            {
                Output.Print("Test Dices.D2:   ");
            }
            average      = (double)d2 / max;
            functionnal &= Test.TestInterval(1.49, 1.51, average);

            if (Test.verbose)
            {
                Output.Print("Test Dices.D6:   ");
            }
            average      = (double)d6 / max;
            functionnal &= Test.TestInterval(3.49, 3.51, average);

            if (Test.verbose)
            {
                Output.Print("Test Dices.bushidoDice:   ");
            }
            average      = (double)bushidoDice / max;
            functionnal &= Test.TestInterval(3.33, 3.34, average);

            if (Test.verbose && functionnal)
            {
                Output.PrintLine("Test Dices:  ok.");
            }
            else if (Test.verbose)
            {
                Output.PrintLine("Test Dices:  not ok.");
            }

            return(functionnal);
        }