예제 #1
0
 private void PrintDayResults(LemonadeStandOwner player)
 {
     if (players.Count > 1)
     {
         UI.ClearPrint($"{player.name}'s results"); Console.ReadLine();
     }
     Console.WriteLine($"You sold {player.cupsSoldToday} cups to {player.customersServedToday} customers.\n");
     Console.WriteLine($"Today's revenue: ${player.moneyEarnedToday}\nToday's costs: ${player.moneySpentToday}\nToday's net profit: ${player.moneyEarnedToday - player.moneySpentToday}");
     Console.WriteLine($"Total revenue: ${player.moneyEarnedTotal}\nTotal costs: ${player.moneySpentTotal}\nTotal net profit: ${player.moneyEarnedTotal - player.moneySpentTotal}");
     Console.WriteLine($"Today's Customer Satisfaction: {player.todayCustomerSatisfaction}\nPopularity: {player.popularity}");
     Console.ReadLine();
 }
예제 #2
0
 public void WrapUpDay(LemonadeStandOwner player)
 {
     player.moneyEarnedTotal += player.moneyEarnedToday;
     player.moneySpentTotal  += player.moneySpentToday;
     player.popularity       += player.todayCustomerSatisfaction;
     UI.ClearPrint($"Day {dayCounter} results");
     PrintDayResults(player);
     player.SpoilItems();
     player.moneyEarnedToday          = 0;
     player.moneySpentToday           = 0;
     player.cupsSoldToday             = 0;
     player.customersServedToday      = 0;
     player.todayCustomerSatisfaction = 0;
 }
예제 #3
0
        public virtual void Shop(string weatherForecast)
        {
            UI.ClearPrint(weatherForecast);
            Console.WriteLine($"Select an item by it's number, or type 'done'\n${money} Remaining");
            PrintInventory();
            string userInput = Console.ReadLine().ToLower();

            if (userInput != "done")
            {
                try
                {
                    int userChoice = int.Parse(userInput) - 1;
                    BuyItem(userChoice);
                    Shop(weatherForecast);
                }
                catch
                {
                    Console.WriteLine("Error. Make sure you select the number of your choice.");
                    Shop(weatherForecast);
                }
            }
        }
예제 #4
0
        public virtual void ManageStand(string weatherForecast)
        {
            UI.ClearPrint(weatherForecast);
            Console.WriteLine("What would you like to do?\n(S)hop for Supplies\nChange (R)ecipe\nSet (P)rice\nStart (D)ay\nDeclare (B)ankruptcy");
            string userInput = Console.ReadLine().ToLower();

            switch (userInput)
            {
            case "s":
                Shop(weatherForecast);
                ManageStand(weatherForecast);
                break;

            case "r":
                writeRecipe();
                ManageStand(weatherForecast);
                break;

            case "p":
                SetPrice();
                ManageStand(weatherForecast);
                break;

            case "d":
                break;

            case "b":
                UI.ClearPrint($"You declare bankruptcy! {name}'s lemonade stand is finished!");
                isBankrupt = true;
                Console.ReadLine();
                break;

            default:
                Console.WriteLine("Not a valid command. Please pick S, R, P, D, or B");
                Console.ReadLine();
                ManageStand(weatherForecast);
                break;
            }
        }
예제 #5
0
        public void RunDay()
        {
            today = new Day();
            string weatherForecast = $"Weather Forecast: {today.forecastWeather.name}\nTemperature Forecast: {today.forecastTemperature}\n";

            foreach (LemonadeStandOwner player in players)
            {
                if (!player.isBankrupt)
                {
                    if (players.Count > 1 && player.GetType() != typeof(Computer))
                    {
                        UI.ClearPrint($"{player.name}'s turn"); Console.ReadLine();
                    }
                    player.ManageStand(weatherForecast);
                }
            }

            todayCustomerTraffic = baseDailyCustomerTraffic + today.actualWeather.customerTrafficModifier + (today.actualTemperature - 50);
            UI.ClearPrint($"Begin Day {dayCounter}");
            Console.ReadLine();
            foreach (LemonadeStandOwner player in players)
            {
                if (!player.isBankrupt)
                {
                    RunPeriods(player);
                }
            }
            foreach (LemonadeStandOwner player in players)
            {
                if (!player.isBankrupt)
                {
                    WrapUpDay(player);
                }
            }
            Console.ReadLine();
            dayCounter++;
        }
예제 #6
0
        public void RunPeriods(LemonadeStandOwner player)
        {
            if (players.Count > 1)
            {
                UI.ClearPrint($"{player.name}'s turn."); Console.ReadLine();
            }
            for (int i = 1; i <= periodsPerDay; i++)
            {
                StartPeriod(i, player);
                ShortageAlert(player);
                //customer loop
                for (int j = 0; j < (todayCustomerTraffic + player.popularity) / periodsPerDay; j++)
                {
                    customer = new Customer(randomizer);

                    if (player.lemonadeCupPrice <= SetCustomerPrice())
                    {
                        player.ServeCustomer(customer.cupsDesired);
                        player.todayCustomerSatisfaction = customer.GetSatisfaction(player.currentRecipe.lemonsPerPitcher, player.currentRecipe.sugarPerPitcher, player.currentRecipe.icePerCup);
                    }
                }
                WrapUpPeriod(i, player);
            }
        }
예제 #7
0
 public void StartPeriod(int periodNumber, LemonadeStandOwner player)
 {
     UI.ClearPrint($"Begin Period {periodNumber}");
     Console.WriteLine($"It is {today.actualWeather.name}\nIt is {today.actualTemperature} degrees");
     player.ChangePrice();
 }