コード例 #1
0
ファイル: Program.cs プロジェクト: FTWinston/Timeline
        private static void SimulateWorld(WorldService worldService, int numYears)
        {
            var world = worldService.World;

            var timer = new Stopwatch();

            timer.Start();

            for (int year = 1; year <= numYears; year++)
            {
                if (year % 10 == 0)
                {
                    Console.WriteLine($"Year {year} ({world.LivingPeople.Count} living, {world.DeadPeople.Count} dead)");
                }

                worldService.SimulateYear();
            }

            timer.Stop();

            Console.WriteLine($"Completed {world.Date.Ticks} years in {timer.Elapsed}");
            Console.WriteLine($"# Living: {world.LivingPeople.Count}, # dead: {world.DeadPeople.Count}");
            Console.ReadKey();
        }