Example #1
0
        public City(StartingValues startValues)
        {
            storagePathPeople = startValues.StoragePath;
            storagePathMap = startValues.StoragePathMap;

            mManager = new TrafficMutator();
            _budget = startValues.Budget;
             _traffictCycleTime = startValues.TrafficLightCycleTimeDefault;
            _cityHeight = startValues.MapHeight;
            _cityWidth = startValues.MapWidth;
            _population = startValues.Population;
            _zoning = new ZoneMap(_cityWidth,_cityHeight);

            LiveMap = new ITile[_cityWidth, _cityHeight];

            TravelTimes = new int[_cityWidth, _cityHeight];

            if (File.Exists(storagePathPeople))
            {
                //GeneratePeople();
                LoadPeopleFromFile();

            }
            else
            {
                _zoning = GenerateZones(_zoning);
                LiveMap = GenerateLiveMap(LiveMap);
                GenerateTravelTimeHelper();
                GeneratePeople();
            }

            PrintCity();
            //The larger the number the more accurate the final prediction
            while (mManager.GetNumberOfCyclesSinceLastKeptChange() < 200000)
             {
                 Tick();
             }

             Console.Out.WriteLine("The ideal intersection timing for this city is... [Measured in ticks]");
            PrintFinalOutput();
        }
Example #2
0
        public City(StartingValues startValues)
        {
            storagePathPeople = startValues.StoragePath;
            storagePathMap    = startValues.StoragePathMap;

            mManager           = new TrafficMutator();
            _budget            = startValues.Budget;
            _traffictCycleTime = startValues.TrafficLightCycleTimeDefault;
            _cityHeight        = startValues.MapHeight;
            _cityWidth         = startValues.MapWidth;
            _population        = startValues.Population;
            _zoning            = new ZoneMap(_cityWidth, _cityHeight);

            LiveMap = new ITile[_cityWidth, _cityHeight];

            TravelTimes = new int[_cityWidth, _cityHeight];


            if (File.Exists(storagePathPeople))
            {
                //GeneratePeople();
                LoadPeopleFromFile();
            }
            else
            {
                _zoning = GenerateZones(_zoning);
                LiveMap = GenerateLiveMap(LiveMap);
                GenerateTravelTimeHelper();
                GeneratePeople();
            }

            PrintCity();
            //The larger the number the more accurate the final prediction
            while (mManager.GetNumberOfCyclesSinceLastKeptChange() < 200000)
            {
                Tick();
            }

            Console.Out.WriteLine("The ideal intersection timing for this city is... [Measured in ticks]");
            PrintFinalOutput();
        }