예제 #1
0
        static void Main(string[] args)
        {
            //подгрузка
            LoadData();
            PrepareData();
            //счетчик дней
            int          day              = 6;
            int          hour             = 0;
            int          totalDay         = 0;
            int          currentDay       = 335;
            int          iterator         = 0;
            int          status           = 0;
            int          researchProgress = 0;
            int          countOfDeath     = 0;
            Virus        virus            = new Virus();
            Weather      weather          = new Weather();
            MedicinePart med              = new MedicinePart();
            Economic     Econimic         = new Economic(25, 20, 20, 20, 15);

            while (_Citizens.Length != 0 || researchProgress != 100)
            {
                //перенмещение жителей
                Life.Lifemove(_Citizens, _Facture, _Home, _Shop, day, hour, status);
                PolicePart.PoliceAction(_Troop, ref _Citizens, _Hospital, _Police, status);
                MillitaryPart.MillitaryAction(_Millitary, _Troop, ref _Citizens, _Hospital, _Police, status);
                //заражение(если возможно)
                virus.Infect(ref _Citizens, weather, status);
                //в начале каждого нового дня поражение зараженных
                if (hour == 0)
                {
                    virus.Damaged(ref _Citizens, weather, status);
                    virus.Death(ref _Citizens, ref _Doctor, ref _Policeman, ref _Troop, ref countOfDeath);
                }
                //мутация раз в неделю
                if (Equals(day, Days.Monday))
                {
                    int countOfInfected = 0;
                    for (int i = 0; i < _Citizens.Length; i++)
                    {
                        if (_Citizens[i].WasSick)
                        {
                            countOfInfected++;
                        }
                    }
                    virus.Mutate(_Citizens.Length, countOfInfected);
                    if (Equals(status, MillitaryStatus.StateOfEmergency) || Equals(status, MillitaryStatus.StateOfMillitary))
                    {
                        researchProgress += ScientistPart.Research(_Hospital, Econimic, virus);
                    }
                }
                //оращение к врачу
                if (hour == 9)
                {
                    med.Invites(ref _Citizens, ref _Hospital, _Home, _Doctor);
                    med.Hospitalizations(ref _Citizens, ref _Hospital, _Home);
                    med.LeavesHospital(ref _Citizens, ref _Hospital, _Home);
                }
                //просчет статистики каждый 30 день
                if (totalDay % 30 == 0)
                {
                    status = Medstat.Statistic(_Hospital, _Citizens.Length, countOfDeath);
                }
                //конец цикла перепросчет дневной статистики и изменение погоды
                Logger.Log_Infected(iterator, _Citizens, _Police, _Hospital, _Millitary, _Facture, _Home);
                Logger.Log_Global(iterator, day, hour, _Citizens, _Policeman, _Doctor, _Troop, weather, status, researchProgress, countOfDeath);
                Logger.Log_Med_Stat(_Citizens, iterator);
                Logger.Log_Virus(virus, iterator);
                hour++;
                iterator++;
                if (hour == 24)
                {
                    hour = 0;
                    day++;
                    totalDay++;
                    currentDay++;
                    weather.ChangeWeather(currentDay);
                    if (day == 7)
                    {
                        day = 0;
                    }
                    if (currentDay == 366)
                    {
                        currentDay = 1;
                    }
                }
            }
            Console.ReadKey();
        }