예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddSingleton <SlotMachine, BedeSlotMachine>(serviceProvider =>
            {
                var machine = new BedeSlotMachine();
                machine.SetupSlotTypes(new List <ISlot>()
                {
                    new Slot("B", 0.6m, 35),
                    new Slot("*", 0.0m, 5),
                    new Slot("P", 0.8m, 15),
                    new Slot("A", 0.4m, 45)
                });

                return(machine);
            });


            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }
예제 #2
0
        private static void Play()
        {
            Console.WriteLine("Please deposit money you would like to play with: ");
            var deposit = Int32.Parse(Console.ReadLine());

            var stake = 0;

            do
            {
                Console.WriteLine("\r\nEnter stake amount: ");
                stake = Int32.Parse(Console.ReadLine());
                BedeSlotMachine bede       = new BedeSlotMachine();
                var             spinResult = bede.SpinBedeSlotMachine();
                var             amountWon  = bede.CalculateWinnings(spinResult, deposit, stake);

                int rowCount    = spinResult.Count;
                int columnCount = spinResult.First().Count;

                for (int i = 0; i < columnCount; i++)
                {
                    for (int j = 0; j < rowCount; j++)
                    {
                        Console.Write(spinResult[j][i].Name + " ");
                    }
                    Console.WriteLine();
                }

                Console.WriteLine("\r\nYou have won: " + amountWon.AmountWon);
                Console.WriteLine("\r\nYour current balance is: " + amountWon.CurrentBalance);
            }while (stake > deposit || deposit != 0);
        }
예제 #3
0
 public IWinningsTests()
 {
     _Bede = new BedeSlotMachine();
 }