public virtual bool CalcInfected(VirusSpreading.Human Neighbor, double RandomValue, double ComparedTo)
 {
     {
         if (RandomValue < ComparedTo)
         {
             {
                 Neighbor.SetInfected(true);
                 R0++;
                 return(true
                        );
             }
             ;
         }
         else
         {
             {
                 return(false
                        );
             }
             ;
         }
         ;
     }
     return(default(bool));;
 }
示例#2
0
 public void _KillHuman(VirusSpreading.Human target, int executionFrequency = 1)
 {
     target._isAlive = false;
     _HumanEnvironment.Remove(target);
     _Unregister(this, target, target._executionFrequency);
     _HumanAgents.Remove(target.ID);
 }
 public virtual bool Infect(VirusSpreading.Human Neighbor, double Distance)
 {
     {
         int RandomValue = _Random.Next(100);
         if (Distance <= 1)
         {
             {
                 return(CalcInfected(Neighbor, RandomValue, Infection_rate1)
                        );
             }
             ;
         }
         ;
         if (Distance <= 2)
         {
             {
                 return(CalcInfected(Neighbor, RandomValue, Infection_rate2)
                        );
             }
             ;
         }
         ;
     }
     return(default(bool));;
 }
示例#4
0
        public VirusSpreading.Human _SpawnHuman(double xcor = 0, double ycor = 0, int freq = 1)
        {
            var id    = System.Guid.NewGuid();
            var agent = new VirusSpreading.Human(id, this, _Register, _Unregister,
                                                 _HumanEnvironment,
                                                 default(int),
                                                 default(int),
                                                 default(int),
                                                 default(int),
                                                 default(int),
                                                 default(int),
                                                 default(int)
                                                 , xcor, ycor, freq);

            _HumanAgents.Add(id, agent);
            return(agent);
        }