Exemplo n.º 1
0
 public void UpdateVirusesStateOfThePatient(PatientStatistics o_PatientStatistics)
 {
     GenerateReproducmentProbability(); // determine what is the real probability by the parameters of number of viruses compared to the number of cells times the given growth constant
     List<Virus> ReproducedViruses = new List<Virus>(); // the viruses that have been reproduced in one (this) phase
     foreach (Virus virus in VirusPopulation)
     {
         Virus newVirus = virus.UpdateSelfStateAndCheckWhetherToReproduce(ReproducmentProbability);
         if (newVirus != null)
         {
             ReproducedViruses.Add(newVirus);
         }
     }
     // at the end of this phase, we add the new viruses that have been reproduced:
     if (ReproducedViruses.Count > 0)
     {
         VirusPopulation.AddRange(ReproducedViruses);
     }
     // a day (iteration) has passed, so:
     ADayPass();
     // at the end, lets make a new record for our statistics object:
     PatientDayRecord patientDayRecord = new PatientDayRecord(CalculateNumberOfAliveViruses(), CalculateNumberOfDeadViruses());
     o_PatientStatistics.DaysRecords.Add(patientDayRecord);
 }