Exemple #1
0
 public void ChangeWeather(int daypos)
 {
     if (GeneralOperations.Success(25))
     {
         isRain = true;
         if (wet + 30 <= 100)
         {
             wet += 30;
         }
         else
         {
             wet = 100;
         }
         t--;
     }
     else
     {
         isRain = false;
         if (wet - 1 >= 10)
         {
             wet--;
         }
         else
         {
             wet = 10;
         }
     }
     ChangeTemperature(daypos);
 }
Exemple #2
0
 public static bool InviteCondition(Citizen patient)
 {
     if ((Equals(patient.HealthStatus, HealthStatus.Critical)
          ||
          Equals(patient.HealthStatus, HealthStatus.SeriousCold)
          ||
          (Equals(patient.HealthStatus, HealthStatus.MildСold) && !patient.HardWorker)) && patient.WasSick)
     {
         return(GeneralOperations.Success(patient.TrustTheDoctor));
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
        public static bool Condition(Weather weather, Citizen ppatient, int status, Virus virus)
        {
            int statusFactor      = InfectFactors.StatusFactor(status);
            int wetFactor         = InfectFactors.WetFactor(weather, virus.WetProtect);
            int temperatureFactor = InfectFactors.TemperatureFactor(weather, virus.CoefDifficultInfectDuringUncomfort, virus.MinInfectT, virus.MaxInfectT);
            int imunityFactor     = InfectFactors.ImmunityFactor(ppatient.Immunity);

            float probability = (3 * imunityFactor + wetFactor + temperatureFactor + statusFactor) / 6;

            if (GeneralOperations.Success(probability))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        //мутация
        public void Mutate(int NumberOfCitizens, int NumberOfInfected)
        {
            if (GeneralOperations.Success((NumberOfInfected / NumberOfCitizens) * 100))
            {
                return;
            }
            int coefOfMutate;

            if (GeneralOperations.Success(ProbabilityOfPositiveMutation))
            {
                coefOfMutate = 1;
            }
            else
            {
                coefOfMutate = -1;
            }

            Random rand           = new Random();
            int    caseOfMutation = rand.Next(100);

            switch (caseOfMutation)
            {
            case int n when(n <= 2):
                if (MutateConditions.DifficultConditions(Difficult))
                {
                    Difficult += coefOfMutate;
                }
                break;

            case int n when(n > 2 && n <= 8):
                if (MutateConditions.MinInfectTConditions(MaxInfectT, MaxInfectT, MinComfortT, MaxComfortT))
                {
                    MinInfectT += coefOfMutate;
                }
                break;

            case int n when(n > 8 && n <= 14):
                if (MutateConditions.MaxInfectTConditions(MaxInfectT, MaxInfectT, MinComfortT, MaxComfortT))
                {
                    MaxInfectT += coefOfMutate;
                }
                break;

            case int n when(n > 15 && n <= 20):
                if (MutateConditions.MinComfortTConditions(MaxInfectT, MaxInfectT, MinComfortT, MaxComfortT))
                {
                    MinComfortT += coefOfMutate;
                }
                break;

            case int n when(n > 20 && n <= 26):
                if (MutateConditions.MaxComfortTConditions(MaxInfectT, MaxInfectT, MinComfortT, MaxComfortT))
                {
                    MaxComfortT += coefOfMutate;
                }
                break;

            case 27:
                if (MutateConditions.CoefDifficultInfectConditions(CoefDifficultInfectDuringUncomfort))
                {
                    CoefDifficultInfectDuringUncomfort += coefOfMutate;
                }
                break;

            case int n when(n > 27 && n <= 29):
                if (MutateConditions.SystemDamagedConditions(skeletonDamaged))
                {
                    skeletonDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 29 && n <= 32):
                if (MutateConditions.SystemDamagedConditions(muscleDamaged))
                {
                    muscleDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 32 && n <= 37):
                if (MutateConditions.SystemDamagedConditions(respiratoryDamaged))
                {
                    respiratoryDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 37 && n <= 39):
                if (MutateConditions.SystemDamagedConditions(circulatoryDamaged))
                {
                    circulatoryDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 39 && n <= 42):
                if (MutateConditions.SystemDamagedConditions(diureticDamaged))
                {
                    diureticDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 42 && n <= 44):
                if (MutateConditions.SystemDamagedConditions(digestiveDamaged))
                {
                    digestiveDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 44 && n <= 48):
                if (MutateConditions.SystemDamagedConditions(nervousDamaged))
                {
                    nervousDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 48 && n <= 50):
                if (MutateConditions.SystemDamagedConditions(reproductiveDamaged))
                {
                    reproductiveDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 50 && n <= 53):
                if (MutateConditions.SystemDamagedConditions(sensoryDamaged))
                {
                    sensoryDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 53 && n <= 57):
                if (MutateConditions.SystemDamagedConditions(lyphaticDamaged))
                {
                    lyphaticDamaged += coefOfMutate;
                }
                break;

            case int n when(n > 57 && n <= 62):
                if (MutateConditions.SystemDamagedConditions(immunityDamaged))
                {
                    immunityDamaged += coefOfMutate;
                }
                break;
            }
        }