Beispiel #1
0
 private static void CompleteOutcomeSimulation(int totalWeight, int usedWeight, List <int> results)
 {
     //the order of these do matter.
     WeightedNamedOutcome.Outcomes = Uncategorized.AddNothingOutcome(WeightedNamedOutcome.Outcomes, totalWeight, usedWeight);
     WeightedNamedOutcome.Outcomes = ResultAndOutcomeMerger.AssignNumberRangeToOutcomes(WeightedNamedOutcome.Outcomes);
     WeightedNamedOutcome.Outcomes = ResultAndOutcomeMerger.AssignResultsToOutcomes(results, WeightedNamedOutcome.Outcomes);
     WeightedNamedOutcome.Outcomes = Uncategorized.SetMultipleChanceToOccur(WeightedNamedOutcome.Outcomes, totalWeight);
 }
Beispiel #2
0
        public void Init()
        {
            outcomes.Add(new WeightedNamedOutcome("Stian1", 1, false));
            outcomes.Add(new WeightedNamedOutcome("Stian2", 2, false));
            outcomes.Add(new WeightedNamedOutcome("Stian3", 3, false));
            outcomes.Add(new WeightedNamedOutcome("Stian4", 4, false));
            outcomes.Add(new WeightedNamedOutcome("Stian5", 5, false));
            outcomes.Add(new WeightedNamedOutcome("Stian6", 6, false));
            outcomes.Add(new WeightedNamedOutcome("Stian7", 7, false));
            outcomes.Add(new WeightedNamedOutcome("Stian8", 8, false));
            outcomes.Add(new WeightedNamedOutcome("Stian9", 9, false));
            outcomes.Add(new WeightedNamedOutcome("Stian10", 10, false));

            results.Add(1);
            results.Add(1);

            results.Add(2);
            results.Add(3);

            results.Add(4);
            results.Add(6);

            results.Add(7);
            results.Add(10);

            results.Add(11);
            results.Add(15);

            results.Add(16);
            results.Add(21);

            results.Add(22);
            results.Add(28);

            results.Add(29);
            results.Add(36);

            results.Add(37);
            results.Add(45);

            results.Add(46);
            results.Add(55);

            results.Add(56);
            results.Add(110);

            outcomes = Uncategorized.AddNothingOutcome(outcomes, totalWeight, Uncategorized.GetTotalCombinedWeight(outcomes));
            outcomes = ResultAndOutcomeMerger.AssignNumberRangeToOutcomes(outcomes);
        }
Beispiel #3
0
        public void Assert_that_occurances_are_correct()
        {
            BindingList <WeightedNamedOutcome> outcomeResults = ResultAndOutcomeMerger.AssignResultsToOutcomes(results, outcomes);

            int[] expected = new int[outcomeResults.Count];
            int[] result   = new int[outcomeResults.Count];

            for (int i = 0; i < expected.Length; i++)
            {
                expected[i] = 2;
            }

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = outcomeResults[i].Occurances;
                Console.WriteLine(outcomeResults[i].ToString() + " | occurances:" + outcomeResults[i].Occurances);
            }

            CollectionAssert.AreEqual(expected, result);
        }