Esempio n. 1
0
        private static void MultipleSpinsSimulation()
        {
            Console.WriteLine("How many spins? (enter non-number to go back to main menu) ");

            var input = InputService.AcceptNumericInput(1, 100000);

            if (input < 1)
            {
                MainMenu();
            }
            else
            {
                var simulation = new MultipleSpinsSimulation(input, Player.Money);
                var result     = simulation.DoMultipleSpins();
                result.Print();

                ResetConsoleColor();
            }
        }
Esempio n. 2
0
        public BatchSimualtion(int amountOfSimulations, MultipleSpinsSimulation simulation)
        {
            var results = new List <MultipleSpinsResult>();

            for (int i = 1; i < amountOfSimulations; i++)
            {
                var multiSpin = new MultipleSpinsSimulation(simulation.MaxSpins, simulation.StartAmount);

                results.Add(multiSpin.DoMultipleSpins());
            }

            var amountProfiting = (from r in results
                                   where r.MadeProfit() == true
                                   select r).Count();

            var amountLosses = (from r in results
                                where !r.MadeProfit() == true
                                select r).Count();

            var amountBankrupt = (from r in results
                                  where r.Bancrupt == true
                                  select r).Count();

            Console.Clear();

            Console.BackgroundColor = ConsoleColor.Blue;

            Console.WriteLine($"You made a profit {amountProfiting} times");
            Console.WriteLine($"You took a loss {amountLosses} times");
            Console.WriteLine($"You went bankrupt {amountBankrupt} times");

            Console.BackgroundColor = ConsoleColor.DarkGray;
            Console.WriteLine($"Any key to continue.....");

            Console.ReadKey();
        }