Esempio n. 1
0
        public static int tasteRatio(Player player, Day day)
        {
            int tastenumber = 0;

            if (day.DayWeather.condition == "Sunny" && day.GetTemperature() > +90 && (player.PlayerRecipe.amountofLemons) / (player.PlayerRecipe.amountogSugarCubes) == 2)
            {
                tastenumber += 2;
            }
            return(tastenumber);
        }
Esempio n. 2
0
        public Player RunSimulation(Player player, Day day)
        {
            int    timeHour                  = 0;
            double totalpopulatorVote        = 0;
            int    totalPitchers             = CountPitcher(player1);
            int    hourlypurchasingCustomers = 0;


            for (int i = 1; i < 10; i++) //9 hours of gameplay
            {
                timeHour = i;

                Console.WriteLine("Day " + day.name + " Hour " + i + " Weather " + day.DayWeather.condition + " Temperature " + day.GetTemperature() + " Wallet " + player1.PlayerWallet.GetMoney()); //userinterface

                Random customers       = new Random();
                int    hourlyCustomers = customers.Next(8, 20);

                for (int j = 0; j <= hourlyCustomers - 1; j++)//new amount of customers every hour that purchase
                {
                    //////////////////////////////////////////////////////////////////////////////////////////////////
                    Customer customer = new Customer(day.DayWeather.condition, day.GetTemperature(), player1.PlayerRecipe.pricePerCup);
                    //each customer should return different

                    ///////////////////////////////////////////////////////////////////////////////////////////////////
                    ///
                    //profit update after a purchase
                    if (customer.doesPurchase == true)
                    {
                        player1.PlayerPicther.cupsleftInPitcher--;
                        player1.PlayerWallet.SetMoney(-player1.PlayerRecipe.pricePerCup);
                        player1.BusinessProfits += (player1.PlayerRecipe.pricePerCup);

                        hourlypurchasingCustomers += 1;
                    }

                    //there has to be a pitcher check after each customer
                    if (player1.PlayerPicther.cupsleftInPitcher == 0)
                    {
                        for (int k = 0; k < player1.PlayerRecipe.amountofLemons - 1; k++) //deleting the amount of lemons of the recipe from the inventory everytime a pitcher is consumed
                        {
                            //player1.PlayerInventory.lemons -= player1.PlayerRecipe.amountofLemons;
                            if (player1.PlayerRecipe.amountofLemons >= player1.PlayerInventory.lemons.Count)
                            {
                                totalCustomers += hourlyCustomers;           //adds hourly customers total guests
                                totalPurchases += hourlypurchasingCustomers; //adds hourly purchasing guests to total purchasing guests

                                Console.WriteLine("SOLD OUT");
                                Console.WriteLine("Amount of people " + hourlyCustomers + " Purchases " + hourlypurchasingCustomers);
                                //break or continue to break run simulation function
                                totalCustomers = 0;
                                totalPurchases = 0;
                                return(player1);
                            }
                            else
                            {
                                player1.PlayerInventory.lemons.RemoveAt(k);
                            }
                        }

                        for (int k = 0; k < player1.PlayerRecipe.amountogSugarCubes - 1; k++)
                        {
                            if (player1.PlayerRecipe.amountogSugarCubes >= player1.PlayerInventory.sugarcubes.Count)
                            {
                                totalCustomers += hourlyCustomers;           //adds hourly customers total guests
                                totalPurchases += hourlypurchasingCustomers; //adds hourly purchasing guests to total purchasing guests

                                Console.WriteLine("SOLD OUT");

                                Console.WriteLine("Amount of people " + hourlyCustomers + " Purchases " + hourlypurchasingCustomers);
                                totalCustomers = 0;
                                totalPurchases = 0;
                                return(player1);
                            }
                            else
                            {
                                player1.PlayerInventory.sugarcubes.RemoveAt(k);
                            }
                        }

                        for (int k = 0; k < player1.PlayerRecipe.amountOfIceCubes - 1; k++)
                        {
                            if (player1.PlayerRecipe.amountOfIceCubes >= player1.PlayerInventory.icecubes.Count)
                            {
                                totalCustomers += hourlyCustomers;           //adds hourly customers total guests
                                totalPurchases += hourlypurchasingCustomers; //adds hourly purchasing guests to total purchasing guests

                                Console.WriteLine("SOLD OUT");
                                Console.WriteLine("Amount of people " + totalCustomers + " Purchases " + totalPurchases);
                                totalCustomers = 0;
                                totalPurchases = 0;
                                return(player1);
                            }
                            else
                            {
                                player1.PlayerInventory.icecubes.RemoveAt(k);
                            }
                        }

                        totalPitchers--;
                        player1.PlayerPicther.cupsleftInPitcher = 12;
                    }
                } ////check

                Console.ReadLine();

                totalCustomers += hourlyCustomers;           //adds hourly customers total guests
                totalPurchases += hourlypurchasingCustomers; //adds hourly purchasing guests to total purchasing guests
                //add total purchases and total customers to weekly purchases and weekly customers and reset them
            } //hourly

            weeklypurchases += totalPurchases;
            weeklycustomers += totalCustomers;
            totalCustomers   = 0;
            totalPurchases   = 0;
            Console.WriteLine(player1.name + " Amount of Purchases " + hourlypurchasingCustomers + " Profit " + player1.BusinessProfits);

            return(player1);
        }
Esempio n. 3
0
 public void DisplayDay()
 {
     today.GetWeather();
     Console.WriteLine("You are on day " + daysPlaying + ", todays weather is " + today.GetWeather() + " with a temperature of " + today.GetTemperature());
 }