예제 #1
0
        // A wrapper for RandomBox that lets you open sets of random boxes
        public static void ManyRandomBoxes(int setsTotal, List <Card> cards)
        {
            List <BoxResultSet> boxSetList = new List <BoxResultSet>();
            int    numBoxes       = 0;
            double totalLegends   = 0;
            double totalEpics     = 0;
            double totalRares     = 0;
            double totalCommons   = 0;
            double averageLegends = 0.0;
            double averageEpics   = 0;
            double averageRares   = 0;
            double averageCommons = 0;

            Console.WriteLine("How many boxes?");
            try { numBoxes = Int32.Parse(Console.ReadLine()); }
            catch { IOException e; }
            { }

            for (int i = 0; i < setsTotal; i++)
            {
                BoxResultSet boxSet = RandomBoxes(cards, numBoxes);
                totalCommons += boxSet.CommonCount;
                totalRares   += boxSet.RareCount;
                totalEpics   += boxSet.EpicCount;
                totalLegends += boxSet.LegendaryCount;
                boxSetList.Add(boxSet);
            }
            averageCommons = totalCommons / boxSetList.Count;
            averageRares   = totalRares / boxSetList.Count;
            averageEpics   = totalEpics / boxSetList.Count;
            averageLegends = totalLegends / boxSetList.Count;

            OutputLog(Environment.NewLine + "-----" + Environment.NewLine + Environment.NewLine + "For this set of sets, the average amount of commons was " + averageCommons + " commons, " + averageRares + " rares, " + averageEpics + " epics, and " + averageLegends + " legendaries.");
        }
예제 #2
0
        public static BoxResultSet RandomBoxes(List <Card> cards, int numBoxes)
        {
            List <Box> boxes = new List <Box>();

            for (int i = 0; i < numBoxes; i++)
            {
                boxes.Add(new Box(cards));
            }
            BoxResultSet resultSet = new BoxResultSet(boxes);

            if (numBoxes > 1)
            {
                Utils.OutputLog(Environment.NewLine + Environment.NewLine + "This set of boxes had " + resultSet.LegendaryCount + " legendaries, " + resultSet.EpicCount + " epics, " + resultSet.RareCount + " rares, and " + resultSet.CommonCount + " commons.");
            }
            return(resultSet);
        }