예제 #1
0
        public static void Main(string[] args)
        {
            var randomGenerator   = RandomGenerator.Instance;
            var slotGenerator     = new SlotGenerator(randomGenerator);
            var winningCalculator = new WinningsCalculator();
            var slotsPrinter      = new SlotsPrinter();
            var player            = new Player();

            decimal balance;

            UserInputValidation(slotsPrinter.BeginningDepositMessage, player.Deposit, out balance);

            while (player.Balance > 0)
            {
                decimal stake;
                UserInputValidation(slotsPrinter.StakeAmountMessage, player.Stake, out stake);

                var slots = slotGenerator.GenerateSlots(NumberOfSlots);
                Console.WriteLine(slotsPrinter.SlotsAsString(slots));

                var winnigs = winningCalculator.CalcWinnigs(slots, stake);
                player.Win(winnigs);
                Console.WriteLine(slotsPrinter.GetWinningsMessage(winnigs));

                Console.WriteLine(slotsPrinter.GetCurrentBalanceMessage(player.Balance));
                Console.WriteLine();
            }

            Console.WriteLine();
        }