Beispiel #1
0
        private static void RunDoorSimulation()
        {
            var stopwatch = new Stopwatch();
            var choosy = new Choosy();
            var iterations = 1000000000;
            var score = new Score();
            stopwatch.Start();
            for (int i = 0; i < iterations; i++)
            {
                if (i > 1 && i % 100000 == 0)
                {
                    PrintTime(score, stopwatch, i, iterations);
                }
                var doorSim = new DoorSim(choosy);
                if (doorSim.RunDoorSimulation())
                {
                    score.Wins++;
                }
                else
                {
                    score.Losses++;
                }
            }
            stopwatch.Stop();

            PrintResults(score, stopwatch, iterations);
        }
Beispiel #2
0
 public DoorSim(Choosy choosy)
 {
     _choosy = choosy;
     DoorSet = GetNewDoorSet();
 }