Esempio n. 1
0
        public static void GetRollSums(int[] values)
        {
            int[] dieSums = new int[values[0]];     // Create an array the size of the number of rolls (dieValues[0]);
            int   d1Value, d2Value = 0;             // Holds the return of RollDie() for each die.

            Die d1 = new Die(values[1], values[2]); // Create first die object with minValue and maxValue
            Die d2 = new Die(values[1], values[2]); // Create second die object with minValue and maxValue

            for (int i = 0; i < values[0]; i++)     // Roll each die dieValues[0] times and insert
            {                                       // the sums into the dieSums array.
                d1Value    = d1.RollDie();
                d2Value    = d2.RollDie();
                dieSums[i] = d1Value + d2Value;
            }

            GetDuplicates(dieSums);
        }