Exemple #1
0
        public void Run()
        {
            // Test: Roll dice several times, and run all evaluators for each roll
            for (int i = 0; i < 1000; i++)
            {
                // Roll dice
                _cup.Shake();

                // Pick up evaluations
                DiceEvaluation diceEval = new DiceEvaluation(_cup.DiceFaceValues);

                // Run each evaluator against the dice
                foreach (var eval in _diceEvaluators)
                {
                    string         evalDescription = eval.Key;
                    IDiceEvaluator iDiceEval       = eval.Value;
                    int            points          = iDiceEval.Evaluate(_cup.DiceCountByFaceValue);

                    diceEval.AddEvaluation(evalDescription, points);
                }

                // Add this evaluation to stats
                _evaluationStats.AddEvaluation(diceEval);
            }

            // Print total evaluations
            Console.WriteLine(_evaluationStats);
            // Console.WriteLine(_evaluationStats.FilterStats(new List<string>{ "Tower" }));
        }
 public void AddEvaluation(DiceEvaluation diceEval)
 {
     _evaluations.Add(diceEval);
 }