Esempio n. 1
0
        static void Main()
        {
            var assets = new Assets
            {
                Cash      = 10000.0,
                Portfolio = ImmutableArray.CreateRange(Enumerable.Repeat(0, Companies.Length))
            };

            var previousDay = default(TradingDay);

            Controller.StartGame();

            foreach (var day in StockMarket.Simulate(Companies))
            {
                if (previousDay is null)
                {
                    View.ShowCompanies(day.Companies);
                }
                else
                {
                    View.ShowTradeResults(day, previousDay, assets);
                }

                View.ShowAssets(assets, day.Companies);

                if (previousDay is not null && !Controller.GetYesOrNo(View.PromptContinue))
                {
                    break;
                }

                assets      = Controller.UpdateAssets(assets, day.Companies);
                previousDay = day;
            }

            View.ShowFarewell();
        }