Example #1
0
 public void RunGame()
 {
     UserInterface.DisplayRules();
     if (SetUpGame() == 1)
     {
         for (dayNumber = 1; dayNumber <= numberOfDaysThreshold; dayNumber++)
         {
             UserInterface.DisplayDayNumber(dayNumber, numberOfDaysThreshold);
             UserInterface.DisplayWeatherIntroduction();
             UserInterface.DisplayForecast(player1Weather);
             UserInterface.DisplayPriceOptions();
             UserInterface.DisplayPurchaseItems(player1, player1Inventory, ref player1Day, store);
             UserInterface.DisplayRecipeIntro();
             player1Stand.GenerateLemonadeRecipeAndPrice(player1Inventory);
             player1Stand.PourLemonadePitcher(player1Inventory);
             UserInterface.DisplayActualWeatherIntro();
             UserInterface.DisplayActualWeather(player1Weather);
             UserInterface.StartSalesProcess();
             SimulateDayOfGame(player1, player1Stand, player1Inventory, player1Day, player1Customers, player1Weather);
             UserInterface.NoCustomersRemaining();
             UserInterface.DisplayEndOfDaySummary(player1Day, player1, player1Inventory);
             UserInterface.WeeklyProfitPrompt(player1, startingCash);
             if (dayNumber == 7)
             {
                 EndOfGame(player1);
             }
             player1Day.ResetDailyData();
             if (player1.CashOnHand <= 0)
             {
                 PlayerWentBankrupt();
             }
             Console.Clear();
         }
     }
     else
     {
         UserInterface.MultiplayerIntro(player1);
         for (dayNumber = 1; dayNumber <= numberOfDaysThreshold; dayNumber++)
         {
             UserInterface.PlayerTurnStart(player1);
             UserInterface.DisplayDayNumber(dayNumber, numberOfDaysThreshold);
             UserInterface.DisplayWeatherIntroduction();
             UserInterface.DisplayForecast(player1Weather);
             UserInterface.DisplayPriceOptions();
             UserInterface.DisplayPurchaseItems(player1, player1Inventory, ref player1Day, store);
             UserInterface.DisplayRecipeIntro();
             player1Stand.GenerateLemonadeRecipeAndPrice(player1Inventory);
             player1Stand.PourLemonadePitcher(player1Inventory);
             //marks the end of player 1 seeing their weather forecast and making purchases, purchases, and setting price
             UserInterface.PlayerTurnStart(player2);
             UserInterface.DisplayDayNumber(dayNumber, numberOfDaysThreshold);
             UserInterface.DisplayWeatherIntroduction();
             UserInterface.DisplayForecast(player2Weather);
             UserInterface.DisplayPriceOptions();
             UserInterface.DisplayPurchaseItems(player2, player2Inventory, ref player2Day, store);
             UserInterface.DisplayRecipeIntro();
             player2Stand.GenerateLemonadeRecipeAndPrice(player2Inventory);
             player2Stand.PourLemonadePitcher(player2Inventory);
             //marks the end of player 2 seeing their weather forecase and making purchases, recipe, and setting price
             UserInterface.PlayerTurnStart(player1);
             UserInterface.DisplayActualWeatherIntro();
             UserInterface.DisplayActualWeather(player1Weather);
             UserInterface.StartSalesProcess();
             SimulateDayOfGame(player1, player1Stand, player1Inventory, player1Day, player1Customers, player1Weather);
             UserInterface.NoCustomersRemaining();
             //marks the end of customers for player 1
             UserInterface.PlayerTurnStart(player2);
             UserInterface.DisplayActualWeatherIntro();
             UserInterface.DisplayActualWeather(player2Weather);
             UserInterface.StartSalesProcess();
             SimulateDayOfGame(player2, player2Stand, player2Inventory, player2Day, player2Customers, player2Weather);
             UserInterface.NoCustomersRemaining();
             //marks the end of customers for player 2
             UserInterface.PlayerTurnStart(player1);
             UserInterface.DisplayEndOfDaySummary(player1Day, player1, player1Inventory);
             UserInterface.WeeklyProfitPrompt(player1, startingCash);
             //marks the end of day summary for player 1
             UserInterface.PlayerTurnStart(player2);
             UserInterface.DisplayEndOfDaySummary(player2Day, player2, player2Inventory);
             UserInterface.WeeklyProfitPrompt(player2, startingCash);
             Console.Clear();
             UserInterface.MultiplayerEndOfDayIntro(dayNumber);
             if (player1.weeklyProfit > player2.weeklyProfit)
             {
                 UserInterface.MultiplayerEndOfDayPlayerWinning(player1, player2.weeklyProfit);
             }
             else if (player2.weeklyProfit > player1.weeklyProfit)
             {
                 UserInterface.MultiplayerEndOfDayPlayerWinning(player2, player1.weeklyProfit);
             }
             else
             {
                 UserInterface.MultiplayerEndOfDayTie(player1);
             }
             player1Day.ResetDailyData();
             player2Day.ResetDailyData();
             if (player1.CashOnHand <= 0)
             {
                 PlayerWentBankrupt();
             }
             Console.Clear();
             if (player2.CashOnHand <= 0)
             {
                 PlayerWentBankrupt();
             }
         }
         if (player1.weeklyProfit > player2.weeklyProfit)
         {
             UserInterface.MultiplayerGameWinnerPrompt(player1, player1.weeklyProfit, player2.weeklyProfit);
             RestartGame();
         }
         else if (player2.weeklyProfit > player1.weeklyProfit)
         {
             UserInterface.MultiplayerGameWinnerPrompt(player2, player2.weeklyProfit, player1.weeklyProfit);
             RestartGame();
         }
         else
         {
             UserInterface.MultiplayerTieGamePrompt();
             RestartGame();
         }
     }
 }
Example #2
0
 public void PlayerWentBankrupt()
 {
     UserInterface.PlayerWentBankrupt();
     RestartGame();
 }